forked from rDrama/rDrama
1
0
Fork 0

fdMerge branch 'frost' of https://github.com/Aevann1/Drama into frost

master
Aevann1 2022-05-18 19:29:15 +00:00
commit e9e4a219f9
22 changed files with 59 additions and 41 deletions

2
.gitignore vendored
View File

@ -1,6 +1,6 @@
image.*
video.mp4
video.webm
unsanitized.mp4
cache/
__pycache__/
.idea/

View File

@ -670,7 +670,7 @@ if SITE_NAME == 'PCM':
AWARDS2 = deepcopy(AWARDS)
for k, val in AWARDS.items():
if val['description'] == '???' and not (k == 'ghost' and SITE_NAME == 'PCM'): AWARDS2.pop(k)
if SITE == 'pcmemes.net' and k in ('ban','pizzashill','marsey','bird','grass','chud'): AWARDS2.pop(k)
if SITE == 'pcmemes.net' and k in ('ban','pizzashill','marsey','bird','grass','chud','unblockable'): AWARDS2.pop(k)
AWARDS3 = {}

View File

@ -40,9 +40,10 @@ def allowed_attributes(tag, name, value):
else: return False
if name == 'loading' and value == 'lazy': return True
if name == 'referrpolicy' and value == 'no-referrer': return True
if name == 'data-bs-toggle' and value == 'tooltip': return True
if name in ['alt','title','g','b']: return True
if name in ['g','b'] and not value: return True
if name in ['alt','title']: return True
if name == 'referrpolicy' and value == 'no-referrer': return True
return False
if tag == 'lite-youtube':
@ -323,9 +324,11 @@ def sanitize(sanitized, alert=False, comment=False, edit=False):
def allowed_attributes_emojis(tag, name, value):
if tag == 'img':
if name == 'src' and value.startswith('/'): return True
if name == 'loading' and value == 'lazy': return True
if name == 'data-bs-toggle' and value == 'tooltip': return True
if name in ['src','alt','title','g']: return True
if name == 'g' and not value: return True
if name in ['alt','title']: return True
if tag == 'span':
if name == 'data-bs-toggle' and value == 'tooltip': return True

View File

@ -311,7 +311,8 @@ def api_comment(v):
return {"error": str(e)}, 400
body += f"\n\n![]({image})"
elif file.content_type.startswith('video/'):
file.save("video.mp4")
file.save("unsanitized.mp4")
os.system(f'ffmpeg -y -loglevel warning -i unsanitized.mp4 -map_metadata -1 -c:v copy -c:a copy video.mp4')
with open("video.mp4", 'rb') as f:
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
@ -767,7 +768,8 @@ def edit_comment(cid, v):
url = process_image(v.patron, name)
body += f"\n\n![]({url})"
elif file.content_type.startswith('video/'):
file.save("video.mp4")
file.save("unsanitized.mp4")
os.system(f'ffmpeg -y -loglevel warning -i unsanitized.mp4 -map_metadata -1 -c:v copy -c:a copy video.mp4')
with open("video.mp4", 'rb') as f:
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}

View File

@ -18,7 +18,7 @@ from os import path
import requests
from shutil import copyfile
from sys import stdout
import os
if SITE_NAME == 'PCM': snappyquotes = []
else: snappyquotes = [f':#{x}:' for x in marseys_const2]
@ -464,7 +464,8 @@ def edit_post(pid, v):
url = process_image(v.patron, name)
body += f"\n\n![]({url})"
elif file.content_type.startswith('video/'):
file.save("video.mp4")
file.save("unsanitized.mp4")
os.system(f'ffmpeg -y -loglevel warning -i unsanitized.mp4 -map_metadata -1 -c:v copy -c:a copy video.mp4')
with open("video.mp4", 'rb') as f:
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
@ -1077,7 +1078,8 @@ def submit_post(v, sub=None):
file.save(name)
body += f"\n\n![]({process_image(v.patron, name)})"
elif file.content_type.startswith('video/'):
file.save("video.mp4")
file.save("unsanitized.mp4")
os.system(f'ffmpeg -y -loglevel warning -i unsanitized.mp4 -map_metadata -1 -c:v copy -c:a copy video.mp4')
with open("video.mp4", 'rb') as f:
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
@ -1182,7 +1184,8 @@ def submit_post(v, sub=None):
copyfile(name, name2)
post.thumburl = process_image(v.patron, name2, resize=100)
elif file.content_type.startswith('video/'):
file.save("video.mp4")
file.save("unsanitized.mp4")
os.system(f'ffmpeg -y -loglevel warning -i unsanitized.mp4 -map_metadata -1 -c:v copy -c:a copy video.mp4')
with open("video.mp4", 'rb') as f:
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}

View File

