remotes/1693045480750635534/spooky-22
atrc445 2021-09-21 21:39:57 +02:00
commit 0197432852
13 changed files with 41 additions and 47 deletions

View File

@ -19,8 +19,8 @@ app = Flask(__name__, template_folder='./templates')
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=3)
app.url_map.strict_slashes = False
app.jinja_env.cache = {}
# import faulthandler
# faulthandler.enable()
import faulthandler
faulthandler.enable()
app.config["SITE_NAME"]=environ.get("SITE_NAME").strip()
app.config["COINS_NAME"]=environ.get("COINS_NAME").strip()

View File

@ -25,7 +25,7 @@ class BadgeDef(Base):
@lazy
def path(self):
return f"/assets/images/{site_name}/badges/{self.icon}"
return f"/assets/images/badges/{self.icon}"
@property
@lazy

View File

@ -174,10 +174,12 @@ ACTIONTYPES={
"set_flair_locked":{
"str":"set {self.target_link}'s flair (locked)",
"icon": "fa-user-slash",
"color": "bg-muted",
},
"set_flair_notlocked":{
"str":"set {self.target_link}'s flair (not locked)",
"icon": "fa-user-slash",
"color": "bg-muted",
},
"pin_comment":{
"str":'pinned a {self.target_link}',
@ -220,12 +222,12 @@ ACTIONTYPES={
"color": "bg-muted",
},
"club":{
"str": 'marked post {self.target_link} as viewable to users with +150 coins only',
"str": 'marked post {self.target_link} as club-only',
"icon":"fa-eye-slash",
"color": "bg-danger",
},
"unclub":{
"str": 'unmarked post {self.target_link} as viewable to users with +150 coins only',
"str": 'unmarked post {self.target_link} as club-only',
"icon":"fa-eye",
"color": "bg-muted",
},

View File

@ -17,6 +17,9 @@ SLURS = {
" pedo":" libertarian",
" Pedo":" Libertarian ",
" PEDO":" LIBERTARIAN ",
" libertarian":" pedo",
" Libertarian":" Pedo ",
" LIBERTARIAN":" PEDO ",
" rapist":" male feminist",
" Rapist":" Male feminist",
" RAPIST":" MALE FEMINIST",
@ -49,8 +52,11 @@ SLURS = {
"Nigger ":"🏀 ",
"NIGGER ":"🏀 ",
"pedo ":"libertarian ",
"Pedo ":"Libertarian ",
"PEDO ":"LIBERTARIAN ",
"Pedo ":"Libertarian ",
"PEDO ":"LIBERTARIAN ",
"libertarian ":"pedo ",
"Libertarian ":"Pedo ",
"LIBERTARIAN ":"PEDO ",
"rapist ":"male feminist ",
"Rapist ":"Male feminist ",
"RAPIST ":"MALE FEMINIST ",

View File

@ -184,7 +184,7 @@ def monthly(v):
grant_awards["shit"] = 10
grant_awards["fireflies"] = 10
grant_awards["ban"] = 3
elif u.patron == 5 or u.patron == 8:
elif u.patron == 5:
grant_awards["shit"] = 20
grant_awards["fireflies"] = 20
grant_awards["ban"] = 6
@ -402,7 +402,8 @@ def badge_grant_post(v):
if badge_id == 16 and user.has_badge(17):
g.db.query(Badge).options(lazyload('*')).filter_by(badge_id=17, user_id=user.id).delete()
elif badge_id in [21,22,23,24,28]:
elif badge_id in [21,22,23,24,25,28]:
if badge_id == 28: badge_id = 25
user.patron = int(str(badge_id)[-1])
grant_awards = {}

View File

@ -48,8 +48,8 @@ def toggle_club(pid, v):
g.db.commit()
if post.club: return {"message": "Post has been marked as +150-coins only!"}
else: return {"message": "Post has been unmarked as +150-coins only!"}
if post.club: return {"message": "Post has been marked as club-only!"}
else: return {"message": "Post has been unmarked as club-only!"}
@app.post("/publish/<pid>")
@ -698,14 +698,13 @@ def submit_post(v):
except: embed = None
elif "youtu" in domain:
try: yt_id = re.match(re.compile("^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|shorts\/|\&v=)([^#\&\?]*).*"), url).group(2)
except: embed = None
if not yt_id or len(yt_id) != 11: embed = None
else:
try:
yt_id = re.match(re.compile("^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|shorts\/|\&v=)([^#\&\?]*).*"), url).group(2)
params = parse_qs(urlparse(url).query)
t = params.get('t', params.get('start', [0]))[0]
if t: embed = f"https://youtube.com/embed/{yt_id}?start={t}"
else: embed = f"https://youtube.com/embed/{yt_id}"
except: embed = None
elif app.config['SERVER_NAME'] in domain and "/post/" in url and "context" not in url:
id = url.split("/post/")[1]

View File

@ -26,11 +26,6 @@ tiers={
"(Landchad)": 3,
"(Terminally online turboautist)": 4,
"(Footpig)": 5,
"(Chad)": 1,
"(Megachad)": 2,
"(Gigachad)": 3,
"(Terachad)": 4,
"(Petachad)": 5
}
@app.post("/settings/removebackground")
@ -307,8 +302,7 @@ def gumroad(v):
response = response[0]
tier = tiers[response["variants_and_quantity"]]
if v.patron == tier:
return {"error": f"{patron} rewards already claimed"}, 400
if v.patron == tier: return {"error": f"{patron} rewards already claimed"}, 400
v.patron = tier
g.db.add(v)

View File

@ -94,21 +94,16 @@ def admins(v):
@app.get("/log")
@auth_desired
def log(v):
return render_template("modlog.html", v=v)
# @app.get("/log")
# @auth_desired
# def log(v):
page=int(request.args.get("page",1))
# page=int(request.args.get("page",1))
if v and v.admin_level == 6: actions = g.db.query(ModAction).order_by(ModAction.id.desc()).offset(25 * (page - 1)).limit(26).all()
else: actions=g.db.query(ModAction).filter(ModAction.kind!="shadowban", ModAction.kind!="unshadowban", ModAction.kind!="club", ModAction.kind!="unclub").order_by(ModAction.id.desc()).offset(25*(page-1)).limit(26).all()
# if v and v.admin_level == 6: actions = g.db.query(ModAction).order_by(ModAction.id.desc()).offset(25 * (page - 1)).limit(26).all()
# else: actions=g.db.query(ModAction).filter(ModAction.kind!="shadowban", ModAction.kind!="unshadowban", ModAction.kind!="club", ModAction.kind!="unclub").order_by(ModAction.id.desc()).offset(25*(page-1)).limit(26).all()
next_exists=len(actions)==26
actions=actions[:25]
# next_exists=len(actions)==26
# actions=actions[:25]
# return render_template("log.html", v=v, actions=actions, next_exists=next_exists, page=page)
return render_template("log.html", v=v, actions=actions, next_exists=next_exists, page=page)
@app.get("/log/<id>")
@auth_desired

View File

@ -81,17 +81,14 @@
// Toggle comment collapse
function collapse_comment(comment_id) {
const OFFSET = window.innerHeight / 3
const comment = "comment-" + comment_id;
const comment = "comment-" + comment_id
const element = document.getElementById(comment)
const closed = element.classList.toggle("collapsed");
const closed = element.classList.toggle("collapsed")
const top = element.getBoundingClientRect().y
if (closed && top < OFFSET) {
if (closed && top < 0) {
element.scrollIntoView()
window.scrollBy(0, - OFFSET)
window.scrollBy(0, - 100)
}
};

View File

@ -124,7 +124,7 @@
<a class="dropdown-item" href="/changelog"><i class="fas fa-clipboard fa-fw text-left mr-3"></i>Changelog</a>
<a class="dropdown-item" rel="nofollow noopener noreferrer" href="https://github.com/Aevann1/Drama"><i class="fab fa-github fa-fw text-left mr-3"></i>Source code</a>
<a class="dropdown-item" href="/discord"><i class="fab fa-discord fa-fw text-left mr-3"></i>Discord</a>
<a class="dropdown-item" rel="nofollow noopener noreferrer" href="{{'GUMROAD_LINK' | app_config}}"><i class="fas fa-dollar-sign fa-fw text-left mr-3"></i>Donate</a>
{% if 'pcm' not in request.host %}<a class="dropdown-item" rel="nofollow noopener noreferrer" href="{{'GUMROAD_LINK' | app_config}}"><i class="fas fa-dollar-sign fa-fw text-left mr-3"></i>Donate</a>{% endif %}
{% if 'rdrama' in request.host %}<a class="dropdown-item" href="/archives"><i class="fas fa-book fa-fw text-left mr-3"></i>Subreddit archives</a>{% endif %}
<a class="dropdown-item" href="/contact"><i class="fas fa-file-signature fa-fw text-left mr-3"></i>Contact us</a>
</div>
@ -185,7 +185,7 @@
<li class="nav-item"><a class="nav-link" rel="nofollow noopener noreferrer" href="https://github.com/Aevann1/Drama"><i class="fab fa-github fa-fw mr-3"></i>Source code</a></li>
<li class="nav-item"><a class="nav-link" href="/discord"><i class="fab fa-discord fa-fw mr-3"></i>Discord</a></li>
<li class="nav-item"><a class="nav-link" rel="nofollow noopener noreferrer" href="{{'GUMROAD_LINK' | app_config}}"><i class="fas fa-dollar-sign fa-fw mr-3"></i>Donate</a></li>
{% if 'pcm' not in request.host %}<li class="nav-item"><a class="nav-link" rel="nofollow noopener noreferrer" href="{{'GUMROAD_LINK' | app_config}}"><i class="fas fa-dollar-sign fa-fw mr-3"></i>Donate</a></li>{% endif %}
{% if 'rdrama' in request.host %}<li class="nav-item"><a class="nav-link" href="/archives"><i class="fas fa-book fa-fw mr-3"></i>Subreddit archives</a></li>{% endif %}
<li class="nav-item"><a class="nav-link" href="/contact"><i class="fas fa-file-signature fa-fw mr-3"></i>Contact us</a></li>

View File

@ -15,7 +15,7 @@
<td style="font-weight:bold;">{{loop.index}}</td>
<td><a style="color:#{{row['namecolor']}}; font-weight:bold;" href="/@{{row['username']}}"><img loading="lazy" src="/uid/{{uid}}/pic/profile" class="profile-pic-20 mr-1"><span {% if row['patron'] %}class="patron" style="background-color:#{{row['namecolor']}};"{% endif %}>{{row['username']}}</span></a></td>
<td><img loading="lazy" style="width: 32px; height: 32px" src="/assets/images/{{'SITE_NAME' | app_config}}/badges/patron-{{row['patron']}}.webp"></td>
<td><img loading="lazy" style="width: 32px; height: 32px" src="/assets/images/badges/patron-{{row['patron']}}.webp"></td>
<td style="font-weight:bold;">
{% for (a,count) in row['awards'].values() %}

View File

@ -413,17 +413,17 @@
{% endif %}
{% if p.is_video %}
<div id="video-{{p.id}}" style="text-align: center" class="{% if v and not v.cardview or p.over_18 %}d-none{% endif %} mt-4">
<div id="video-{{p.id}}" style="text-align: center" class="{% if not (v and v.cardview) or p.over_18 %}d-none{% endif %} mt-4">
<video controls preload="metadata" style="max-width: 100%">
<source src="{{p.realurl(v)}}" type="video/mp4">
</video>
</div>
{% elif p.embed_url and "youtu" in p.domain %}
<div id="video-{{p.id}}" style="text-align: center" class="{% if v and not v.cardview or p.over_18 %}d-none{% endif %} mt-3 mb-4">
<div id="video-{{p.id}}" style="text-align: center" class="{% if not (v and v.cardview) or p.over_18 %}d-none{% endif %} mt-3 mb-4">
<iframe loading="lazy" src="{{p.embed_url}}" frameborder="0" style="max-width: 100%" width="600" height="337" allow="fullscreen"></iframe>
</div>
{% elif p.url and "streamable.com/e/" in p.url %}
<div id="video-{{p.id}}" style="text-align: center" class="{% if v and not v.cardview or p.over_18 %}d-none{% endif %} mt-3 mb-4">
<div id="video-{{p.id}}" style="text-align: center" class="{% if not (v and v.cardview) or p.over_18 %}d-none{% endif %} mt-3 mb-4">
<iframe loading="lazy" src="{{p.url}}" frameborder="0" style="max-width: 100%" width="600" height="337" allow="fullscreen"></iframe>
</div>
{% endif %}

View File

@ -308,7 +308,7 @@
<h1 class="d-none d-md-block mt-3">Create a post</h1>
<h2 class="h3 d-md-none">Create a post</h2>
<h2 class="h3 d-md-none mt-5">Create a post</h2>
<div class="body">