forked from rDrama/rDrama
dfMerge branch 'frost' of https://github.com/Aevann1/Drama into frost
commit
3ed28fd283
|
@ -70,7 +70,7 @@ class Comment(Base):
|
|||
@property
|
||||
@lazy
|
||||
def top_comment(self):
|
||||
return g.db.query(Comment).filter_by(id=self.top_comment_id).first()
|
||||
return g.db.query(Comment).filter_by(id=self.top_comment_id).one_or_none()
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -263,8 +263,6 @@ def remove_meme_admin(v, username):
|
|||
def monthly(v):
|
||||
if SITE_NAME == 'Drama' and v.id != AEVANN_ID: abort (403)
|
||||
|
||||
thing = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first().id
|
||||
|
||||
data = {'access_token': GUMROAD_TOKEN}
|
||||
|
||||
emails = [x['email'] for x in requests.get(f'https://api.gumroad.com/v2/products/{GUMROAD_ID}/subscribers', data=data, timeout=5).json()["subscribers"]]
|
||||
|
|
|
@ -169,10 +169,8 @@ def buy(v, award):
|
|||
if award == "lootbox":
|
||||
send_repeatable_notification(995, f"@{v.username} bought a lootbox!")
|
||||
for i in [1,2,3,4,5]:
|
||||
thing = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first().id
|
||||
thing += 1
|
||||
award = random.choice(["snow", "gingerbread", "lights", "candycane", "fireplace"])
|
||||
award = AwardRelationship(id=thing, user_id=v.id, kind=award)
|
||||
award = AwardRelationship(user_id=v.id, kind=award)
|
||||
g.db.add(award)
|
||||
g.db.flush()
|
||||
v.lootboxes_bought += 1
|
||||
|
@ -193,9 +191,7 @@ def buy(v, award):
|
|||
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
|
||||
|
||||
else:
|
||||
thing = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first().id
|
||||
thing += 1
|
||||
award = AwardRelationship(id=thing, user_id=v.id, kind=award)
|
||||
award = AwardRelationship(user_id=v.id, kind=award)
|
||||
g.db.add(award)
|
||||
|
||||
g.db.add(v)
|
||||
|
@ -692,9 +688,6 @@ def admin_userawards_post(v):
|
|||
|
||||
notify_awards = {}
|
||||
|
||||
latest = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first()
|
||||
thing = latest.id
|
||||
|
||||
for key, value in request.values.items():
|
||||
if key not in AWARDS: continue
|
||||
|
||||
|
@ -705,10 +698,7 @@ def admin_userawards_post(v):
|
|||
if int(value): notify_awards[key] = int(value)
|
||||
|
||||
for x in range(int(value)):
|
||||
thing += 1
|
||||
|
||||
award = AwardRelationship(
|
||||
id=thing,
|
||||
user_id=u.id,
|
||||
kind=key
|
||||
)
|
||||
|
|
|
@ -211,7 +211,7 @@ def api_comment(v):
|
|||
try:
|
||||
badge_def = loads(body)
|
||||
name = badge_def["name"]
|
||||
badge = g.db.query(BadgeDef).filter_by(name=name).first()
|
||||
badge = g.db.query(BadgeDef).filter_by(name=name).one_or_none()
|
||||
if not badge:
|
||||
badge = BadgeDef(name=name, description=badge_def["description"])
|
||||
g.db.add(badge)
|
||||
|
@ -229,7 +229,7 @@ def api_comment(v):
|
|||
if "author" in marsey: author_id = get_user(marsey["author"]).id
|
||||
elif "author_id" in marsey: author_id = marsey["author_id"]
|
||||
else: abort(400)
|
||||
if not g.db.query(Marsey.name).filter_by(name=name).first():
|
||||
if not g.db.query(Marsey.name).filter_by(name=name).one_or_none():
|
||||
marsey = Marsey(name=marsey["name"], author_id=author_id, tags=marsey["tags"], count=0)
|
||||
g.db.add(marsey)
|
||||
filename = f'files/assets/images/emojis/{name}.webp'
|
||||
|
|
|
@ -87,7 +87,9 @@ def login_post():
|
|||
if not username: abort(400)
|
||||
if username.startswith('@'): username = username[1:]
|
||||
|
||||
if "@" in username: account = g.db.query(User).filter(User.email.ilike(username)).one_or_none()
|
||||
if "@" in username:
|
||||
try: account = g.db.query(User).filter(User.email.ilike(username)).one_or_none()
|
||||
except: return "Multiple users use this email!"
|
||||
else: account = get_user(username, graceful=True)
|
||||
|
||||
if not account:
|
||||
|
@ -117,9 +119,7 @@ def login_post():
|
|||
return redirect(f'{SITE_FULL}/login')
|
||||
|
||||
formhash = request.values.get("hash")
|
||||
if not validate_hash(f"{account.id}+{request.values.get('time')}+2fachallenge",
|
||||
formhash
|
||||
):
|
||||
if not validate_hash(f"{account.id}+{request.values.get('time')}+2fachallenge", formhash):
|
||||
return redirect(f"{SITE_FULL}/login")
|
||||
|
||||
if not account.validate_2fa(request.values.get("2fa_token", "").strip()):
|
||||
|
|
|
@ -734,7 +734,7 @@ def thumbnail_thread(pid):
|
|||
|
||||
body_html = sanitize(f'New {word} mention: https://old.reddit.com{i["permalink"]}?context=89', noimages=True)
|
||||
|
||||
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1, sentto=0).first()
|
||||
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1, sentto=0).one_or_none()
|
||||
|
||||
if existing_comment: break
|
||||
|
||||
|
@ -757,7 +757,7 @@ def thumbnail_thread(pid):
|
|||
for i in requests.get(f'https://api.pushshift.io/reddit/{t}/search?html_decode=true&q={k}&size=1').json()["data"]:
|
||||
try: body_html = sanitize(f'New mention of you: https://old.reddit.com{i["permalink"]}?context=89', noimages=True)
|
||||
except: continue
|
||||
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html).first()
|
||||
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html).one_or_none()
|
||||
if existing_comment: break
|
||||
|
||||
new_comment = Comment(author_id=NOTIFICATIONS_ID,
|
||||
|
@ -785,7 +785,7 @@ def thumbnail_thread(pid):
|
|||
for i in data:
|
||||
body_html = sanitize(f'New pcmemes mention: https://old.reddit.com{i["permalink"]}?context=89', noimages=True)
|
||||
|
||||
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1, sentto=0).first()
|
||||
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1, sentto=0).one_or_none()
|
||||
|
||||
if existing_comment: break
|
||||
|
||||
|
|
|
@ -470,7 +470,7 @@ def message2(v, username):
|
|||
existing = g.db.query(Comment.id).filter(Comment.author_id == v.id,
|
||||
Comment.sentto == user.id,
|
||||
Comment.body_html == text_html,
|
||||
).first()
|
||||
).one_or_none()
|
||||
|
||||
if existing: return {"error": "Message already exists."}, 403
|
||||
|
||||
|
@ -699,19 +699,11 @@ def u_username(username, v=None):
|
|||
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": f"That username is reserved for: {u.reserved}"}
|
||||
return render_template("userpage_reserved.html", u=u, v=v)
|
||||
|
||||
if v and u.id != v.id:
|
||||
view = g.db.query(ViewerRelationship).filter(
|
||||
and_(
|
||||
ViewerRelationship.viewer_id == v.id,
|
||||
ViewerRelationship.user_id == u.id
|
||||
)
|
||||
).first()
|
||||
if v and u.id != v.id and u.patron:
|
||||
view = g.db.query(ViewerRelationship).filter_by(viewer_id=v.id, user_id=u.id).one_or_none()
|
||||
|
||||
if view:
|
||||
view.last_view_utc = g.timestamp
|
||||
else:
|
||||
view = ViewerRelationship(user_id = u.id,
|
||||
viewer_id = v.id)
|
||||
if view: view.last_view_utc = g.timestamp
|
||||
else: view = ViewerRelationship(viewer_id=v.id, user_id=u.id)
|
||||
|
||||
g.db.add(view)
|
||||
g.db.commit()
|
||||
|
@ -888,6 +880,18 @@ def u_username_info(username, v=None):
|
|||
|
||||
return user.json
|
||||
|
||||
@app.get("/<id>/info")
|
||||
@auth_required
|
||||
def u_user_id_info(id, v=None):
|
||||
|
||||
user=get_account(id, v=v)
|
||||
|
||||
if hasattr(user, 'is_blocking') and user.is_blocking:
|
||||
return {"error": "You're blocking this user."}, 401
|
||||
elif hasattr(user, 'is_blocked') and user.is_blocked:
|
||||
return {"error": "This user is blocking you."}, 403
|
||||
|
||||
return user.json
|
||||
|
||||
@app.post("/follow/<username>")
|
||||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||
|
@ -1042,7 +1046,7 @@ def fp(v, fp):
|
|||
users += alts
|
||||
for u in users:
|
||||
li = [v.id, u.id]
|
||||
existing = g.db.query(Alt).filter(Alt.user1.in_(li), Alt.user2.in_(li)).first()
|
||||
existing = g.db.query(Alt).filter(Alt.user1.in_(li), Alt.user2.in_(li)).one_or_none()
|
||||
if existing: continue
|
||||
new_alt = Alt(user1=v.id, user2=u.id)
|
||||
g.db.add(new_alt)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=123"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=21">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=124"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=21">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
@ -39,7 +39,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=108"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=21">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=124"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=21">
|
||||
{% endif %}
|
||||
|
||||
</head>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<script src="/static/assets/js/bootstrap.js?a=240"></script>
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=123">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=124">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=21">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
|
@ -32,7 +32,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=123"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=21">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=124"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=21">
|
||||
{% endif %}
|
||||
|
||||
{% if sub and sub.css and not request.path.endswith('settings') %}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
{% block content %}
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=123"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=21">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=124"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=21">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
@ -30,7 +30,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=123"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=21">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=124"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=21">
|
||||
{% endif %}
|
||||
|
||||
<div class="row justify-content-around">
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
{% endblock %}
|
||||
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=123">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=124">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=21">
|
||||
|
||||
</head>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<title>2-Step Login - {{SITE_NAME}}</title>
|
||||
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=123"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=21">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=124"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=21">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=123"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=21">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=124"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=21">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
|
|
@ -39,10 +39,10 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=123"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=21">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=124"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=21">
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=123"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=21">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=124"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=21">
|
||||
{% endif %}
|
||||
</head>
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}Sign up - {{SITE_NAME}}{% endif %}</title>
|
||||
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=123"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=21">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=124"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=21">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %}</title>
|
||||
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=123"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=21">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=124"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=21">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
{% block stylesheets %}
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=123"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=21">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=124"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=21">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
@ -50,7 +50,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=123">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=124">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=21">
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -9,8 +9,6 @@ INSERT INTO public.users (username, original_username) VALUES
|
|||
('AutoBetter','AutoBetter'),
|
||||
('AutoChoice','AutoChoice');
|
||||
|
||||
insert into public.award_relationships(id,user_id,kind) values(1,1,'shit');
|
||||
|
||||
INSERT INTO public.badge_defs VALUES
|
||||
(1,'Alpha User','Joined during open alpha'),
|
||||
(2,'Verified Email','Verified Email'),
|
||||
|
|
|
@ -3151,7 +3151,9 @@ Middle East is like a retarded tv war show I barely watch.
|
|||
To you guys it's real life lmaooooooo
|
||||
{[para]}
|
||||
I don't like loli
|
||||
|
||||
it is disgusting
|
||||
|
||||
rape though...
|
||||
{[para]}
|
||||
Don't be serious, you are going to make me laugh. Do you really think Carp cares about you as a person? He just wants to bolster his followers in rDrama. Even the people there and in ruqqus talk about how annoying you are. Seriously, you're kidding yourself.
|
||||
|
|
Loading…
Reference in New Issue