@ -217,7 +217,8 @@ def settings_profile_post(v):
url = process_image(v.patron, name)
bio += f"\n\n![]({url})"
elif file.content_type.startswith('video/'):
file.save("video.mp4")
file.save("unsanitized.mp4")
os.system(f'ffmpeg -y -loglevel warning -i unsanitized.mp4 -map_metadata -1 -c:v copy -c:a copy video.mp4')
with open("video.mp4", 'rb') as f:
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}

View File

@ -4,7 +4,7 @@ from files.helpers.alerts import *
from files.helpers.const import *
from files.classes.award import AWARDS
from sqlalchemy import func
from os import path
import os
import calendar
import matplotlib.pyplot as plt
from files.classes.mod_logs import ACTIONTYPES, ACTIONTYPES2
@ -404,7 +404,8 @@ def submit_contact(v):
url = process_image(v.patron, name)
body_html += f'<img data-bs-target="#expandImageModal" data-bs-toggle="modal" onclick="expandDesktopImage(this.src)" class="img" src="{url}" loading="lazy">'
elif file.content_type.startswith('video/'):
file.save("video.mp4")
file.save("unsanitized.mp4")
os.system(f'ffmpeg -y -loglevel warning -i unsanitized.mp4 -map_metadata -1 -c:v copy -c:a copy video.mp4')
with open("video.mp4", 'rb') as f:
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}

View File

@ -13,6 +13,7 @@ from pusher_push_notifications import PushNotifications
from collections import Counter
import gevent
from sys import stdout
import os
if PUSHER_ID != 'blahblahblah':
beams_client = PushNotifications(instance_id=PUSHER_ID, secret_key=PUSHER_KEY)
@ -700,7 +701,8 @@ def messagereply(v):
url = process_image(v.patron, name)
body_html += f'<img data-bs-target="#expandImageModal" data-bs-toggle="modal" onclick="expandDesktopImage(this.src)" class="img" src="{url}" loading="lazy">'
elif file.content_type.startswith('video/'):
file.save("video.mp4")
file.save("unsanitized.mp4")
os.system(f'ffmpeg -y -loglevel warning -i unsanitized.mp4 -map_metadata -1 -c:v copy -c:a copy video.mp4')
with open("video.mp4", 'rb') as f:
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
except requests.exceptions.ConnectionError: return {"error": "Video upload timed out, please try again!"}

View File

@ -15,7 +15,7 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=266">
<link rel="stylesheet" href="/assets/css/main.css?v=267">
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=57">
{% if v.agendaposter %}
<style>

View File

@ -14,7 +14,7 @@
<title>Chat</title>
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=266">
<link rel="stylesheet" href="/assets/css/main.css?v=267">
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=57">
{% if v.css %}
<link rel="stylesheet" href="/@{{v.username}}/css">

View File

@ -846,7 +846,7 @@
{% if v %}
<script src="/assets/js/marked.js?v=253"></script>
<script src="/assets/js/comments_v.js?v=268"></script>
<script src="/assets/js/comments_v.js?v=269"></script>
{% endif %}
<script src="/assets/js/clipboard.js?v=250"></script>
@ -922,4 +922,4 @@
<div id="viewmore-{{offset}}"><button id="viewbtn" class="btn btn-primary" onclick="viewmore({{pid}},'{{sort}}',{{offset}},{{ids}})">VIEW MORE COMMENTS</a></div>
{% endif %}
</body>
</body>

View File

