forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2021-07-26 20:57:00 +02:00
parent 81ff918c08
commit b9a4710aa6
3 changed files with 4 additions and 5 deletions

View File

@ -189,7 +189,7 @@ def sanitize(text, linkgen=False, flair=False):
if flair: emojisize = 20 if flair: emojisize = 20
else: emojisize = 30 else: emojisize = 30
for i in re.finditer(':(.{1,30}?):', sanitized): for i in re.finditer(':(.{1,30}?):', sanitized):
if path.isfile(f'/d/drama/assets/images/emojis/{i.group(1)}.gif'): if path.isfile(f'./drama/assets/images/emojis/{i.group(1)}.gif'):
sanitized = sanitized.replace(f':{i.group(1)}:', f'<img data-toggle="tooltip" title="{i.group(1)}" delay="0" height={emojisize} src="/assets/images/emojis/{i.group(1)}.gif"<span>') sanitized = sanitized.replace(f':{i.group(1)}:', f'<img data-toggle="tooltip" title="{i.group(1)}" delay="0" height={emojisize} src="/assets/images/emojis/{i.group(1)}.gif"<span>')
sanitized = sanitized.replace("https://www.", "https://").replace("https://youtu.be/", "https://youtube.com/embed/").replace("https://music.youtube.com/watch?v=", "https://youtube.com/embed/").replace("/watch?v=", "/embed/").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/embed/") sanitized = sanitized.replace("https://www.", "https://").replace("https://youtu.be/", "https://youtube.com/embed/").replace("https://music.youtube.com/watch?v=", "https://youtube.com/embed/").replace("/watch?v=", "/embed/").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/embed/")

View File

@ -2,7 +2,7 @@ import time
import calendar import calendar
from sqlalchemy.orm import lazyload from sqlalchemy.orm import lazyload
import imagehash import imagehash
from os import remove, getcwd from os import remove
from PIL import Image as IMAGE from PIL import Image as IMAGE
from drama.helpers.wrappers import * from drama.helpers.wrappers import *
@ -119,7 +119,6 @@ def flagged_comments(v):
@app.route("/admin", methods=["GET"]) @app.route("/admin", methods=["GET"])
@admin_level_required(3) @admin_level_required(3)
def admin_home(v): def admin_home(v):
print(getcwd())
with open('./disablesignups', 'r') as f: with open('./disablesignups', 'r') as f:
x = f.read() x = f.read()
return render_template("admin/admin_home.html", v=v, x=x) return render_template("admin/admin_home.html", v=v, x=x)

View File

@ -29,9 +29,9 @@
{% endfilter %} {% endfilter %}
{#<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="disablesignups" name="disablesignups" {% if x == "yes" %}checked{% endif %} onchange="post('/admin/disablesignups');"> <input type="checkbox" class="custom-control-input" id="disablesignups" name="disablesignups" {% if x == "yes" %}checked{% endif %} onchange="post('/admin/disablesignups');">
<label class="custom-control-label" for="disablesignups">Disable signups</label> <label class="custom-control-label" for="disablesignups">Disable signups</label>
</div>#} </div>
{% endblock %} {% endblock %}