This commit is contained in:
Aevann1 2022-02-13 23:25:09 +02:00
parent a95bff2d76
commit 59773aaa30
20 changed files with 36 additions and 56 deletions

View file

@ -4429,7 +4429,7 @@ textarea {
} }
@media (min-width: 992px) { @media (min-width: 992px) {
.card-columns { .card-columns {
column-count: 6 !important; column-count: 7 !important;
} }
} }
.container, .container-fluid { .container, .container-fluid {

View file

@ -70,7 +70,7 @@ class Comment(Base):
@property @property
@lazy @lazy
def top_comment(self): 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 @property
@lazy @lazy

View file

@ -263,8 +263,6 @@ def remove_meme_admin(v, username):
def monthly(v): def monthly(v):
if SITE_NAME == 'Drama' and v.id != AEVANN_ID: abort (403) 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} 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"]] emails = [x['email'] for x in requests.get(f'https://api.gumroad.com/v2/products/{GUMROAD_ID}/subscribers', data=data, timeout=5).json()["subscribers"]]

View file

@ -169,10 +169,8 @@ def buy(v, award):
if award == "lootbox": if award == "lootbox":
send_repeatable_notification(995, f"@{v.username} bought a lootbox!") send_repeatable_notification(995, f"@{v.username} bought a lootbox!")
for i in [1,2,3,4,5]: 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 = 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.add(award)
g.db.flush() g.db.flush()
v.lootboxes_bought += 1 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}") send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
else: else:
thing = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first().id award = AwardRelationship(user_id=v.id, kind=award)
thing += 1
award = AwardRelationship(id=thing, user_id=v.id, kind=award)
g.db.add(award) g.db.add(award)
g.db.add(v) g.db.add(v)
@ -692,9 +688,6 @@ def admin_userawards_post(v):
notify_awards = {} notify_awards = {}
latest = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first()
thing = latest.id
for key, value in request.values.items(): for key, value in request.values.items():
if key not in AWARDS: continue if key not in AWARDS: continue
@ -705,10 +698,7 @@ def admin_userawards_post(v):
if int(value): notify_awards[key] = int(value) if int(value): notify_awards[key] = int(value)
for x in range(int(value)): for x in range(int(value)):
thing += 1
award = AwardRelationship( award = AwardRelationship(
id=thing,
user_id=u.id, user_id=u.id,
kind=key kind=key
) )

View file

@ -211,7 +211,7 @@ def api_comment(v):
try: try:
badge_def = loads(body) badge_def = loads(body)
name = badge_def["name"] 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: if not badge:
badge = BadgeDef(name=name, description=badge_def["description"]) badge = BadgeDef(name=name, description=badge_def["description"])
g.db.add(badge) g.db.add(badge)
@ -229,7 +229,7 @@ def api_comment(v):
if "author" in marsey: author_id = get_user(marsey["author"]).id if "author" in marsey: author_id = get_user(marsey["author"]).id
elif "author_id" in marsey: author_id = marsey["author_id"] elif "author_id" in marsey: author_id = marsey["author_id"]
else: abort(400) 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) marsey = Marsey(name=marsey["name"], author_id=author_id, tags=marsey["tags"], count=0)
g.db.add(marsey) g.db.add(marsey)
filename = f'files/assets/images/emojis/{name}.webp' filename = f'files/assets/images/emojis/{name}.webp'

View file

@ -87,7 +87,9 @@ def login_post():
if not username: abort(400) if not username: abort(400)
if username.startswith('@'): username = username[1:] 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) else: account = get_user(username, graceful=True)
if not account: if not account:
@ -117,9 +119,7 @@ def login_post():
return redirect(f'{SITE_FULL}/login') return redirect(f'{SITE_FULL}/login')
formhash = request.values.get("hash") formhash = request.values.get("hash")
if not validate_hash(f"{account.id}+{request.values.get('time')}+2fachallenge", if not validate_hash(f"{account.id}+{request.values.get('time')}+2fachallenge", formhash):
formhash
):
return redirect(f"{SITE_FULL}/login") return redirect(f"{SITE_FULL}/login")
if not account.validate_2fa(request.values.get("2fa_token", "").strip()): if not account.validate_2fa(request.values.get("2fa_token", "").strip()):

View file

