From 60eaa5d2825fd88123b7ab3442f71fa4c0c0e2dc Mon Sep 17 00:00:00 2001 From: Aevann Date: Wed, 16 Aug 2023 23:12:37 +0300 Subject: [PATCH] remove /old_chat (needless bloat) --- files/assets/js/core.js | 4 +--- files/assets/js/emoji_modal.js | 2 +- files/routes/chat.py | 12 ------------ files/templates/header.html | 2 +- files/templates/util/html_head.html | 2 +- nginx.conf | 3 --- 6 files changed, 4 insertions(+), 21 deletions(-) diff --git a/files/assets/js/core.js b/files/assets/js/core.js index 44730f1fb..532ac7748 100644 --- a/files/assets/js/core.js +++ b/files/assets/js/core.js @@ -1,7 +1,5 @@ const SITE_FULL_IMAGES = document.getElementById('SITE_FULL_IMAGES').value -const is_chat = (location.pathname == '/chat' || location.pathname == '/old_chat') - function getMessageFromJsonData(success, json) { let message = success ? "Success!" : "Error, please try again later"; let key = success ? "message" : "error"; @@ -508,7 +506,7 @@ function handle_files(input, newfiles) { return } - if (!is_chat) { + if (location.pathname != '/chat') { for (const file of newfiles) { insertText(ta, `[${file.name}]`); } diff --git a/files/assets/js/emoji_modal.js b/files/assets/js/emoji_modal.js index 18fb16592..4af6e66dc 100644 --- a/files/assets/js/emoji_modal.js +++ b/files/assets/js/emoji_modal.js @@ -420,7 +420,7 @@ function populate_speed_emoji_modal(results, textbox) close_inline_speed_emoji_modal() textbox.value = textbox.value.replace(new RegExp(current_word+"(?=\\s|$)", "gi"), `:${name}: `) textbox.focus() - if (!is_chat){ + if (location.pathname != '/chat'){ markdown(textbox) } }); diff --git a/files/routes/chat.py b/files/routes/chat.py index e8c31e5c9..ceaf33821 100644 --- a/files/routes/chat.py +++ b/files/routes/chat.py @@ -66,18 +66,6 @@ def chat(v): else: return render_template("chat.html", v=v, messages=displayed_messages) -@app.get("/old_chat") -@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400) -@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID) -@is_not_permabanned -def old_chat(v): - if not v.allowed_in_chat: - abort(403, CHAT_ERROR_MESSAGE) - - displayed_messages = {k: val for k, val in messages.items() if val["user_id"] not in v.userblocks} - - return render_template("chat.html", v=v, messages=displayed_messages) - @socketio.on('speak') @is_not_banned_socketio def speak(data, v): diff --git a/files/templates/header.html b/files/templates/header.html index 2852d0b34..3519935cd 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -391,7 +391,7 @@ {% endif %}
  • - {% if request.path.endswith("/chat") or request.path.endswith("/old_chat") %} + {% if request.path.endswith("/chat") %}
    Users Online




    diff --git a/files/templates/util/html_head.html b/files/templates/util/html_head.html index 0eb33c7c4..c55d10cf8 100644 --- a/files/templates/util/html_head.html +++ b/files/templates/util/html_head.html @@ -137,7 +137,7 @@ {% endif %} {% endif %} - {% if request.path.endswith('/chat') or request.path.endswith('/old_chat') %} + {% if request.path.endswith('/chat') %} {% endif %} diff --git a/nginx.conf b/nginx.conf index 8d63d460d..e950e522c 100644 --- a/nginx.conf +++ b/nginx.conf @@ -20,9 +20,6 @@ server { location /chat { proxy_pass http://localhost:5001/chat; } - location /old_chat { - proxy_pass http://localhost:5001/old_chat; - } location =/offline.html { alias /d/files/templates/errors/offline.html; }