forked from MarseyWorld/MarseyWorld
Merge branch 'master' of https://github.com/Aevann1/Drama
commit
0197432852
|
@ -19,8 +19,8 @@ app = Flask(__name__, template_folder='./templates')
|
||||||
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=3)
|
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=3)
|
||||||
app.url_map.strict_slashes = False
|
app.url_map.strict_slashes = False
|
||||||
app.jinja_env.cache = {}
|
app.jinja_env.cache = {}
|
||||||
# import faulthandler
|
import faulthandler
|
||||||
# faulthandler.enable()
|
faulthandler.enable()
|
||||||
|
|
||||||
app.config["SITE_NAME"]=environ.get("SITE_NAME").strip()
|
app.config["SITE_NAME"]=environ.get("SITE_NAME").strip()
|
||||||
app.config["COINS_NAME"]=environ.get("COINS_NAME").strip()
|
app.config["COINS_NAME"]=environ.get("COINS_NAME").strip()
|
||||||
|
|
|
@ -25,7 +25,7 @@ class BadgeDef(Base):
|
||||||
@lazy
|
@lazy
|
||||||
def path(self):
|
def path(self):
|
||||||
|
|
||||||
return f"/assets/images/{site_name}/badges/{self.icon}"
|
return f"/assets/images/badges/{self.icon}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
|
|
|
@ -174,10 +174,12 @@ ACTIONTYPES={
|
||||||
"set_flair_locked":{
|
"set_flair_locked":{
|
||||||
"str":"set {self.target_link}'s flair (locked)",
|
"str":"set {self.target_link}'s flair (locked)",
|
||||||
"icon": "fa-user-slash",
|
"icon": "fa-user-slash",
|
||||||
|
"color": "bg-muted",
|
||||||
},
|
},
|
||||||
"set_flair_notlocked":{
|
"set_flair_notlocked":{
|
||||||
"str":"set {self.target_link}'s flair (not locked)",
|
"str":"set {self.target_link}'s flair (not locked)",
|
||||||
"icon": "fa-user-slash",
|
"icon": "fa-user-slash",
|
||||||
|
"color": "bg-muted",
|
||||||
},
|
},
|
||||||
"pin_comment":{
|
"pin_comment":{
|
||||||
"str":'pinned a {self.target_link}',
|
"str":'pinned a {self.target_link}',
|
||||||
|
@ -220,12 +222,12 @@ ACTIONTYPES={
|
||||||
"color": "bg-muted",
|
"color": "bg-muted",
|
||||||
},
|
},
|
||||||
"club":{
|
"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",
|
"icon":"fa-eye-slash",
|
||||||
"color": "bg-danger",
|
"color": "bg-danger",
|
||||||
},
|
},
|
||||||
"unclub":{
|
"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",
|
"icon":"fa-eye",
|
||||||
"color": "bg-muted",
|
"color": "bg-muted",
|
||||||
},
|
},
|
||||||
|
|
|
@ -17,6 +17,9 @@ SLURS = {
|
||||||
" pedo":" libertarian",
|
" 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",
|
" Rapist":" Male feminist",
|
||||||
" RAPIST":" MALE FEMINIST",
|
" RAPIST":" MALE FEMINIST",
|
||||||
|
@ -49,8 +52,11 @@ SLURS = {
|
||||||
"Nigger ":"🏀 ",
|
"Nigger ":"🏀 ",
|
||||||
"NIGGER ":"🏀 ",
|
"NIGGER ":"🏀 ",
|
||||||
"pedo ":"libertarian ",
|
"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 ",
|
"Rapist ":"Male feminist ",
|
||||||
"RAPIST ":"MALE FEMINIST ",
|
"RAPIST ":"MALE FEMINIST ",
|
||||||
|
|
|
@ -184,7 +184,7 @@ def monthly(v):
|
||||||
grant_awards["shit"] = 10
|
grant_awards["shit"] = 10
|
||||||
grant_awards["fireflies"] = 10
|
grant_awards["fireflies"] = 10
|
||||||
grant_awards["ban"] = 3
|
grant_awards["ban"] = 3
|
||||||
elif u.patron == 5 or u.patron == 8:
|
elif u.patron == 5:
|
||||||
grant_awards["shit"] = 20
|
grant_awards["shit"] = 20
|
||||||
grant_awards["fireflies"] = 20
|
grant_awards["fireflies"] = 20
|
||||||
grant_awards["ban"] = 6
|
grant_awards["ban"] = 6
|
||||||
|
@ -402,7 +402,8 @@ def badge_grant_post(v):
|
||||||
if badge_id == 16 and user.has_badge(17):
|
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()
|
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])
|
user.patron = int(str(badge_id)[-1])
|
||||||
|
|
||||||
grant_awards = {}
|
grant_awards = {}
|
||||||
|
|
|
@ -48,8 +48,8 @@ def toggle_club(pid, v):
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
if post.club: return {"message": "Post has been marked as +150-coins only!"}
|
if post.club: return {"message": "Post has been marked as club-only!"}
|
||||||
else: return {"message": "Post has been unmarked as +150-coins only!"}
|
else: return {"message": "Post has been unmarked as club-only!"}
|
||||||
|
|
||||||
|
|
||||||
@app.post("/publish/<pid>")
|
@app.post("/publish/<pid>")
|
||||||
|
@ -698,14 +698,13 @@ def submit_post(v):
|
||||||
except: embed = None
|
except: embed = None
|
||||||
|
|
||||||
elif "youtu" in domain:
|
elif "youtu" in domain:
|
||||||
try: yt_id = re.match(re.compile("^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|shorts\/|\&v=)([^#\&\?]*).*"), url).group(2)
|
try:
|
||||||
except: embed = None
|
yt_id = re.match(re.compile("^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|shorts\/|\&v=)([^#\&\?]*).*"), url).group(2)
|
||||||
if not yt_id or len(yt_id) != 11: embed = None
|
|
||||||
else:
|
|
||||||
params = parse_qs(urlparse(url).query)
|
params = parse_qs(urlparse(url).query)
|
||||||
t = params.get('t', params.get('start', [0]))[0]
|
t = params.get('t', params.get('start', [0]))[0]
|
||||||
if t: embed = f"https://youtube.com/embed/{yt_id}?start={t}"
|
if t: embed = f"https://youtube.com/embed/{yt_id}?start={t}"
|
||||||
else: embed = f"https://youtube.com/embed/{yt_id}"
|
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:
|
elif app.config['SERVER_NAME'] in domain and "/post/" in url and "context" not in url:
|
||||||
id = url.split("/post/")[1]
|
id = url.split("/post/")[1]
|
||||||
|
|
|
@ -26,11 +26,6 @@ tiers={
|
||||||
"(Landchad)": 3,
|
"(Landchad)": 3,
|
||||||
"(Terminally online turboautist)": 4,
|
"(Terminally online turboautist)": 4,
|
||||||
"(Footpig)": 5,
|
"(Footpig)": 5,
|
||||||
"(Chad)": 1,
|
|
||||||
"(Megachad)": 2,
|
|
||||||
"(Gigachad)": 3,
|
|
||||||
"(Terachad)": 4,
|
|
||||||
"(Petachad)": 5
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@app.post("/settings/removebackground")
|
@app.post("/settings/removebackground")
|
||||||
|
@ -307,8 +302,7 @@ def gumroad(v):
|
||||||
|
|
||||||
response = response[0]
|
response = response[0]
|
||||||
tier = tiers[response["variants_and_quantity"]]
|
tier = tiers[response["variants_and_quantity"]]
|
||||||
if v.patron == tier:
|
if v.patron == tier: return {"error": f"{patron} rewards already claimed"}, 400
|
||||||
return {"error": f"{patron} rewards already claimed"}, 400
|
|
||||||
|
|
||||||
v.patron = tier
|
v.patron = tier
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
|
|
@ -94,21 +94,16 @@ def admins(v):
|
||||||
@app.get("/log")
|
@app.get("/log")
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def log(v):
|
def log(v):
|
||||||
return render_template("modlog.html", v=v)
|
|
||||||
|
|
||||||
# @app.get("/log")
|
page=int(request.args.get("page",1))
|
||||||
# @auth_desired
|
|
||||||
# def log(v):
|
|
||||||
|
|
||||||
# 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()
|
next_exists=len(actions)==26
|
||||||
# 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()
|
actions=actions[:25]
|
||||||
|
|
||||||
# next_exists=len(actions)==26
|
return render_template("log.html", v=v, actions=actions, next_exists=next_exists, page=page)
|
||||||
# actions=actions[:25]
|
|
||||||
|
|
||||||
# return render_template("log.html", v=v, actions=actions, next_exists=next_exists, page=page)
|
|
||||||
|
|
||||||
@app.get("/log/<id>")
|
@app.get("/log/<id>")
|
||||||
@auth_desired
|
@auth_desired
|
||||||
|
|
|
@ -81,17 +81,14 @@
|
||||||
// Toggle comment collapse
|
// Toggle comment collapse
|
||||||
|
|
||||||
function collapse_comment(comment_id) {
|
function collapse_comment(comment_id) {
|
||||||
|
const comment = "comment-" + comment_id
|
||||||
const OFFSET = window.innerHeight / 3
|
|
||||||
|
|
||||||
const comment = "comment-" + comment_id;
|
|
||||||
const element = document.getElementById(comment)
|
const element = document.getElementById(comment)
|
||||||
const closed = element.classList.toggle("collapsed");
|
const closed = element.classList.toggle("collapsed")
|
||||||
const top = element.getBoundingClientRect().y
|
const top = element.getBoundingClientRect().y
|
||||||
|
|
||||||
if (closed && top < OFFSET) {
|
if (closed && top < 0) {
|
||||||
element.scrollIntoView()
|
element.scrollIntoView()
|
||||||
window.scrollBy(0, - OFFSET)
|
window.scrollBy(0, - 100)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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" 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" 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" 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 %}
|
{% 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>
|
<a class="dropdown-item" href="/contact"><i class="fas fa-file-signature fa-fw text-left mr-3"></i>Contact us</a>
|
||||||
</div>
|
</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" 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" 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 %}
|
{% 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>
|
<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>
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<td style="font-weight:bold;">{{loop.index}}</td>
|
<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><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;">
|
<td style="font-weight:bold;">
|
||||||
{% for (a,count) in row['awards'].values() %}
|
{% for (a,count) in row['awards'].values() %}
|
||||||
|
|
|
@ -413,17 +413,17 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if p.is_video %}
|
{% 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%">
|
<video controls preload="metadata" style="max-width: 100%">
|
||||||
<source src="{{p.realurl(v)}}" type="video/mp4">
|
<source src="{{p.realurl(v)}}" type="video/mp4">
|
||||||
</video>
|
</video>
|
||||||
</div>
|
</div>
|
||||||
{% elif p.embed_url and "youtu" in p.domain %}
|
{% 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>
|
<iframe loading="lazy" src="{{p.embed_url}}" frameborder="0" style="max-width: 100%" width="600" height="337" allow="fullscreen"></iframe>
|
||||||
</div>
|
</div>
|
||||||
{% elif p.url and "streamable.com/e/" in p.url %}
|
{% 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>
|
<iframe loading="lazy" src="{{p.url}}" frameborder="0" style="max-width: 100%" width="600" height="337" allow="fullscreen"></iframe>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -308,7 +308,7 @@
|
||||||
|
|
||||||
<h1 class="d-none d-md-block mt-3">Create a post</h1>
|
<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">
|
<div class="body">
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue