diff --git a/files/helpers/const.py b/files/helpers/const.py index 352739a8e..2ee72c36a 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 ec766e137..aad6028ed 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')