forked from rDrama/rDrama
fdMerge branch 'frost' of https://github.com/Aevann1/Drama into frost
commit
e18ddd27c2
|
@ -49,6 +49,10 @@ if SITE_NAME == 'Cringetopia':
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
SLURS = {
|
SLURS = {
|
||||||
|
"california": "commiefornia",
|
||||||
|
"hollywood": "hollyweird",
|
||||||
|
"tiananmen square": "tiananmen square didn't happen (but it should have)",
|
||||||
|
"dasha": "beautiful angelic perfect Dasha/future Mrs. Carp",
|
||||||
"retarded": "r-slurred",
|
"retarded": "r-slurred",
|
||||||
"retard": "r-slur",
|
"retard": "r-slur",
|
||||||
"gayfag": "gaystrag",
|
"gayfag": "gaystrag",
|
||||||
|
@ -777,6 +781,7 @@ slur_regex = re.compile(f"({single_words})(?![^<]*>)", flags=re.I|re.A)
|
||||||
slur_regex_upper = re.compile(f"({single_words.upper()})(?![^<]*>)", flags=re.A)
|
slur_regex_upper = re.compile(f"({single_words.upper()})(?![^<]*>)", flags=re.A)
|
||||||
torture_regex = re.compile('(^|\s)(i|me) ', flags=re.I|re.A)
|
torture_regex = re.compile('(^|\s)(i|me) ', flags=re.I|re.A)
|
||||||
torture_regex2 = re.compile("(^|\s)i'm ", flags=re.I|re.A)
|
torture_regex2 = re.compile("(^|\s)i'm ", flags=re.I|re.A)
|
||||||
|
torture_regex_exclude = re.compile('^\s*>', flags=re.A)
|
||||||
|
|
||||||
def sub_matcher(match):
|
def sub_matcher(match):
|
||||||
return SLURS[match.group(0).lower()]
|
return SLURS[match.group(0).lower()]
|
||||||
|
@ -791,11 +796,17 @@ def censor_slurs(body, logged_user):
|
||||||
return body
|
return body
|
||||||
|
|
||||||
def torture_ap(body, username):
|
def torture_ap(body, username):
|
||||||
for k, l in AJ_REPLACEMENTS.items():
|
lines = body.splitlines(keepends=True)
|
||||||
body = body.replace(k, l)
|
|
||||||
body = torture_regex.sub(rf'\1@{username} ', body)
|
for i in range(len(lines)):
|
||||||
body = torture_regex2.sub(rf'\1@{username} is ', body)
|
if torture_regex_exclude.match(lines[i]):
|
||||||
return body
|
continue
|
||||||
|
for k, l in AJ_REPLACEMENTS.items():
|
||||||
|
lines[i] = lines[i].replace(k, l)
|
||||||
|
lines[i] = torture_regex.sub(rf'\1@{username} ', lines[i])
|
||||||
|
lines[i] = torture_regex2.sub(rf'\1@{username} is ', lines[i])
|
||||||
|
|
||||||
|
return ''.join(lines)
|
||||||
|
|
||||||
YOUTUBE_KEY = environ.get("YOUTUBE_KEY", "").strip()
|
YOUTUBE_KEY = environ.get("YOUTUBE_KEY", "").strip()
|
||||||
|
|
||||||
|
@ -860,7 +871,8 @@ approved_embed_hosts = [
|
||||||
'deviantart.com',
|
'deviantart.com',
|
||||||
'deviantart.net',
|
'deviantart.net',
|
||||||
'googleapis.com',
|
'googleapis.com',
|
||||||
'bing.com'
|
'bing.com',
|
||||||
|
'typekit.net',
|
||||||
]
|
]
|
||||||
|
|
||||||
hosts = "|".join(approved_embed_hosts).replace('.','\.')
|
hosts = "|".join(approved_embed_hosts).replace('.','\.')
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import time
|
import time
|
||||||
|
import re
|
||||||
from os import remove
|
from os import remove
|
||||||
from PIL import Image as IMAGE
|
from PIL import Image as IMAGE
|
||||||
|
|
||||||
|
@ -520,8 +521,28 @@ def admin_home(v):
|
||||||
else: response = requests.get(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/settings/security_level', headers=CF_HEADERS, timeout=5).json()['result']['value']
|
else: response = requests.get(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/settings/security_level', headers=CF_HEADERS, timeout=5).json()['result']['value']
|
||||||
under_attack = response == 'under_attack'
|
under_attack = response == 'under_attack'
|
||||||
|
|
||||||
return render_template("admin/admin_home.html", v=v, under_attack=under_attack, site_settings=app.config['SETTINGS'])
|
gitref = admin_git_head()
|
||||||
|
|
||||||
|
return render_template("admin/admin_home.html", v=v,
|
||||||
|
under_attack=under_attack,
|
||||||
|
site_settings=app.config['SETTINGS'],
|
||||||
|
gitref=gitref)
|
||||||
|
|
||||||
|
def admin_git_head():
|
||||||
|
short_len = 12
|
||||||
|
# Note: doing zero sanitization. Git branch names are extremely permissive.
|
||||||
|
# However, they forbid '..', so I don't see an obvious dir traversal attack.
|
||||||
|
# Also, a malicious branch name would mean someone already owned the server
|
||||||
|
# or repo, so I think this isn't a weak link.
|
||||||
|
try:
|
||||||
|
with open('.git/HEAD') as head_f:
|
||||||
|
head_txt = head_f.read()
|
||||||
|
head_path = re.match('ref: (refs/.+)', head_txt).group(1)
|
||||||
|
with open('.git/' + head_path) as ref_f:
|
||||||
|
gitref = ref_f.read()[0:short_len]
|
||||||
|
except:
|
||||||
|
return '<unable to read>'
|
||||||
|
return gitref
|
||||||
|
|
||||||
@app.post("/admin/site_settings/<setting>")
|
@app.post("/admin/site_settings/<setting>")
|
||||||
@admin_level_required(3)
|
@admin_level_required(3)
|
||||||
|
|
|
@ -47,15 +47,31 @@ def marseys(v):
|
||||||
marseys = g.db.query(Marsey).order_by(Marsey.count.desc())
|
marseys = g.db.query(Marsey).order_by(Marsey.count.desc())
|
||||||
return render_template("marseys.html", v=v, marseys=marseys)
|
return render_template("marseys.html", v=v, marseys=marseys)
|
||||||
|
|
||||||
@app.get("/marsey_list")
|
@app.get("/marsey_list.json")
|
||||||
@cache.memoize(timeout=600, make_name=make_name)
|
@cache.memoize(timeout=600)
|
||||||
def marsey_list():
|
def marsey_list():
|
||||||
if SITE_NAME == 'rDrama':
|
# From database
|
||||||
marseys = [f"{x.name} : {y} {x.tags}" for x, y in g.db.query(Marsey, User.username).join(User, User.id==Marsey.author_id).order_by(Marsey.count.desc())]
|
emojis = [{
|
||||||
else:
|
"name": emoij.name,
|
||||||
marseys = [f"{x.name} : {x.tags}" for x in g.db.query(Marsey).order_by(Marsey.count.desc())]
|
"author": author if SITE_NAME == 'rDrama' else "rDrama's chads",
|
||||||
|
# yikes, I don't really like this DB schema. Next time be better
|
||||||
|
"tags": emoij.tags.split(" ") + [emoij.name[len("marsey"):] if emoij.name.startswith("marsey") else emoij.name] + ([author] if SITE_NAME == 'rDrama' else []),
|
||||||
|
"count": emoij.count,
|
||||||
|
"class": "Marsey"
|
||||||
|
} for emoij, author in g.db.query(Marsey, User.username).join(User, User.id==Marsey.author_id).order_by(Marsey.count.desc())]
|
||||||
|
|
||||||
return str(marseys).replace("'",'"')
|
# Stastic shit
|
||||||
|
shit = open("files/assets/shit emojis.json", "r", encoding="utf-8")
|
||||||
|
emojis = emojis + json.load(shit)
|
||||||
|
shit.close()
|
||||||
|
|
||||||
|
if SITE_NAME == 'Cringetopia':
|
||||||
|
shit = open("files/assets/shit emojis.cringetopia.json", "r", encoding="utf-8")
|
||||||
|
emojis = emojis + json.load(shit)
|
||||||
|
shit.close()
|
||||||
|
|
||||||
|
# return str(marseys).replace("'",'"')
|
||||||
|
return jsonify(emojis)
|
||||||
|
|
||||||
@app.get('/rules')
|
@app.get('/rules')
|
||||||
@app.get('/sidebar')
|
@app.get('/sidebar')
|
||||||
|
|
|
@ -85,7 +85,12 @@
|
||||||
<label class="custom-control-label" for="under_attack">Under attack mode</label>
|
<label class="custom-control-label" for="under_attack">Under attack mode</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="btn btn-primary mt-3" onclick="post_toast(this,'/admin/purge_cache');">PURGE CACHE</button>
|
<button class="btn btn-primary mt-3" onclick="post_toast(this,'/admin/purge_cache');" style="margin-bottom: 2em;">PURGE CACHE</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<h4>Server Status</h4>
|
||||||
|
<div>
|
||||||
|
Live Revision: <code>{{ gitref }}</code> <br>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -1,49 +1,19 @@
|
||||||
<div id="form" class="d-none"></div>
|
<div id="form" class="d-none"></div>
|
||||||
<div class="modal fade" id="emojiModal" tabindex="-1" role="dialog" aria-labelledby="emojiModalTitle" aria-hidden="true">
|
<div class="modal fade" id="emojiModal" tabindex="-1" role="dialog" aria-labelledby="emojiModalTitle" aria-hidden="true">
|
||||||
<div class="modal-dialog modal-dialog-scrollable modal-dialog-centered p-2 py-5 emoji-modal" role="document">
|
<style>
|
||||||
|
#emojiTabs {height: 80%;}
|
||||||
|
@media (max-height: 900px) {
|
||||||
|
#emojiTabs {height: 100%;}
|
||||||
|
#emojiModalInternalDivIDK {margin-top: 0 !important; margin-bottom: 0 !important; padding-top: 0 !important; padding-bottom: 0 !important;}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div id="emojiModalInternalDivIDK" class="modal-dialog modal-dialog-scrollable modal-dialog-centered p-2 py-5 emoji-modal" role="document">
|
||||||
<div class="modal-content" id="emojiTabs">
|
<div class="modal-content" id="emojiTabs">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<div>
|
<div>
|
||||||
<ul class="nav nav-pills py-2">
|
<ul class="nav nav-pills py-2" id="emoji-modal-tabs">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link active emojitab" data-bs-toggle="tab" href="#emoji-tab-favorite">Favorite</a>
|
<a class="nav-link active emojitab" data-class-name="favorite" data-bs-toggle="tab" href="#" onclick="switchEmojiTab(event)">⭐ Favorite ⭐</a>
|
||||||
</li>
|
|
||||||
|
|
||||||
{% if SITE_NAME == 'Cringetopia' %}
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-cringetopia">Cringetopia</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-marsey">Marsey</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-marseyalphabet">Marsey Alphabet</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-platy">Platy</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-wolf">Zombie Wolf</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-tay">Tay</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-classic">Classic</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-rage">Rage</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-wojak">Wojak</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-flags">Flags</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-misc">Misc</a>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -52,51 +22,68 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="px-3"><input autocomplete="off" class="form-control px-2" type="text" id="emoji_search" placeholder="Search.."></div>
|
<div class="px-3">
|
||||||
|
<input disabled autocomplete="off" class="form-control px-2" type="text" id="emoji_search" placeholder="Search..">
|
||||||
|
</div>
|
||||||
|
<div class="px-3 d-flex flex-row">
|
||||||
|
<fieldset class="p-2">
|
||||||
|
<label for="emoji-algo">Search Algorithm</label>
|
||||||
|
<select id="emoji-algo">
|
||||||
|
<option value="binary" selected>Binary Search</option>
|
||||||
|
<option value="normal" title="YIKES" disabled>Complete (slower)</option>
|
||||||
|
</select>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset class="p-2">
|
||||||
|
<label style="display: inline">Options:</legend>
|
||||||
|
|
||||||
|
<div style="display: inline" title="Makes the emoji larger">
|
||||||
|
<input type="checkbox" id="emoij-sel-0" value="#" class="emoij-suffix">
|
||||||
|
<label for="emoij-sel-0">Large</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="display: inline" title="Mirror the emoji along the Y axis">
|
||||||
|
<input type="checkbox" id="emoij-sel-1" value="!" class="emoij-suffix">
|
||||||
|
<label for="emoij-sel-1">Mirror</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="display: inline" title="Adds a hand that pats the emoji. Does not work with animated emoji">
|
||||||
|
<input type="checkbox" id="emoij-sel-2" value="pat" class="emoij-postfix">
|
||||||
|
<label for="emoij-sel-2">Pat</label>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<!--
|
||||||
|
<fieldset class="p-2">
|
||||||
|
<label>marseyalphabet:</label>
|
||||||
|
<input type="text">
|
||||||
|
<button>generate!</button>
|
||||||
|
</fieldset>-->
|
||||||
|
</div>
|
||||||
|
|
||||||
<div style="overflow-y: scroll;">
|
<div style="overflow-y: scroll;">
|
||||||
<div class="modal-body p-0" id="emoji-modal-body">
|
<div class="modal-body p-0" id="emoji-modal-body">
|
||||||
<div id="emoji-tab-search"></div>
|
<div id="no-emojis-found" class="tab-content py-3 pl-2" hidden>
|
||||||
<div id="no-emojis-found"></div>
|
No results... Next time be better with your query. 💅
|
||||||
<div id="tab-content" class="tab-content">
|
</div>
|
||||||
<div class="tab-pane fade show active" id="emoji-tab-favorite">
|
<div id="emojis-work" class="tab-content py-3 pl-2">
|
||||||
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_favorite"></div>
|
I am working as hard as I can, sweety... 🚴
|
||||||
</div>
|
</div>
|
||||||
{% if SITE_NAME == 'Cringetopia' %}
|
<div id="tab-content" class="tab-content d-flex flex-wrap py-3 pl-2" hidden>
|
||||||
<div class="tab-pane fade" id="emoji-tab-cringetopia">
|
<style>
|
||||||
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_cringetopia"></div>
|
.emoji2 {
|
||||||
</div>
|
/*background: None!important;*/
|
||||||
{% endif %}
|
width:60px;
|
||||||
<div class="tab-pane fade" id="emoji-tab-marsey">
|
height: 85px;
|
||||||
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_marsey"></div>
|
overflow: hidden;
|
||||||
</div>
|
border: none
|
||||||
<div class="tab-pane fade" id="emoji-tab-marseyalphabet">
|
}
|
||||||
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_marseyalphabet"></div>
|
</style>
|
||||||
</div>
|
<template id="emoij-button-template">
|
||||||
<div class="tab-pane fade" id="emoji-tab-platy">
|
<button class="btn m-1 px-0 emoji2" data-bs-toggle="tooltip" delay:="0">
|
||||||
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_platy"></div>
|
<img loading="lazy" width=50>
|
||||||
</div>
|
</button>
|
||||||
<div class="tab-pane fade" id="emoji-tab-wolf">
|
</template>
|
||||||
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_wolf"></div>
|
|
||||||
</div>
|
|
||||||
<div class="tab-pane fade" id="emoji-tab-tay">
|
|
||||||
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_tay"></div>
|
|
||||||
</div>
|
|
||||||
<div class="tab-pane fade" id="emoji-tab-classic">
|
|
||||||
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_classic"></div>
|
|
||||||
</div>
|
|
||||||
<div class="tab-pane fade" id="emoji-tab-rage">
|
|
||||||
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_rage"></div>
|
|
||||||
</div>
|
|
||||||
<div class="tab-pane fade" id="emoji-tab-wojak">
|
|
||||||
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_wojak"></div>
|
|
||||||
</div>
|
|
||||||
<div class="tab-pane fade" id="emoji-tab-flags">
|
|
||||||
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_flags"></div>
|
|
||||||
</div>
|
|
||||||
<div class="tab-pane fade" id="emoji-tab-misc">
|
|
||||||
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_misc"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -96,9 +96,7 @@
|
||||||
|
|
||||||
<input autocomplete="off" class="form-control" id="post-title" aria-describedby="titleHelpRegister" type="text" name="title" placeholder="Required" value="{{title}}" minlength="1" maxlength="500" required oninput="checkForRequired();savetext()">
|
<input autocomplete="off" class="form-control" id="post-title" aria-describedby="titleHelpRegister" type="text" name="title" placeholder="Required" value="{{title}}" minlength="1" maxlength="500" required oninput="checkForRequired();savetext()">
|
||||||
|
|
||||||
<label onclick="loadEmojis('post-title')" class="btn btn-secondary format d-inline-block m-0" for="emoji-reply-btn-2">
|
<div onclick="loadEmojis('post-title')" class="btn btn-secondary format d-inline-block m-0" id="emoji-reply-btn-2" aria-hidden="true" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add Emoji"><i class="fas fa-smile-beam"></i></div>
|
||||||
<div id="emoji-reply-btn-2" aria-hidden="true" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add Emoji"><i class="fas fa-smile-beam"></i></div>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<div id="urlblock">
|
<div id="urlblock">
|
||||||
<label for="URL" class="mt-3">URL</label>
|
<label for="URL" class="mt-3">URL</label>
|
||||||
|
|
Loading…
Reference in New Issue