@ -8,7 +8,7 @@
<script src="/assets/js/shortcut handler.js?v=1"></script>
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=266">
<link rel="stylesheet" href="/assets/css/main.css?v=267">
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=57">
{% if v.agendaposter %}
<style>
@ -33,7 +33,7 @@
{% endif %}
{% else %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=266">
<link rel="stylesheet" href="/assets/css/main.css?v=267">
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=57">
{% endif %}

View File

@ -6,7 +6,7 @@
{% block content %}
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=266">
<link rel="stylesheet" href="/assets/css/main.css?v=267">
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=57">
{% if v.agendaposter %}
<style>
@ -31,7 +31,7 @@
{% endif %}
{% else %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=266">
<link rel="stylesheet" href="/assets/css/main.css?v=267">
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=57">
{% endif %}

View File

@ -18,7 +18,7 @@
{% endblock %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=266">
<link rel="stylesheet" href="/assets/css/main.css?v=267">
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=57">
</head>

View File

@ -14,7 +14,7 @@
<title>2-Step Login - {{SITE_NAME}}</title>
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=266">
<link rel="stylesheet" href="/assets/css/main.css?v=267">
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=57">
</head>

View File

@ -34,7 +34,7 @@
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=266">
<link rel="stylesheet" href="/assets/css/main.css?v=267">
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=57">
{% if v.agendaposter %}
<style>

View File

@ -39,11 +39,11 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=266">
<link rel="stylesheet" href="/assets/css/main.css?v=267">
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=57">
{% else %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=266">
<link rel="stylesheet" href="/assets/css/main.css?v=267">
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=57">
{% endif %}
</head>

View File

@ -31,7 +31,7 @@
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}Sign up - {{SITE_NAME}}{% endif %}</title>
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=266">
<link rel="stylesheet" href="/assets/css/main.css?v=267">
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=57">
</head>

View File

@ -32,7 +32,7 @@
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %}</title>
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=266">
<link rel="stylesheet" href="/assets/css/main.css?v=267">
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=57">
</head>

View File

@ -57,6 +57,12 @@
</script>
{% endif %}
{% if SITE_NAME == 'PCM' %}
{% set wholesome = '/assets/images/wholesome.webp' %}
{% else %}
{% set wholesome = '/e/marseywholesome.webp' %}
{% endif %}
{% if g.inferior_browser %}
{% if p.award_count("wholesome") %}
<style>
@ -93,7 +99,7 @@
}
</style>
<div class="seal seal1" height="100%" width="100%">
<img alt=":#marseywholesome:" class="sealimg" src="/e/marseywholesome.webp">
<img alt=":#marseywholesome:" class="sealimg" src="{{wholesome}}">
</div>
{% if p.award_count("wholesome") > 1 %}
@ -104,7 +110,7 @@
}
</style>
<div class="seal seal2" height="100%" width="100%">
<img alt=":#marseywholesome:" class="sealimg" src="/e/marseywholesome.webp">
<img alt=":#marseywholesome:" class="sealimg" src="{{wholesome}}">
</div>
{% endif %}
@ -116,7 +122,7 @@
}
</style>
<div class="seal seal3" height="100%" width="100%">
<img alt=":#marseywholesome:" class="sealimg" src="/e/marseywholesome.webp">
<img alt=":#marseywholesome:" class="sealimg" src="{{wholesome}}">
</div>
{% endif %}
@ -128,7 +134,7 @@
}
</style>
<div class="seal seal4" height="100%" width="100%">
<img alt=":#marseywholesome:" class="sealimg" src="/e/marseywholesome.webp">
<img alt=":#marseywholesome:" class="sealimg" src="{{wholesome}}">
</div>
{% endif %}
{% endif %}
@ -231,7 +237,7 @@
<div class="seal" height="100%" width="100%">
<marquee class="seal" scrollamount=10 behavior="alternate" direction="up" height="100%" width="100%">
<marquee direction="right" scrollamount=10 behavior="alternate" height="100%" width="100%">
<img alt=":#marseywholesome:" class="sealimg" src="/e/marseywholesome.webp">
<img alt=":#marseywholesome:" class="sealimg" src="{{wholesome}}">
</marquee>
</marquee>
</div>
@ -239,7 +245,7 @@
{% if p.award_count("wholesome") > 1 %}
<marquee class="seal" scrollamount=10 behavior="alternate" direction="down" height="100%">
<marquee direction="right" scrollamount=10 behavior="alternate" width="100%">
<img alt=":#marseywholesome:" class="sealimg" src="/e/marseywholesome.webp">
<img alt=":#marseywholesome:" class="sealimg" src="{{wholesome}}">
</marquee>
</marquee>
{% endif %}
@ -247,7 +253,7 @@
{% if p.award_count("wholesome") > 2 %}
<marquee class="seal" scrollamount=10 behavior="alternate" direction="up" height="100%">
<marquee direction="left" scrollamount=10 behavior="alternate" width="100%">
<img alt=":#marseywholesome:" class="sealimg" src="/e/marseywholesome.webp">
<img alt=":#marseywholesome:" class="sealimg" src="{{wholesome}}">
</marquee>
</marquee>
{% endif %}
@ -255,7 +261,7 @@
{% if p.award_count("wholesome") > 3 %}
<marquee class="seal" scrollamount=10 behavior="alternate" direction="down" height="100%">
<marquee direction="left" scrollamount=10 behavior="alternate" width="100%">
<img alt=":#marseywholesome:" class="sealimg" src="/e/marseywholesome.webp">
<img alt=":#marseywholesome:" class="sealimg" src="{{wholesome}}">
</marquee>
</marquee>
{% endif %}

View File

@ -26,7 +26,7 @@
{% block stylesheets %}
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=266">
<link rel="stylesheet" href="/assets/css/main.css?v=267">
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=49">
{% if v.agendaposter %}
<style>
@ -51,7 +51,7 @@
{% endif %}
{% else %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=266">
<link rel="stylesheet" href="/assets/css/main.css?v=267">
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=49">
{% endif %}
{% endblock %}

View File

@ -1,7 +1,7 @@
[![Build status](https://img.shields.io/github/workflow/status/TheMotte/rDrama/run_tests.py/frost)](https://github.com/Aevann1/rDrama/actions?query=workflow%3Arun_tests.py+branch%3Afrost)
This code runs https://rdrama.net and https://pcmemes.net
This code runs https://rdrama.net, https://pcmemes.net, https://cringetopia.org, and https://watchpeopledie.co
# Installation (Windows/Linux/MacOS)