You've already forked KemoFureApi
added filter by account rating
This commit is contained in:
@@ -19,22 +19,32 @@ class Archive_GetPosts(Resource):
|
||||
response.headers.add("Access-Control-Allow-Origin", "*")
|
||||
return response
|
||||
|
||||
param = []
|
||||
actions = []
|
||||
if "undecided" in request.args:
|
||||
param.append(0)
|
||||
actions.append(0)
|
||||
if "approved" in request.args:
|
||||
param.append(1)
|
||||
actions.append(1)
|
||||
if "denied" in request.args:
|
||||
param.append(2)
|
||||
actions.append(2)
|
||||
if "hidden" in request.args:
|
||||
param.append(3)
|
||||
if param == []:
|
||||
param = [0,1,2,3]
|
||||
actions.append(3)
|
||||
if actions == []:
|
||||
actions = [0,1,2,3]
|
||||
|
||||
ratings = []
|
||||
if "SFW" in request.args:
|
||||
ratings.append("SFW")
|
||||
if "NSFW" in request.args:
|
||||
ratings.append("NSFW")
|
||||
if "NSFL" in request.args:
|
||||
ratings.append("NSFL")
|
||||
if ratings == []:
|
||||
ratings = ["SFW", "NSFW"]
|
||||
|
||||
real_page = page-1
|
||||
offset = real_page * count
|
||||
|
||||
result = db.get_posts(count, param, last_id, offset)
|
||||
result = db.get_posts(count, actions_taken=actions, last_id= -1, offset= offset, include_ratings= ratings)
|
||||
|
||||
if result is None:
|
||||
response = app.response_class(status=400)
|
||||
|
||||
Reference in New Issue
Block a user