From 13dfa370b175c0490d70793333034af7cf18117e Mon Sep 17 00:00:00 2001 From: TLSM Date: Fri, 8 Jul 2022 16:46:35 -0400 Subject: [PATCH 1/3] PCM: swap banner to Summer 2022 v2. --- files/templates/util/assetcache.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/templates/util/assetcache.html b/files/templates/util/assetcache.html index d61b79fadf..158f4f1a2b 100644 --- a/files/templates/util/assetcache.html +++ b/files/templates/util/assetcache.html @@ -35,7 +35,7 @@ set CACHE_VER = { set CACHE_VER_SITEIMG = { 'rDrama': 2000, 'FunOnly': 2000, - 'PCM': 2002, + 'PCM': 2003, 'Cringetopia': 2000, 'WPD': 2000, 'LGBDropTheT': 2010, From 3416ed76e4283c66b4c04336528a37635d27516a Mon Sep 17 00:00:00 2001 From: TLSM Date: Fri, 8 Jul 2022 20:46:44 -0400 Subject: [PATCH 2/3] Increase rate-limit on /del_report/. --- files/routes/reporting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/routes/reporting.py b/files/routes/reporting.py index a8560a37ab..c9ae7b1cd7 100644 --- a/files/routes/reporting.py +++ b/files/routes/reporting.py @@ -104,7 +104,7 @@ def api_flag_comment(cid, v): @app.post('/del_report/post//') -@limiter.limit("1/second;30/minute;200/hour;1000/day") +@limiter.limit("4/second;100/minute;300/hour;2000/day") @admin_level_required(PERMS['FLAGS_REMOVE']) def remove_report_post(v, pid, uid): @@ -131,7 +131,7 @@ def remove_report_post(v, pid, uid): @app.post('/del_report/comment//') -@limiter.limit("1/second;30/minute;200/hour;1000/day") +@limiter.limit("4/second;100/minute;300/hour;2000/day") @admin_level_required(PERMS['FLAGS_REMOVE']) def remove_report_comment(v, cid, uid): From 02e096e5af6c79e8a21fce3b4928037145e3bf56 Mon Sep 17 00:00:00 2001 From: TLSM Date: Sat, 9 Jul 2022 00:32:48 -0400 Subject: [PATCH 3/3] LGB: add custom emoji list. --- files/helpers/const.py | 8 ++++++++ files/routes/static.py | 35 +++++++++++++++++------------------ 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 352739a8e7..2ee72c36a1 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -152,6 +152,9 @@ PERMS = { # Minimum admin_level to perform action. 'FLAGS_REMOVE': 2, } +EMOJI_MARSEYS = True +EMOJI_SRCS = ['files/assets/emojis.json'] + PIN_ENABLED = True PIN_LIMIT = 3 POST_RATE_LIMIT = '1/second;2/minute;10/hour;50/day' @@ -266,6 +269,8 @@ elif SITE == 'pcmemes.net': elif SITE == 'cringetopia.org': HOLE_COST = 10000 + EMOJI_SRCS = ['files/assets/emojis.json', 'files/assets/emojis.cringetopia.json'] + GIFT_NOTIF_ID = 18 CARP_ID = 18 AEVANN_ID = 9 @@ -303,6 +308,9 @@ elif SITE == 'lgbdropthet.com': PERMS['HOLE_CREATE'] = 3 PERMS['FLAGS_VISIBLE_REPORTER'] = 2 + EMOJI_MARSEYS = False + EMOJI_SRCS = ['files/assets/emojis.lgbdropthet.json'] + AEVANN_ID = 10 SNAKES_ID = 9 diff --git a/files/routes/static.py b/files/routes/static.py index ec766e1374..aad6028edd 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -31,27 +31,26 @@ def marseys(v): @app.get("/marsey_list.json") @cache.memoize(timeout=600) def marsey_list(): + emojis = [] + # From database - emojis = [{ - "name": emoji.name, - "author": author if SITE_NAME == 'rDrama' or author == "anton-d" else None, - # yikes, I don't really like this DB schema. Next time be better - "tags": emoji.tags.split(" ") + [emoji.name[len("marsey"):] if emoji.name.startswith("marsey") else emoji.name], - "count": emoji.count, - "class": "Marsey" - } for emoji, author in g.db.query(Marsey, User.username).join(User).order_by(Marsey.count.desc())] + if EMOJI_MARSEYS: + emojis = [{ + "name": emoji.name, + "author": author if SITE_NAME == 'rDrama' or author == "anton-d" else None, + # yikes, I don't really like this DB schema. Next time be better + "tags": emoji.tags.split(" ") + [emoji.name[len("marsey"):] \ + if emoji.name.startswith("marsey") else emoji.name], + "count": emoji.count, + "class": "Marsey" + } for emoji, author in g.db.query(Marsey, User.username).join(User) \ + .order_by(Marsey.count.desc())] - # Stastic shit - shit = open("files/assets/emojis.json", "r", encoding="utf-8") - emojis = emojis + json.load(shit) - shit.close() + # Static shit + for src in EMOJI_SRCS: + with open(src, "r", encoding="utf-8") as f: + emojis = emojis + json.load(f) - if SITE_NAME == 'Cringetopia': - shit = open("files/assets/emojis.cringetopia.json", "r", encoding="utf-8") - emojis = emojis + json.load(shit) - shit.close() - - # return str(marseys).replace("'",'"') return jsonify(emojis) @app.get('/rules')