merge chat.html and orgy.html

pull/211/head
Aevann 2023-10-02 07:04:41 +03:00
parent 2a036e9448
commit 094cbf1c41
7 changed files with 128 additions and 166 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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')

View File

@ -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,
}

View File

@ -9,12 +9,34 @@
{% include "modals/emoji.html" %}
{% include "util/macros.html" %}
{% set vlink = '<a href="/id/' ~ v.id ~ '"' %}
<div class="container pb-4 pb-md-2">
<div class="row justify-content-around" id="main-content-row">
<div class="col h-100 {% block customPadding %}custom-gutters{% endblock %}" id="main-content-col">
<div class="top-container">
{% set orgy = get_orgy(v) %}
{{macros.chat_users_online()}}
{% if orgy %}
<div id="orgy-col" class="col text-left px-md-2">
<h3 id="orgy-title" class="mt-0 mb-2">{{orgy.title}}</h1>
<div>
<p id="orgy-file-container" class="resizable">
{% if orgy.type == 'youtube' %}
<iframe style="border: none" sandbox="allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox" title="Play" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen src="https://www.youtube-nocookie.com/embed/{{orgy.data}}?autoplay=1&modestbranding=1&autoplay=1"></iframe>
{% elif orgy.type == 'rumble' %}
<iframe src="{{orgy.data}}" frameborder="0" allowfullscreen></iframe>
{% elif orgy.type == 'twitch' %}
<iframe src="https://player.twitch.tv/?channel={{orgy.data}}&parent={{SITE}}" frameborder="0" allowfullscreen></iframe>
{% elif orgy.type == 'file' %}
<meta name="referrer" content="strict-origin-when-cross-origin">
<video id="orgy-file" data-created_utc="{{orgy.real_created_utc}}" controls preload="none" src="{{orgy.data}}">
<track label="English" kind="subtitles" srclang="en" src="/assets/subtitles.vtt?x={{subtitles_hash()}}" default>
</video>
<video id="break-file" class="d-none" controls preload="none" src="/assets/break.mp4" data-run="0"></video>
<script defer src="{{'js/orgy_file.js' | asset}}"></script>
{% endif %}
</p>
</div>
</div>
{% endif %}
<div class="chat-window-item pl-1 pr-2">
<div id="chat-group-template" class="d-none">
{{macros.chat_group_template()}}
</div>
@ -24,6 +46,7 @@
{{macros.chat_line_template()}}
</div>
{{macros.chat_users_online()}}
{{macros.chat_window(vlink)}}
</div>

View File

@ -1,59 +0,0 @@
{%- extends 'root.html' -%}
{% block pagetitle -%}Chat{%- endblock %}
{% block pagetype %}chat{% endblock %}
{% block body_attributes %}class="has_header"{% endblock %}
{% block body %}
<link rel="stylesheet" href="{{'css/chat.css' | asset}}">
<link rel="stylesheet" href="{{'css/orgy.css' | asset}}">
{% include "header.html" %}
{% include "modals/expanded_image.html" %}
{% include "modals/emoji.html" %}
{% include "util/macros.html" %}
{% set vlink = '<a href="/id/' ~ v.id ~ '"' %}
<div class="orgy-top-container">
<div id="orgy-col" class="col text-left px-md-2">
<h3 id="orgy-title" class="mt-0 mb-2">{{orgy.title}}</h1>
<div>
<p id="orgy-file-container" class="resizable">
{% if orgy.type == 'youtube' %}
<iframe style="border: none" sandbox="allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox" title="Play" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen src="https://www.youtube-nocookie.com/embed/{{orgy.data}}?autoplay=1&modestbranding=1&autoplay=1"></iframe>
{% elif orgy.type == 'rumble' %}
<iframe src="{{orgy.data}}" frameborder="0" allowfullscreen></iframe>
{% elif orgy.type == 'twitch' %}
<iframe src="https://player.twitch.tv/?channel={{orgy.data}}&parent={{SITE}}" frameborder="0" allowfullscreen></iframe>
{% elif orgy.type == 'file' %}
<meta name="referrer" content="strict-origin-when-cross-origin">
<video id="orgy-file" data-created_utc="{{orgy.real_created_utc}}" controls preload="none" src="{{orgy.data}}">
<track label="English" kind="subtitles" srclang="en" src="/assets/subtitles.vtt?x={{subtitles_hash}}" default>
</video>
<video id="break-file" class="d-none" controls preload="none" src="/assets/break.mp4" data-run="0"></video>
<script defer src="{{'js/orgy_file.js' | asset}}"></script>
{% endif %}
</p>
</div>
</div>
<div class="orgy-chat-window-item pl-1 pr-2">
<div id="chat-group-template" class="d-none">
{{macros.chat_group_template()}}
</div>
</div>
<div id="chat-line-template" class="d-none">
{{macros.chat_line_template()}}
</div>
{{macros.chat_users_online()}}
{{macros.chat_window(vlink)}}
</div>
</div>
<input id="vid" hidden value="{{v.id}}">
<input id="slurreplacer" hidden value="{{v.slurreplacer}}">
<input id="admin_level" hidden value="{{v.admin_level}}">
<input id="blocked_user_ids" hidden value="{{(v.userblocks|string)[1:-1]}}">
<script defer src="{{'js/vendor/socketio.js' | asset}}"></script>
<script defer src="{{'js/flash.js' | asset}}"></script>
<script defer src="{{'js/vendor/lozad.js' | asset}}"></script>
<script defer src="{{'js/vendor/lite-youtube.js' | asset}}"></script>
<script defer src="{{'js/chat.js' | asset}}"></script>
{% endblock %}