From 094cbf1c415c58ad2f44c8c167c78e74b4feb5c3 Mon Sep 17 00:00:00 2001 From: Aevann Date: Mon, 2 Oct 2023 07:04:41 +0300 Subject: [PATCH] merge chat.html and orgy.html --- files/assets/css/chat.css | 91 ++++++++++++++++++++++++++++++++ files/assets/css/orgy.css | 90 ------------------------------- files/assets/css/transparent.css | 2 +- files/routes/chat.py | 11 ---- files/routes/jinja2.py | 10 +++- files/templates/chat.html | 31 +++++++++-- files/templates/orgy.html | 59 --------------------- 7 files changed, 128 insertions(+), 166 deletions(-) delete mode 100644 files/assets/css/orgy.css delete mode 100644 files/templates/orgy.html diff --git a/files/assets/css/chat.css b/files/assets/css/chat.css index d95658755..46307859c 100644 --- a/files/assets/css/chat.css +++ b/files/assets/css/chat.css @@ -184,3 +184,94 @@ h1, h2, h3, h4, h5, h6 { margin-bottom: 0.3rem; } } + + +@media (min-width: 768px) { + lite-youtube { /* fix overflow */ + max-width: 25vw !important; + } +} + +.top-container { + display: flex; + justify-content: space-around; +} + +@media (max-width: 768px) { + .top-container { + flex-flow: column wrap; + } + #chat-window { + max-height: 34vh !important; + } +} + +.chat-window-item { + flex-grow: 2; +} + +#orgy-file-container { + width: 65vw; + max-height: 80vh !important; + max-width: 100vw !important; +} + +#orgy-file-container > * { + max-height: 80vh !important; + margin: 0 !important; + height: 98% !important; + width: 98% !important; +} + +@media (max-width: 768px) { + #orgy-file-container { + width: 100% !important; + } + #orgy-title { + display: none; + } + #orgy-col { + padding: 0px; + } + #orgy-file-container > * { + height: 100% !important; + width: 100% !important; + } + .chat-window-item { + max-width: 100% + } +} + + +#cursormarsey, #cursormarsey-heart { + display: none; +} + +body > .container { + padding: 0 !important; + margin: 0 !important; + margin-right: 0 !important; +} + +*:not(#orgy-file-container) { + resize: none !important; +} + +#orgy-file-container > :not(video) { + height: 90% !important; + width: 95% !important; + max-width: 95% !important; + overflow-y: clip; +} + +@media (max-width: 768px) { + #orgy-file-container > :not(video) { + height: 100% !important; + width: 100% !important; + max-width: 100% !important; + } +} + +#orgy-file-container > iframe { + aspect-ratio: 16/9; +} diff --git a/files/assets/css/orgy.css b/files/assets/css/orgy.css deleted file mode 100644 index c024dc5d6..000000000 --- a/files/assets/css/orgy.css +++ /dev/null @@ -1,90 +0,0 @@ - -@media (min-width: 768px) { - lite-youtube { /* fix overflow */ - max-width: 25vw !important; - } -} - -.orgy-top-container { - display: flex; - justify-content: space-around; -} - -@media (max-width: 768px) { - .orgy-top-container { - flex-flow: column wrap; - } - #chat-window { - max-height: 34vh !important; - } -} - -.orgy-chat-window-item { - flex-grow: 2; -} - -#orgy-file-container { - width: 65vw; - max-height: 80vh !important; - max-width: 100vw !important; -} - -#orgy-file-container > * { - max-height: 80vh !important; - margin: 0 !important; - height: 98% !important; - width: 98% !important; -} - -@media (max-width: 768px) { - #orgy-file-container { - width: 100% !important; - } - #orgy-title { - display: none; - } - #orgy-col { - padding: 0px; - } - #orgy-file-container > * { - height: 100% !important; - width: 100% !important; - } - .orgy-chat-window-item { - max-width: 100% - } -} - - -#cursormarsey, #cursormarsey-heart { - display: none; -} - -body > .container { - padding: 0 !important; - margin: 0 !important; - margin-right: 0 !important; -} - -*:not(#orgy-file-container) { - resize: none !important; -} - -#orgy-file-container > :not(video) { - height: 90% !important; - width: 95% !important; - max-width: 95% !important; - overflow-y: clip; -} - -@media (max-width: 768px) { - #orgy-file-container > :not(video) { - height: 100% !important; - width: 100% !important; - max-width: 100% !important; - } -} - -#orgy-file-container > iframe { - aspect-ratio: 16/9; -} diff --git a/files/assets/css/transparent.css b/files/assets/css/transparent.css index 9b51a6145..75b3968ad 100644 --- a/files/assets/css/transparent.css +++ b/files/assets/css/transparent.css @@ -6,7 +6,7 @@ --gray-900: transparent; } -.container, #userpage > div.container-fluid, #root > div.App, .orgy-chat-window-item { +.container, #userpage > div.container-fluid, #root > div.App, .chat-window-item { background: rgba(var(--background), 0.9) !important; } diff --git a/files/routes/chat.py b/files/routes/chat.py index 71ad6d074..4fa7fdc27 100644 --- a/files/routes/chat.py +++ b/files/routes/chat.py @@ -1,7 +1,6 @@ import atexit import time import uuid -from hashlib import md5 from flask_socketio import SocketIO, emit, join_room, leave_room from flask import request @@ -87,16 +86,6 @@ def chat(v): displayed_messages = {k: val for k, val in messages[f"{SITE_FULL}/chat"].items() if val["user_id"] not in v.userblocks} - orgy = get_orgy(v) - if orgy: - m = md5() - with open('files/assets/subtitles.vtt', "rb") as f: - data = f.read() - m.update(data) - subtitles_hash = m.hexdigest() - - return render_template("orgy.html", v=v, messages=displayed_messages, orgy=orgy, subtitles_hash=subtitles_hash) - return render_template("chat.html", v=v, messages=displayed_messages) @socketio.on('speak') diff --git a/files/routes/jinja2.py b/files/routes/jinja2.py index ba0d1be3b..08cdf6dde 100644 --- a/files/routes/jinja2.py +++ b/files/routes/jinja2.py @@ -2,6 +2,7 @@ import time import math from os import environ, listdir, path +from hashlib import md5 from flask import g, session, has_request_context, request from jinja2 import pass_context @@ -117,6 +118,13 @@ def bar_position(): return [int((vaxxed * 100) / total), int((zombie * 100) / total), vaxxed, zombie] +def subtitles_hash(): + m = md5() + with open('files/assets/subtitles.vtt', "rb") as f: + data = f.read() + m.update(data) + return m.hexdigest() + @app.context_processor def inject_constants(): return {"environ":environ, "SITE":SITE, "SITE_NAME":SITE_NAME, "SITE_FULL":SITE_FULL, @@ -146,5 +154,5 @@ def inject_constants(): "CHUD_PHRASES":CHUD_PHRASES, "hasattr":hasattr, "calc_users":calc_users, "HOLE_INACTIVITY_DELETION":HOLE_INACTIVITY_DELETION, "LIGHT_THEMES":LIGHT_THEMES, "MAX_IMAGE_AUDIO_SIZE_MB":MAX_IMAGE_AUDIO_SIZE_MB, "MAX_IMAGE_AUDIO_SIZE_MB_PATRON":MAX_IMAGE_AUDIO_SIZE_MB_PATRON, "MAX_VIDEO_SIZE_MB":MAX_VIDEO_SIZE_MB, "MAX_VIDEO_SIZE_MB_PATRON":MAX_VIDEO_SIZE_MB_PATRON, - "CURSORMARSEY_DEFAULT":CURSORMARSEY_DEFAULT, "SNAPPY_ID":SNAPPY_ID, "get_orgy":get_orgy, "TRUESCORE_CC_CHAT_MINIMUM":TRUESCORE_CC_CHAT_MINIMUM, "bar_position":bar_position, + "CURSORMARSEY_DEFAULT":CURSORMARSEY_DEFAULT, "SNAPPY_ID":SNAPPY_ID, "get_orgy":get_orgy, "TRUESCORE_CC_CHAT_MINIMUM":TRUESCORE_CC_CHAT_MINIMUM, "bar_position":bar_position, "subtitles_hash":subtitles_hash, } diff --git a/files/templates/chat.html b/files/templates/chat.html index fa5e18258..cc98e981e 100644 --- a/files/templates/chat.html +++ b/files/templates/chat.html @@ -9,12 +9,34 @@ {% include "modals/emoji.html" %} {% include "util/macros.html" %} {% set vlink = ' -
-
+
+ {% set orgy = get_orgy(v) %} - {{macros.chat_users_online()}} + {% if orgy %} +
+

{{orgy.title}}

+
+

+ {% if orgy.type == 'youtube' %} + + {% elif orgy.type == 'rumble' %} + + {% elif orgy.type == 'twitch' %} + + {% elif orgy.type == 'file' %} + + + + + {% endif %} +

+
+
+ {% endif %} +
{{macros.chat_group_template()}}
@@ -24,6 +46,7 @@ {{macros.chat_line_template()}}
+ {{macros.chat_users_online()}} {{macros.chat_window(vlink)}}
diff --git a/files/templates/orgy.html b/files/templates/orgy.html deleted file mode 100644 index 2fb0d492b..000000000 --- a/files/templates/orgy.html +++ /dev/null @@ -1,59 +0,0 @@ -{%- extends 'root.html' -%} -{% block pagetitle -%}Chat{%- endblock %} -{% block pagetype %}chat{% endblock %} -{% block body_attributes %}class="has_header"{% endblock %} -{% block body %} - - - {% include "header.html" %} - {% include "modals/expanded_image.html" %} - {% include "modals/emoji.html" %} - {% include "util/macros.html" %} - {% set vlink = '
-
-

{{orgy.title}}

-
-

- {% if orgy.type == 'youtube' %} - - {% elif orgy.type == 'rumble' %} - - {% elif orgy.type == 'twitch' %} - - {% elif orgy.type == 'file' %} - - - - - {% endif %} -

-
-
- -
-
- {{macros.chat_group_template()}} -
-
- -
- {{macros.chat_line_template()}} -
- {{macros.chat_users_online()}} - {{macros.chat_window(vlink)}} -
-
- - - - - - - - - - -{% endblock %}