forked from rDrama/rDrama
Merge remote-tracking branch 'origin/master'
commit
83954f5a0e
|
@ -1,7 +1,11 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from files.__main__ import Base
|
||||
from os import environ
|
||||
|
||||
site_name = environ.get("SITE_NAME").strip()
|
||||
|
||||
if site_name == "Drama":
|
||||
AWARDS = {
|
||||
"ban": {
|
||||
"kind": "ban",
|
||||
|
@ -18,6 +22,16 @@ AWARDS = {
|
|||
"color": "text-black-50"
|
||||
}
|
||||
}
|
||||
else:
|
||||
AWARDS = {
|
||||
"shit": {
|
||||
"kind": "shit",
|
||||
"title": "Shitpost",
|
||||
"description": "Let OP know how much their post sucks ass. Flies will swarm their idiotic post. (flies only work on posts lol!!)",
|
||||
"icon": "fas fa-poop",
|
||||
"color": "text-black-50"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class AwardRelationship(Base):
|
||||
|
|
|
@ -172,9 +172,15 @@ def sanitize(sanitized):
|
|||
if path.isfile(f'./files/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=30 src="https://{site}/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/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").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/watch?v=").replace("https://mobile.", "https://").replace("https://m.", "https://")
|
||||
|
||||
for i in re.finditer('<a href="(https://(streamable|youtube).com/(e|embed)/.*?)"', sanitized):
|
||||
for i in re.finditer('" target="_blank">(https://youtube.com/watch\?v\=.*?)</a>', sanitized):
|
||||
url = i.group(1)
|
||||
replacing = f'<a href="{url}" target="_blank">{url}</a>'
|
||||
htmlsource = f'<div style="padding-top:5px; padding-bottom: 10px;"><iframe frameborder="0" src="{url}?controls=0"></iframe></div>'
|
||||
sanitized = sanitized.replace(replacing, htmlsource.replace("watch?v=", "embed/"))
|
||||
|
||||
for i in re.finditer('<a href="(https://streamable.com/e/.*?)"', sanitized):
|
||||
url = i.group(1)
|
||||
replacing = f'<a href="{url}" target="_blank">{url}</a>'
|
||||
htmlsource = f'<div style="padding-top:5px; padding-bottom: 10px;"><iframe frameborder="0" src="{url}?controls=0"></iframe></div>'
|
||||
|
@ -186,8 +192,6 @@ def sanitize(sanitized):
|
|||
htmlsource = f'<iframe src="{url}" width="100%" height="80" frameBorder="0" allowtransparency="true" allow="encrypted-media"></iframe>'
|
||||
sanitized = sanitized.replace(replacing, htmlsource)
|
||||
|
||||
sanitized = sanitized.replace("https://mobile.twitter.com", "https://twitter.com")
|
||||
|
||||
for rd in ["https://reddit.com/", "https://new.reddit.com/", "https://www.reddit.com/", "https://redd.it/"]:
|
||||
sanitized = sanitized.replace(rd, "https://old.reddit.com/")
|
||||
|
||||
|
|
|
@ -884,6 +884,9 @@ def submit_post(v):
|
|||
g.db.add(c)
|
||||
g.db.flush()
|
||||
|
||||
new_post.comment_count = g.db.query(Comment).filter_by(parent_submission=new_post.id).count()
|
||||
g.db.add(new_post)
|
||||
|
||||
if "rdrama" in request.host:
|
||||
if v.id == 995: body = "fuck off carp"
|
||||
else: body = random.choice(snappyquotes)
|
||||
|
|
|
@ -24,7 +24,11 @@ tiers={
|
|||
"(Paypig)": 1,
|
||||
"(Renthog)": 2,
|
||||
"(Landchad)": 3,
|
||||
"(Terminally online turboautist)": 4
|
||||
"(Terminally online turboautist)": 4,
|
||||
"(Ape)": 1,
|
||||
"(Monke)": 2,
|
||||
"(Gigachad)": 3,
|
||||
"(Ascended Griller)": 4
|
||||
}
|
||||
|
||||
@app.post("/settings/removebackground")
|
||||
|
|
|
@ -44,7 +44,7 @@ def participation_stats(v):
|
|||
@auth_desired
|
||||
def patrons(v):
|
||||
if v and v.is_banned and not v.unban_utc: return render_template("seized.html")
|
||||
users = [x for x in g.db.query(User).filter(User.patron > 0).order_by(User.patron.desc()).all()]
|
||||
users = g.db.query(User).options(lazyload('*')).filter(User.patron > 0).order_by(User.patron.desc()).all()
|
||||
return render_template("patrons.html", v=v, users=users)
|
||||
|
||||
@app.get("/admins")
|
||||
|
|
|
@ -1034,7 +1034,7 @@
|
|||
|
||||
<body id="{% if request.path != '/comments' %}{% block pagetype %}frontpage{% endblock %}{% endif %}" style="overflow-x: hidden; {% if v and v.background %} background:url(/assets/images/backgrounds/{{v.background}}) no-repeat center center fixed !important; background-size: cover!important; background-color: #000!important;{% endif %}">
|
||||
|
||||
<a href="https://secure.transequality.org/site/Donation2?df_id=1480"><img src="/assets/images/{{'SITE_NAME' | app_config}}/{% if v %}banner.gif{% else %}cached.gif{% endif %}" style="padding:4px;" width="100%"></a>
|
||||
<a href="{% if 'rdrama' in request.host %}https://secure.transequality.org/site/Donation2?df_id=1480{% else %}/{% endif %}"><img src="/assets/images/{{'SITE_NAME' | app_config}}/{% if v %}banner.gif{% else %}cached.gif{% endif %}" style="padding:4px;" width="100%"></a>
|
||||
|
||||
{% include "header.html" %}
|
||||
|
||||
|
|
Loading…
Reference in New Issue