From 703c285917be747aba83baa554ad7dde716ddc11 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 15 Oct 2021 19:13:37 +0200 Subject: [PATCH] gfg --- files/routes/front.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/files/routes/front.py b/files/routes/front.py index 7db28ee54..fc32f0d55 100755 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -131,6 +131,8 @@ def front_all(v): t=t, v=v, filter_words=v.filter_words if v else [], + gt=int(request.values.get("utc_greater_than", 0)), + lt=int(request.values.get("utc_less_than", 0)), ) posts = get_posts(ids, v=v) @@ -143,7 +145,7 @@ def front_all(v): @cache.memoize(timeout=86400) -def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words=''): +def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='', gt=None, lt=None)): posts = g.db.query(Submission.id).options(lazyload('*')) @@ -180,6 +182,9 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words=' for word in filter_words: posts=posts.filter(not_(Submission.title.ilike(f'%{word}%'))) + if gt: posts = posts.filter(Submission.created_utc > gt) + if lt: posts = posts.filter(Submission.created_utc < lt) + if not (v and v.shadowbanned): shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned != None).all()] posts = posts.filter(Submission.author_id.notin_(shadowbanned))