diff --git a/files/helpers/wrappers.py b/files/helpers/wrappers.py index 02e1b3e90e..4207b858e1 100644 --- a/files/helpers/wrappers.py +++ b/files/helpers/wrappers.py @@ -4,10 +4,10 @@ from files.helpers.const import * def get_logged_in_user(): - token = request.headers.get("Authorization") + token = request.headers.get("Authorization","").strip() if token: - client = g.db.query(ClientAuth).filter(ClientAuth.access_token == token).first() + client = g.db.query(ClientAuth).filter(ClientAuth.access_token == token).one_or_none() if not client: return None v = client.user @@ -21,7 +21,7 @@ def get_logged_in_user(): if not uid or not logged_in or uid != logged_in: return None try: - if g.db: v = g.db.query(User).filter_by(id=uid).one_or_none() + if g.db: v = g.db.query(User).filter_by(id=logged_in).one_or_none() else: return None except: return None diff --git a/files/routes/awards.py b/files/routes/awards.py index 11f5f91d0f..24dee9cddf 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -241,6 +241,7 @@ def award_post(pid, v): link = f"[this post]({post.permalink})" send_repeatable_notification(author.id, f"Your account has been suspended permanently for {link}. You must [provide the admins](/contact) a timestamped picture of you touching grass to get unbanned!") send_repeatable_notification(CARP_ID, f"@{v.username} used {kind} award on [{post.shortlink}]({post.shortlink})") + send_repeatable_notification(DAD_ID, f"@{v.username} used {kind} award on [{post.shortlink}]({post.shortlink})") elif kind == "pin": if post.stickied and post.stickied.startswith("t:"): t = int(post.stickied[2:]) + 3600 else: t = int(time.time()) + 3600 @@ -413,6 +414,7 @@ def award_comment(cid, v): link = f"[this comment]({c.permalink})" send_repeatable_notification(author.id, f"Your account has been suspended permanently for {link}. You must [provide the admins](/contact) a timestamped picture of you touching grass to get unbanned!") send_repeatable_notification(CARP_ID, f"@{v.username} used {kind} award on [{c.shortlink}]({c.shortlink})") + send_repeatable_notification(DAD_ID, f"@{v.username} used {kind} award on [{c.shortlink}]({c.shortlink})") elif kind == "pin": if c.is_pinned and c.is_pinned.startswith("t:"): t = int(c.is_pinned[2:]) + 3600 else: t = int(time.time()) + 3600 diff --git a/files/routes/posts.py b/files/routes/posts.py index f4050d34aa..352bb52616 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -771,7 +771,7 @@ def submit_post(v): domain = parsed_url.netloc qd = parse_qs(parsed_url.query) - filtered = dict((k, v) for k, v in qd.items() if not k.startswith('utm_') and not k.startswith('ref_')) + filtered = dict((k, val) for k, val in qd.items() if not k.startswith('utm_') and not k.startswith('ref_')) new_url = ParseResult(scheme="https", netloc=parsed_url.netloc, diff --git a/files/routes/settings.py b/files/routes/settings.py index 7a05df8155..c3e048d780 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -52,7 +52,7 @@ def sex(v): users = g.db.query(User).filter(User.patron > 0, User.patron < 5).all() for u in users: - if not u.email or u.email.lower() not in emails: print(u.username) + if not u.email or u.email.lower() not in emails: print(f'{u.username} - {u.email}') return "sex" diff --git a/files/templates/CHRISTMAS/authforms.html b/files/templates/CHRISTMAS/authforms.html index 0ef68cfd27..e4bec20497 100644 --- a/files/templates/CHRISTMAS/authforms.html +++ b/files/templates/CHRISTMAS/authforms.html @@ -14,11 +14,11 @@ {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} diff --git a/files/templates/CHRISTMAS/default.html b/files/templates/CHRISTMAS/default.html index 67f5fdaf92..a1234f702f 100644 --- a/files/templates/CHRISTMAS/default.html +++ b/files/templates/CHRISTMAS/default.html @@ -186,9 +186,9 @@ {% block stylesheets %} - + - + diff --git a/files/templates/CHRISTMAS/login.html b/files/templates/CHRISTMAS/login.html index b440e3481d..464f53bd07 100644 --- a/files/templates/CHRISTMAS/login.html +++ b/files/templates/CHRISTMAS/login.html @@ -13,9 +13,9 @@ Login - {{'SITE_NAME' | app_config}} {% endblock %} - + - + diff --git a/files/templates/CHRISTMAS/login_2fa.html b/files/templates/CHRISTMAS/login_2fa.html index 8fa4ef088f..680b9c82d2 100644 --- a/files/templates/CHRISTMAS/login_2fa.html +++ b/files/templates/CHRISTMAS/login_2fa.html @@ -13,7 +13,7 @@ 2-Step Login - {{'SITE_NAME' | app_config}} - + diff --git a/files/templates/CHRISTMAS/settings.html b/files/templates/CHRISTMAS/settings.html index 9e8986fe80..a59c4a47b0 100644 --- a/files/templates/CHRISTMAS/settings.html +++ b/files/templates/CHRISTMAS/settings.html @@ -28,9 +28,9 @@ {% block stylesheets %} - + - + diff --git a/files/templates/CHRISTMAS/sign_up.html b/files/templates/CHRISTMAS/sign_up.html index 6abca73929..272e0850b0 100644 --- a/files/templates/CHRISTMAS/sign_up.html +++ b/files/templates/CHRISTMAS/sign_up.html @@ -26,9 +26,9 @@ {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}Sign up - {{'SITE_NAME' | app_config}}{% endif %} - + - + diff --git a/files/templates/CHRISTMAS/sign_up_failed_ref.html b/files/templates/CHRISTMAS/sign_up_failed_ref.html index 6aee3cfbb4..2d6b961afe 100644 --- a/files/templates/CHRISTMAS/sign_up_failed_ref.html +++ b/files/templates/CHRISTMAS/sign_up_failed_ref.html @@ -31,7 +31,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}{{'SITE_NAME' | app_config}}{% endif %} - + diff --git a/files/templates/CHRISTMAS/tailwind.html b/files/templates/CHRISTMAS/tailwind.html index e3e520504c..dbe67a6ac8 100644 --- a/files/templates/CHRISTMAS/tailwind.html +++ b/files/templates/CHRISTMAS/tailwind.html @@ -5,7 +5,7 @@ - + Flask + Tailwind CSS diff --git a/files/templates/authforms.html b/files/templates/authforms.html index 607565bd29..0e868c3671 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -14,11 +14,11 @@ {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} diff --git a/files/templates/default.html b/files/templates/default.html index f18547295e..1a91d77cd2 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -6,12 +6,12 @@ {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} diff --git a/files/templates/log.html b/files/templates/log.html index 9b9391981a..c5ecf71515 100644 --- a/files/templates/log.html +++ b/files/templates/log.html @@ -6,11 +6,11 @@ {% block content %} {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %}
diff --git a/files/templates/login.html b/files/templates/login.html index ad945e3575..dcf5c19966 100644 --- a/files/templates/login.html +++ b/files/templates/login.html @@ -17,7 +17,7 @@ {% endblock %} - + diff --git a/files/templates/login_2fa.html b/files/templates/login_2fa.html index 7a3c08f867..ec2aaf581a 100644 --- a/files/templates/login_2fa.html +++ b/files/templates/login_2fa.html @@ -13,7 +13,7 @@ 2-Step Login - {{'SITE_NAME' | app_config}} - + diff --git a/files/templates/settings.html b/files/templates/settings.html index 2c2541b12c..1a839aa40f 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -33,7 +33,7 @@ - + {% if v.agendaposter %}{% elif v.css %}{% endif %} diff --git a/files/templates/settings2.html b/files/templates/settings2.html index f318e17630..d993886ddb 100644 --- a/files/templates/settings2.html +++ b/files/templates/settings2.html @@ -38,10 +38,10 @@ {% if v %} - + {% else %} - + {% endif %} diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index 6f869f2ed2..5aef16a785 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -30,7 +30,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}Sign up - {{'SITE_NAME' | app_config}}{% endif %} - + diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index abe1f7750b..795db705c1 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -31,7 +31,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}{{'SITE_NAME' | app_config}}{% endif %} - + diff --git a/files/templates/submit.html b/files/templates/submit.html index db1f692561..c93a3133d0 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -25,11 +25,11 @@ {% block stylesheets %} {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} {% endblock %}