diff --git a/files/helpers/jinja2.py b/files/helpers/jinja2.py index f3e28af75..7dfddcbc8 100644 --- a/files/helpers/jinja2.py +++ b/files/helpers/jinja2.py @@ -3,11 +3,6 @@ from .get import * from os import listdir, environ from .const import * -@app.template_filter("full_link") -def full_link(url): - - return f"{SITE_FULL}{url}" - @app.template_filter("app_config") def app_config(x): return app.config.get(x) diff --git a/files/routes/feeds.py b/files/routes/feeds.py index 84ee231ec..2f19d8f11 100644 --- a/files/routes/feeds.py +++ b/files/routes/feeds.py @@ -1,7 +1,6 @@ import html from .front import frontlist from datetime import datetime -from files.helpers.jinja2 import full_link from files.helpers.get import * from yattag import Doc from files.helpers.wrappers import * @@ -55,7 +54,7 @@ def feeds_user(v=None, sort='hot', t='all'): with tag("uri"): text(f'{SITE_FULL}/@{post.author_name}') - doc.stag("link", href=full_link(post.permalink)) + doc.stag("link", href=post.permalink) image_url = post.thumb_url or post.embed_url or post.url diff --git a/files/routes/posts.py b/files/routes/posts.py index 7311e8513..f780d4649 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -660,7 +660,62 @@ 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) + + body_html = sanitize(f'New rdrama mention: https://old.reddit.com{i["permalink"]}', 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('sex') + + new_comment = Comment(author_id=NOTIFICATIONS_ID, + parent_submission=None, + distinguish_level=6, + body_html=body_html, + level=1, + sentto=0, + ) + db.add(new_comment) + db.flush() + + admins = db.query(User).filter(User.admin_level > 0).all() + 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) + + 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, + body_html=body_html, + level=1, + sentto=0, + ) + db.add(new_comment) + db.flush() + + admins = db.query(User).filter(User.admin_level > 0).all() + for admin in admins: + notif = Notification(comment_id=new_comment.id, user_id=admin.id) + db.add(notif) + break + + db.commit() db.close() + stdout.flush() return diff --git a/files/routes/users.py b/files/routes/users.py index 529ae5268..2df466457 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -1022,7 +1022,8 @@ def fp(v, fp): new_alt = Alt(user1=v.id, user2=u.id) g.db.add(new_alt) g.db.flush() - print('\n\n' + v.username + ' + ' + u.username + '\n\n') + if v.email == u.email: print('\n\n' + v.username + ' + ' + u.username + v.email + '\n\n') + if v.fp == u.fp: print('\n\n' + v.username + ' + ' + u.username + v.fp + '\n\n') g.db.add(v) g.db.commit() return '', 204 \ No newline at end of file diff --git a/files/templates/comments.html b/files/templates/comments.html index 1f9729c6b..c446e99d8 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -441,7 +441,7 @@ Context - + {% if v %} @@ -611,7 +611,7 @@ {% if not c.ghost %}
  • Votes
  • {% endif %} - Copy link + Copy link Context diff --git a/files/templates/default.html b/files/templates/default.html index 609652da5..4e415b701 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -48,7 +48,7 @@ - + @@ -59,7 +59,7 @@ - + {% endblock %} diff --git a/files/templates/log.html b/files/templates/log.html index 0f598b8ba..8b9fdd5ad 100644 --- a/files/templates/log.html +++ b/files/templates/log.html @@ -105,7 +105,7 @@
    {{ma.age_string}} - +
    diff --git a/files/templates/notifications.html b/files/templates/notifications.html index e86535253..3bfc65f7d 100644 --- a/files/templates/notifications.html +++ b/files/templates/notifications.html @@ -30,7 +30,7 @@ Messages - {% if v.admin_level > 1 %} + {% if v.admin_level > 2 %} - Copy link + Copy link {% if v %}
  • diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 6c48a2347..9d8f13e73 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -226,7 +226,7 @@ Give Award {% endif %} - Copy link + Copy link {% if v %} Subscribe @@ -326,7 +326,7 @@
  • - + {% if p.realbody(v) and request.path != "/changelog"%} diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 249201981..84c05d24e 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -17,7 +17,7 @@ - + @@ -26,7 +26,7 @@ - + {% endblock %} {% block desktopUserBanner %}