From 202a8f80eb62feda00af1730ac7e19431a56c9f1 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 28 Jan 2022 23:06:31 +0200 Subject: [PATCH] fds --- files/helpers/jinja2.py | 6 +----- files/routes/feeds.py | 1 + files/routes/posts.py | 14 +++----------- files/templates/authforms.html | 6 +++--- files/templates/default.html | 16 ++++++++-------- files/templates/email/default.html | 2 +- files/templates/errors/patron.html | 2 +- files/templates/header.html | 8 ++++---- files/templates/log.html | 4 ++-- files/templates/login.html | 6 +++--- files/templates/login_2fa.html | 6 +++--- files/templates/settings.html | 6 +++--- files/templates/settings2.html | 10 +++++----- files/templates/sign_up.html | 10 +++++----- files/templates/sign_up_failed_ref.html | 10 +++++----- files/templates/submit.html | 6 +++--- 16 files changed, 51 insertions(+), 62 deletions(-) diff --git a/files/helpers/jinja2.py b/files/helpers/jinja2.py index 7dfddcbc8..4d71e1545 100644 --- a/files/helpers/jinja2.py +++ b/files/helpers/jinja2.py @@ -3,10 +3,6 @@ from .get import * from os import listdir, environ from .const import * -@app.template_filter("app_config") -def app_config(x): - return app.config.get(x) - @app.template_filter("post_embed") def post_embed(id, v): @@ -20,4 +16,4 @@ def post_embed(id, v): @app.context_processor def inject_constants(): - return {"environ":environ, "SITE_NAME":SITE_NAME, "AUTOJANNY_ID":AUTOJANNY_ID, "NOTIFICATIONS_ID":NOTIFICATIONS_ID, "PUSHER_ID":PUSHER_ID, "CC":CC, "CC_TITLE":CC_TITLE, "listdir":listdir, "MOOSE_ID":MOOSE_ID, "AEVANN_ID":AEVANN_ID} + return {"environ":environ, "SITE_NAME":SITE_NAME, "AUTOJANNY_ID":AUTOJANNY_ID, "NOTIFICATIONS_ID":NOTIFICATIONS_ID, "PUSHER_ID":PUSHER_ID, "CC":CC, "CC_TITLE":CC_TITLE, "listdir":listdir, "MOOSE_ID":MOOSE_ID, "AEVANN_ID":AEVANN_ID, "config":app.config.get} diff --git a/files/routes/feeds.py b/files/routes/feeds.py index 2f19d8f11..6b79038ad 100644 --- a/files/routes/feeds.py +++ b/files/routes/feeds.py @@ -4,6 +4,7 @@ from datetime import datetime from files.helpers.get import * from yattag import Doc from files.helpers.wrappers import * +from files.helpers.jinja2 import * from files.__main__ import app diff --git a/files/routes/posts.py b/files/routes/posts.py index f780d4649..109f5018a 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -660,8 +660,7 @@ def thumbnail_thread(pid): db.add(post) db.commit() - for i in requests.get('https://api.pushshift.io/reddit/submission/search?html_decode=true&q=rdrama&size=100').json()["data"]: - print(i) + for i in requests.get('https://api.pushshift.io/reddit/submission/search?html_decode=true&q=rdrama&size=10').json()["data"]: body_html = sanitize(f'New rdrama mention: https://old.reddit.com{i["permalink"]}', noimages=True) @@ -669,8 +668,6 @@ def thumbnail_thread(pid): if existing_comment: break - print('sex') - new_comment = Comment(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, @@ -685,18 +682,14 @@ def thumbnail_thread(pid): for admin in admins: notif = Notification(comment_id=new_comment.id, user_id=admin.id) db.add(notif) - break - for i in requests.get('https://api.pushshift.io/reddit/comment/search?html_decode=true&q=rdrama&size=100').json()["data"]: - print(i) - - body_html = sanitize(f'New rdrama mention: https://old.reddit.com{i["permalink"]}', noimages=True) + for i in requests.get('https://api.pushshift.io/reddit/comment/search?html_decode=true&q=rdrama&size=10').json()["data"]: + body_html = sanitize(f'New rdrama mention: https://old.reddit.com{i["permalink"]}?context=99', noimages=True) existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1, sentto=0).first() if existing_comment: break - print('ffugq') new_comment = Comment(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, @@ -711,7 +704,6 @@ def thumbnail_thread(pid): for admin in admins: notif = Notification(comment_id=new_comment.id, user_id=admin.id) db.add(notif) - break db.commit() db.close() diff --git a/files/templates/authforms.html b/files/templates/authforms.html index e52a806ac..45942d230 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -2,7 +2,7 @@ - + @@ -38,8 +38,8 @@ {% endif %} {% else %} - - + + {% endif %} diff --git a/files/templates/default.html b/files/templates/default.html index 4e415b701..6a0935c40 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -1,7 +1,7 @@ - + @@ -31,8 +31,8 @@ {% endif %} {% else %} - - + + {% endif %} @@ -49,7 +49,7 @@ - + @@ -57,7 +57,7 @@ - + {% endblock %} @@ -69,13 +69,13 @@ - + - + - + diff --git a/files/templates/email/default.html b/files/templates/email/default.html index 7e7443ccb..8fecb57ab 100644 --- a/files/templates/email/default.html +++ b/files/templates/email/default.html @@ -2,7 +2,7 @@ - + diff --git a/files/templates/errors/patron.html b/files/templates/errors/patron.html index d6c46527f..ce63203d0 100644 --- a/files/templates/errors/patron.html +++ b/files/templates/errors/patron.html @@ -14,7 +14,7 @@ :#marseymerchant:

401 Not Authorized

This page is only available to {% if request.host == "rdrama.net" %}paypigs{% else %}patrons{% endif %}:

- {{'GUMROAD_LINK' | app_config}} + {{config('GUMROAD_LINK')}} diff --git a/files/templates/header.html b/files/templates/header.html index cb21ec8dc..d239d0166 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -110,7 +110,7 @@
- Android app + Android app Changelog @@ -124,7 +124,7 @@ Discord {% endif %} {% if not (g.webview and v.truecoins < 1) %} - Donate + Donate {% endif %} {% if request.host == 'rdrama.net' %}Archives{% endif %} Contact us @@ -174,7 +174,7 @@ - Android app + Android app Source code @@ -182,7 +182,7 @@ Discord {% endif %} {% if not (g.webview and v.truecoins < 1) %} - Donate + Donate {% endif %} {% if request.host == 'rdrama.net' %}Archives{% endif %} Contact us diff --git a/files/templates/log.html b/files/templates/log.html index 8b9fdd5ad..eaccaa767 100644 --- a/files/templates/log.html +++ b/files/templates/log.html @@ -29,8 +29,8 @@ {% endif %} {% else %} - - + + {% endif %}
diff --git a/files/templates/login.html b/files/templates/login.html index c20df6632..6f8d7b4d4 100644 --- a/files/templates/login.html +++ b/files/templates/login.html @@ -3,7 +3,7 @@ - + @@ -17,9 +17,9 @@ Login - {{SITE_NAME}} {% endblock %} - + - + diff --git a/files/templates/login_2fa.html b/files/templates/login_2fa.html index 903dd4d9a..12843bafc 100644 --- a/files/templates/login_2fa.html +++ b/files/templates/login_2fa.html @@ -3,7 +3,7 @@ - + @@ -13,8 +13,8 @@ 2-Step Login - {{SITE_NAME}} - - + + diff --git a/files/templates/settings.html b/files/templates/settings.html index 718c9b848..f5475a936 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -2,7 +2,7 @@ - + @@ -20,7 +20,7 @@ - + @@ -28,7 +28,7 @@ - + diff --git a/files/templates/settings2.html b/files/templates/settings2.html index cdf11c635..9e08efa5c 100644 --- a/files/templates/settings2.html +++ b/files/templates/settings2.html @@ -3,7 +3,7 @@ - + @@ -20,7 +20,7 @@ - + @@ -28,7 +28,7 @@ - + @@ -41,8 +41,8 @@ {% else %} - - + + {% endif %} diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index e978ec5b2..7c1e6627b 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -2,7 +2,7 @@ - + @@ -16,7 +16,7 @@ - + @@ -24,14 +24,14 @@ - + {% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}Sign up - {{SITE_NAME}}{% endif %} - - + + diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index fc79ecb5e..074d381ee 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -3,7 +3,7 @@ - + @@ -17,7 +17,7 @@ - + @@ -25,14 +25,14 @@ - + {% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %} - - + + diff --git a/files/templates/submit.html b/files/templates/submit.html index e9a795f6b..a76a5e0d4 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -1,7 +1,7 @@ - + @@ -49,9 +49,9 @@ {% endif %} {% else %} - + - + {% endif %} {% endblock %}