@ -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) 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 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"]: 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) try: body_html = sanitize(f'New mention of you: https://old.reddit.com{i["permalink"]}?context=89', noimages=True)
except: continue 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 if existing_comment: break
new_comment = Comment(author_id=NOTIFICATIONS_ID, new_comment = Comment(author_id=NOTIFICATIONS_ID,
@ -785,7 +785,7 @@ def thumbnail_thread(pid):
for i in data: for i in data:
body_html = sanitize(f'New pcmemes mention: https://old.reddit.com{i["permalink"]}?context=89', noimages=True) 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 if existing_comment: break

View file

@ -470,7 +470,7 @@ def message2(v, username):
existing = g.db.query(Comment.id).filter(Comment.author_id == v.id, existing = g.db.query(Comment.id).filter(Comment.author_id == v.id,
Comment.sentto == user.id, Comment.sentto == user.id,
Comment.body_html == text_html, Comment.body_html == text_html,
).first() ).one_or_none()
if existing: return {"error": "Message already exists."}, 403 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}"} 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) return render_template("userpage_reserved.html", u=u, v=v)
if v and u.id != v.id: if v and u.id != v.id and u.patron:
view = g.db.query(ViewerRelationship).filter( view = g.db.query(ViewerRelationship).filter_by(viewer_id=v.id, user_id=u.id).one_or_none()
and_(
ViewerRelationship.viewer_id == v.id,
ViewerRelationship.user_id == u.id
)
).first()
if view: if view: view.last_view_utc = g.timestamp
view.last_view_utc = g.timestamp else: view = ViewerRelationship(viewer_id=v.id, user_id=u.id)
else:
view = ViewerRelationship(user_id = u.id,
viewer_id = v.id)
g.db.add(view) g.db.add(view)
g.db.commit() g.db.commit()
@ -1054,7 +1046,7 @@ def fp(v, fp):
users += alts users += alts
for u in users: for u in users:
li = [v.id, u.id] 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 if existing: continue
new_alt = Alt(user1=v.id, user2=u.id) new_alt = Alt(user1=v.id, user2=u.id)
g.db.add(new_alt) g.db.add(new_alt)

View file

@ -15,7 +15,7 @@
{% if v %} {% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style> <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 %} {% if v.agendaposter %}
<style> <style>
html { html {
@ -39,7 +39,7 @@
{% endif %} {% endif %}
{% else %} {% else %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style> <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 %} {% endif %}
</head> </head>

View file

@ -7,7 +7,7 @@
<script src="/static/assets/js/bootstrap.js?a=240"></script> <script src="/static/assets/js/bootstrap.js?a=240"></script>
{% if v %} {% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style> <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"> <link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=21">
{% if v.agendaposter %} {% if v.agendaposter %}
<style> <style>
@ -32,7 +32,7 @@
{% endif %} {% endif %}
{% else %} {% else %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style> <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 %} {% endif %}
{% if sub and sub.css and not request.path.endswith('settings') %} {% if sub and sub.css and not request.path.endswith('settings') %}

View file

@ -6,7 +6,7 @@
{% block content %} {% block content %}
{% if v %} {% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style> <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 %} {% if v.agendaposter %}
<style> <style>
html { html {
@ -30,7 +30,7 @@
{% endif %} {% endif %}
{% else %} {% else %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style> <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 %} {% endif %}
<div class="row justify-content-around"> <div class="row justify-content-around">

View file

@ -18,7 +18,7 @@
{% endblock %} {% endblock %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style> <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"> <link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=21">
</head> </head>

View file

@ -14,7 +14,7 @@
<title>2-Step Login - {{SITE_NAME}}</title> <title>2-Step Login - {{SITE_NAME}}</title>
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style> <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> </head>

View file

@ -34,7 +34,7 @@
<style>:root{--primary:#{{v.themecolor}}}</style> <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 %} {% if v.agendaposter %}
<style> <style>
html { html {

View file

@ -39,10 +39,10 @@
{% if v %} {% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style> <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 %} {% else %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style> <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 %} {% endif %}
</head> </head>

View file

@ -31,7 +31,7 @@
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}Sign up - {{SITE_NAME}}{% endif %}</title> <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> <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> </head>

View file

@ -32,7 +32,7 @@
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %}</title> <title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %}</title>
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style> <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> </head>

View file

@ -26,7 +26,7 @@
{% block stylesheets %} {% block stylesheets %}
{% if v %} {% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style> <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 %} {% if v.agendaposter %}
<style> <style>
html { html {
@ -50,7 +50,7 @@
{% endif %} {% endif %}
{% else %} {% else %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style> <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"> <link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=21">
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -9,8 +9,6 @@ INSERT INTO public.users (username, original_username) VALUES
('AutoBetter','AutoBetter'), ('AutoBetter','AutoBetter'),
('AutoChoice','AutoChoice'); ('AutoChoice','AutoChoice');
insert into public.award_relationships(id,user_id,kind) values(1,1,'shit');
INSERT INTO public.badge_defs VALUES INSERT INTO public.badge_defs VALUES
(1,'Alpha User','Joined during open alpha'), (1,'Alpha User','Joined during open alpha'),
(2,'Verified Email','Verified Email'), (2,'Verified Email','Verified Email'),

View file

@ -3151,7 +3151,9 @@ Middle East is like a retarded tv war show I barely watch.
To you guys it's real life lmaooooooo To you guys it's real life lmaooooooo
{[para]} {[para]}
I don't like loli I don't like loli
it is disgusting it is disgusting
rape though... rape though...
{[para]} {[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. 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.