From 43e2aedbd21d520bfc3613c205b669f0157b3805 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 15 Jan 2022 08:01:39 +0200 Subject: [PATCH] bbbb --- docker-compose.yml | 1 + env | 1 + files/classes/user.py | 5 ----- files/helpers/const.py | 2 +- files/helpers/jinja2.py | 2 +- files/routes/comments.py | 4 ++-- files/routes/users.py | 4 ++-- files/templates/default.html | 2 +- files/templates/home.html | 5 +++-- 9 files changed, 12 insertions(+), 14 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c841da7e6..5bcec7e89 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,6 +21,7 @@ services: - HCAPTCHA_SECRET=3435tdfsdudebussylmaoxxt43 - YOUTUBE_KEY=3435tdfsdudebussylmaoxxt43 - PUSHER_KEY=3435tdfsdudebussylmaoxxt43 + - PUSHER_ID=3435tdfsdudebussylmaoxxt43 - IMGUR_KEY=3435tdfsdudebussylmaoxxt43 - SPAM_SIMILARITY_THRESHOLD=0.5 - SPAM_URL_SIMILARITY_THRESHOLD=0.1 diff --git a/env b/env index 96faafb90..72104bb46 100644 --- a/env +++ b/env @@ -9,6 +9,7 @@ export DISCORD_CLIENT_SECRET="3435tdfsdudebussylmaoxxt43" export DISCORD_BOT_TOKEN="3435tdfsdudebussylmaoxxt43" export HCAPTCHA_SECRET="3435tdfsdudebussylmaoxxt43" export YOUTUBE_KEY="3435tdfsdudebussylmaoxxt43" +export PUSHER_ID="3435tdfsdudebussylmaoxxt43" export PUSHER_KEY="3435tdfsdudebussylmaoxxt43" export IMGUR_KEY="3435tdfsdudebussylmaoxxt43" export SPAM_SIMILARITY_THRESHOLD="0.5" diff --git a/files/classes/user.py b/files/classes/user.py index a6b49739f..39acea5ff 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -225,11 +225,6 @@ class User(Base): if u.patron: return True return False - @property - @lazy - def strid(self): - return str(self.id) - @cache.memoize(timeout=86400) def userpagelisting(self, v=None, page=1, sort="new", t="all"): diff --git a/files/helpers/const.py b/files/helpers/const.py index b4d8ac937..5976f5e6f 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -208,7 +208,7 @@ else: BUG_THREAD = 0 WELCOME_MSG = f"Welcome to {SITE}!" -PUSHER_INSTANCE_ID = '02ddcc80-b8db-42be-9022-44c546b4dce6' +PUSHER_ID = environ.get("PUSHER_ID", "").strip() PUSHER_KEY = environ.get("PUSHER_KEY", "").strip() BADGES = { diff --git a/files/helpers/jinja2.py b/files/helpers/jinja2.py index a18cd9228..42c926ab4 100644 --- a/files/helpers/jinja2.py +++ b/files/helpers/jinja2.py @@ -24,4 +24,4 @@ def post_embed(id, v): @app.context_processor def inject_constants(): - return {"num_banners":num_banners, "environ":environ, "SITE_NAME":SITE_NAME, "AUTOJANNY_ID": AUTOJANNY_ID, "NOTIFICATIONS_ID": NOTIFICATIONS_ID} \ No newline at end of file + return {"num_banners":num_banners, "environ":environ, "SITE_NAME":SITE_NAME, "AUTOJANNY_ID": AUTOJANNY_ID, "NOTIFICATIONS_ID": NOTIFICATIONS_ID, "PUSHER_ID": PUSHER_ID} \ No newline at end of file diff --git a/files/routes/comments.py b/files/routes/comments.py index 8547f5758..d36048163 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -17,7 +17,7 @@ else: cc = "COUNTRY CLUB" IMGUR_KEY = environ.get("IMGUR_KEY").strip() beams_client = PushNotifications( - instance_id=PUSHER_INSTANCE_ID, + instance_id=PUSHER_ID, secret_key=PUSHER_KEY, ) @@ -469,7 +469,7 @@ def api_comment(v): if parent.author.id != v.id: try: beams_client.publish_to_interests( - interests=[str(parent.author.id)], + interests=[f'{request.host}{parent.author.id}'], publish_body={ 'web': { 'notification': { diff --git a/files/routes/users.py b/files/routes/users.py index 92c37e776..79fdc569e 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -14,7 +14,7 @@ from collections import Counter site = environ.get("DOMAIN").strip() -beams_client = PushNotifications(instance_id=PUSHER_INSTANCE_ID, secret_key=PUSHER_KEY) +beams_client = PushNotifications(instance_id=PUSHER_ID, secret_key=PUSHER_KEY) db = db_session() @@ -438,7 +438,7 @@ def message2(v, username): try: beams_client.publish_to_interests( - interests=[str(user.id)], + interests=[f'{request.host}{parent.author.id}'], publish_body={ 'web': { 'notification': { diff --git a/files/templates/default.html b/files/templates/default.html index 05cb9a441..6878b51cd 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -2,7 +2,7 @@ - + {% if v %} diff --git a/files/templates/home.html b/files/templates/home.html index 91c82f5be..ac81c2597 100644 --- a/files/templates/home.html +++ b/files/templates/home.html @@ -165,8 +165,9 @@ {% endif %} {% if v %} -
{{v.strid}}
- +
{{request.host}}{{v.id}}
+
{{PUSHER_ID}}
+ {% endif %} {% endblock %} \ No newline at end of file