From b538d2a24cf942679f0b25e8e267ea276a10d633 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 31 Mar 2022 18:28:53 +0200 Subject: [PATCH] gdfg --- files/classes/badges.py | 2 +- files/classes/sub.py | 4 +- files/classes/submission.py | 8 +- files/classes/user.py | 6 +- files/helpers/sanitize.py | 2 +- files/routes/comments.py | 2 +- files/routes/static.py | 7 -- files/routes/users.py | 2 +- files/templates/admin/badge_grant.html | 2 +- files/templates/admin/badge_remove.html | 2 +- files/templates/admins.html | 2 +- files/templates/authforms.html | 8 +- files/templates/award_modal.html | 2 +- files/templates/badges.html | 2 +- files/templates/ban_modal.html | 2 +- files/templates/changelog.html | 2 +- files/templates/chat.html | 14 ++-- files/templates/comments.html | 14 ++-- files/templates/default.html | 96 +++++++++++----------- files/templates/delete_post_modal.html | 2 +- files/templates/emoji_modal.html | 2 +- files/templates/followers.html | 2 +- files/templates/following.html | 2 +- files/templates/gif_modal.html | 2 +- files/templates/header.html | 12 +-- files/templates/home.html | 4 +- files/templates/log.html | 8 +- files/templates/login.html | 8 +- files/templates/login_2fa.html | 4 +- files/templates/message_success.html | 2 +- files/templates/mobile_navigation_bar.html | 2 +- files/templates/patrons.html | 2 +- files/templates/report_post_modal.html | 2 +- files/templates/settings.html | 16 ++-- files/templates/settings2.html | 16 ++-- files/templates/settings_blocks.html | 2 +- files/templates/settings_profile.html | 2 +- files/templates/settings_security.html | 2 +- files/templates/shop.html | 2 +- files/templates/sidebar_Drama.html | 2 +- files/templates/sidebar_PCM.html | 2 +- files/templates/sign_up.html | 14 ++-- files/templates/sign_up_failed_ref.html | 10 +-- files/templates/sub/subs.html | 2 +- files/templates/submission.html | 52 ++++++------ files/templates/submission_listing.html | 10 +-- files/templates/submit.html | 20 ++--- files/templates/userpage.html | 14 ++-- files/templates/userpage_comments.html | 4 +- files/templates/userpage_private.html | 4 +- snappy_Drama.txt | 16 ++-- snappy_PCM.txt | 12 +-- 52 files changed, 214 insertions(+), 221 deletions(-) diff --git a/files/classes/badges.py b/files/classes/badges.py index 856e65c35..12db64cf4 100644 --- a/files/classes/badges.py +++ b/files/classes/badges.py @@ -61,7 +61,7 @@ class Badge(Base): @property @lazy def path(self): - return f"{SITE_FULL}/static/assets/images/badges/{self.badge_id}.webp" + return f"{SITE_FULL}/assets/images/badges/{self.badge_id}.webp" @property @lazy diff --git a/files/classes/sub.py b/files/classes/sub.py index 68b55f186..4aec6d6db 100644 --- a/files/classes/sub.py +++ b/files/classes/sub.py @@ -32,13 +32,13 @@ class Sub(Base): @lazy def sidebar_url(self): if self.sidebarurl: return SITE_FULL + self.sidebarurl - return f'{SITE_FULL}/static/assets/images/{SITE_NAME}/sidebar.webp?v=1041' + return f'{SITE_FULL}/assets/images/{SITE_NAME}/sidebar.webp?v=1041' @property @lazy def banner_url(self): if self.bannerurl: return SITE_FULL + self.bannerurl - return f'{SITE_FULL}/static/assets/images/{SITE_NAME}/banner.webp?v=1042' + return f'{SITE_FULL}/assets/images/{SITE_NAME}/banner.webp?v=1042' @property @lazy diff --git a/files/classes/submission.py b/files/classes/submission.py index c06ff1fad..958b4ef67 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -249,13 +249,13 @@ class Submission(Base): @property @lazy def thumb_url(self): - if self.over_18: return f"{SITE_FULL}/static/assets/images/nsfw.webp?v=1" - elif not self.url: return f"{SITE_FULL}/static/assets/images/{SITE_NAME}/default_text.webp?v=1" + if self.over_18: return f"{SITE_FULL}/assets/images/nsfw.webp?v=1" + elif not self.url: return f"{SITE_FULL}/assets/images/{SITE_NAME}/default_text.webp?v=1" elif self.thumburl: if self.thumburl.startswith('/'): return SITE_FULL + self.thumburl return self.thumburl - elif self.is_youtube or self.is_video: return f"{SITE_FULL}/static/assets/images/default_thumb_yt.webp?v=1" - else: return f"{SITE_FULL}/static/assets/images/default_thumb_link.webp?v=1" + elif self.is_youtube or self.is_video: return f"{SITE_FULL}/assets/images/default_thumb_yt.webp?v=1" + else: return f"{SITE_FULL}/assets/images/default_thumb_link.webp?v=1" @property @lazy diff --git a/files/classes/user.py b/files/classes/user.py index 8e4cc0a24..aeb643732 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -312,7 +312,7 @@ class User(Base): @lazy def bio_html_eager(self): if self.bio_html == None: return '' - return self.bio_html.replace('data-src', 'src').replace('src="/static/assets/images/loading.webp"', '') + return self.bio_html.replace('data-src', 'src').replace('src="/assets/images/loading.webp"', '') @property @lazy @@ -470,7 +470,7 @@ class User(Base): @lazy def banner_url(self): if self.bannerurl: return self.bannerurl - else: return f"{SITE_FULL}/static/assets/images/{SITE_NAME}/site_preview.webp?v=1013" + else: return f"{SITE_FULL}/assets/images/{SITE_NAME}/site_preview.webp?v=1013" @property @lazy @@ -479,7 +479,7 @@ class User(Base): if self.profileurl: if self.profileurl.startswith('/'): return SITE_FULL + self.profileurl return self.profileurl - return f"{SITE_FULL}/static/assets/images/default-profile-pic.webp?v=1008" + return f"{SITE_FULL}/assets/images/default-profile-pic.webp?v=1008" @lazy def json_popover(self, v): diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 7c999a1ee..7de9991a9 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -181,7 +181,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False): tag["class"] = "img" tag["loading"] = "lazy" tag["data-src"] = tag["src"] - tag["src"] = "/static/assets/images/loading.webp" + tag["src"] = "/assets/images/loading.webp" tag['alt'] = f'![]({tag["data-src"]})' tag["onclick"] = "expandDesktopImage(this.src);" tag["data-bs-toggle"] = "modal" diff --git a/files/routes/comments.py b/files/routes/comments.py index 6cc5d60c8..b1b2b89a5 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -261,7 +261,7 @@ def api_comment(v): filename = f'files/assets/images/badges/{badge.id}.webp' copyfile(oldname, filename) process_image(filename, 200) - requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"https://{request.host}/static/assets/images/badges/{badge.id}.webp"]}, timeout=5) + requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"https://{request.host}/assets/images/badges/{badge.id}.webp"]}, timeout=5) except Exception as e: return {"error": str(e)}, 400 elif v.admin_level > 2 and parent_post.id == 37838: diff --git a/files/routes/static.py b/files/routes/static.py index 7836e77a0..6dbdc234a 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -270,13 +270,6 @@ def log_item(id, v): return render_template("log.html", v=v, actions=[action], next_exists=False, page=1, action=action, admins=admins, types=types) -@app.get("/static/assets/favicon.ico") -def favicon(): - try: f = send_file(f"./assets/images/{SITE_NAME}/icon.webp") - except: - print('/static/assets/favicon.ico', flush=True) - abort(404) - return f @app.get("/api") @auth_required diff --git a/files/routes/users.py b/files/routes/users.py index 523f01014..bba923b9a 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -554,7 +554,7 @@ def get_profilecss(username): @app.get("/@/song") def usersong(username): user = get_user(username) - if user.song: return redirect(f"{SITE_FULL}/static/song/{user.song}.mp3") + if user.song: return redirect(f"{SITE_FULL}/song/{user.song}.mp3") else: abort(404) @app.get("/song/") diff --git a/files/templates/admin/badge_grant.html b/files/templates/admin/badge_grant.html index 984f49222..a239e8c40 100644 --- a/files/templates/admin/badge_grant.html +++ b/files/templates/admin/badge_grant.html @@ -60,7 +60,7 @@ - + {{badge.name}} {{badge.description}} diff --git a/files/templates/admin/badge_remove.html b/files/templates/admin/badge_remove.html index 9c1be65a0..5e5df13bb 100644 --- a/files/templates/admin/badge_remove.html +++ b/files/templates/admin/badge_remove.html @@ -60,7 +60,7 @@ - + {{badge.name}} {{badge.description}} diff --git a/files/templates/admins.html b/files/templates/admins.html index da193b3fa..83207579b 100644 --- a/files/templates/admins.html +++ b/files/templates/admins.html @@ -4,7 +4,7 @@ {% block content %} - +

 
Admins
diff --git a/files/templates/authforms.html b/files/templates/authforms.html index b820d73f6..a48c1dc6c 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -15,11 +15,11 @@ {% if v %} - + {% if v.agendaposter %} - + {% endif %} @@ -110,7 +110,7 @@
- cover + cover diff --git a/files/templates/award_modal.html b/files/templates/award_modal.html index 1d3a81cee..70c5db047 100644 --- a/files/templates/award_modal.html +++ b/files/templates/award_modal.html @@ -1,4 +1,4 @@ - + - + {% if v and not err %}
{{v.formkey}}
diff --git a/files/templates/home.html b/files/templates/home.html index 08521d77d..99880ae11 100644 --- a/files/templates/home.html +++ b/files/templates/home.html @@ -19,7 +19,7 @@ script.onload = resolve; script.onerror = reject; script.async = true; - script.src = "/static/assets/js/fp.js?v=240"; + script.src = "/assets/js/fp.js?v=240"; document.head.appendChild(script); }) .then(() => FingerprintJS.load({token: '{{environ.get("FP")}}'})); @@ -244,7 +244,7 @@ {% if PUSHER_ID != 'blahblahblah' and v %}
{{request.host}}{{v.id}}
{{PUSHER_ID}}
- + + {% endblock %} \ No newline at end of file diff --git a/files/templates/login.html b/files/templates/login.html index ef40d9ce7..22b55ffb1 100644 --- a/files/templates/login.html +++ b/files/templates/login.html @@ -6,7 +6,7 @@ - + @@ -18,8 +18,8 @@ {% endblock %} - - + + @@ -116,7 +116,7 @@
- cover + cover diff --git a/files/templates/login_2fa.html b/files/templates/login_2fa.html index 30df0198d..b38cbc5d7 100644 --- a/files/templates/login_2fa.html +++ b/files/templates/login_2fa.html @@ -14,7 +14,7 @@ 2-Step Login - {{SITE_NAME}} - + @@ -92,7 +92,7 @@
- cover + cover diff --git a/files/templates/message_success.html b/files/templates/message_success.html index 31643bf92..018adfb50 100644 --- a/files/templates/message_success.html +++ b/files/templates/message_success.html @@ -9,7 +9,7 @@ {% block content %}
- success state + success state
{{title}}

{{message}}

diff --git a/files/templates/mobile_navigation_bar.html b/files/templates/mobile_navigation_bar.html index 77e96d49b..905249a45 100644 --- a/files/templates/mobile_navigation_bar.html +++ b/files/templates/mobile_navigation_bar.html @@ -76,4 +76,4 @@
- \ No newline at end of file + \ No newline at end of file diff --git a/files/templates/patrons.html b/files/templates/patrons.html index dbdc0cbe8..393ca1cea 100644 --- a/files/templates/patrons.html +++ b/files/templates/patrons.html @@ -14,7 +14,7 @@ {{loop.index}} {{u.username}} - 2{{u.patron}} + 2{{u.patron}} {% endfor %} diff --git a/files/templates/report_post_modal.html b/files/templates/report_post_modal.html index b1188d8b5..1147e340c 100644 --- a/files/templates/report_post_modal.html +++ b/files/templates/report_post_modal.html @@ -32,4 +32,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/files/templates/settings.html b/files/templates/settings.html index f6f0b1ef2..a0624f4e8 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -5,20 +5,20 @@ - + - + {% block pagetitle %}Settings - {{SITE_NAME}}{% endblock %} - + @@ -29,16 +29,16 @@ - + - + {% if v.agendaposter %} - + {% else %} - + {% endif %} - + {% include "header.html" %} diff --git a/files/templates/settings_blocks.html b/files/templates/settings_blocks.html index b9c464ecb..740dcd35e 100644 --- a/files/templates/settings_blocks.html +++ b/files/templates/settings_blocks.html @@ -4,7 +4,7 @@ {% block content %} - +
diff --git a/files/templates/settings_profile.html b/files/templates/settings_profile.html index 7a7a9e476..9ae0710dd 100644 --- a/files/templates/settings_profile.html +++ b/files/templates/settings_profile.html @@ -689,7 +689,7 @@
- + {% include "emoji_modal.html" %} {% include "gif_modal.html" %} diff --git a/files/templates/settings_security.html b/files/templates/settings_security.html index 76058b1a5..4f9f57522 100644 --- a/files/templates/settings_security.html +++ b/files/templates/settings_security.html @@ -4,7 +4,7 @@ {% block content %} - +
diff --git a/files/templates/shop.html b/files/templates/shop.html index 8af1ab488..3f2a692a4 100644 --- a/files/templates/shop.html +++ b/files/templates/shop.html @@ -8,7 +8,7 @@ {% block Banner %}
- shop banner + shop banner

Stir drama. Earn coins.

Total sales: {{sales}} coins
Coins spent by you: {{v.coins_spent}} coins
diff --git a/files/templates/sidebar_Drama.html b/files/templates/sidebar_Drama.html index 098523f54..85fc7ce91 100644 --- a/files/templates/sidebar_Drama.html +++ b/files/templates/sidebar_Drama.html @@ -4,7 +4,7 @@ {% set image=sub.sidebar_url %} {% else %} {% set path = "assets/images/" + SITE_NAME + "/sidebar" %} - {% set image = "/static/" + path + "/" + listdir('files/' + path)|random() + '?v=38' %} + {% set image = "/" + path + "/" + listdir('files/' + path)|random() + '?v=38' %} {% endif %} sidebar image diff --git a/files/templates/sidebar_PCM.html b/files/templates/sidebar_PCM.html index 636e5c155..3fea27d9b 100644 --- a/files/templates/sidebar_PCM.html +++ b/files/templates/sidebar_PCM.html @@ -39,7 +39,7 @@ {% if sub %} {% set image=sub.sidebar_url %} {% else %} - {% set image='/static/assets/images/' + SITE_NAME + '/sidebar.webp?v=1041' %} + {% set image='/assets/images/' + SITE_NAME + '/sidebar.webp?v=1041' %} {% endif %} sidebar image diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index 4f59838aa..5b3a5c029 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -5,7 +5,7 @@ - + @@ -14,7 +14,7 @@ - + @@ -25,13 +25,13 @@ - + {% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}Sign up - {{SITE_NAME}}{% endif %} - + @@ -145,7 +145,7 @@
- cover + cover
@@ -153,10 +153,10 @@ - + {% if hcaptcha %} - + {% endif %} diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index 5c2c4a112..471e34b59 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -6,7 +6,7 @@ - + @@ -15,7 +15,7 @@ - + @@ -26,13 +26,13 @@ - + {% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %} - + @@ -83,7 +83,7 @@
- cover + cover diff --git a/files/templates/sub/subs.html b/files/templates/sub/subs.html index f068014dd..3ebb9ccdd 100644 --- a/files/templates/sub/subs.html +++ b/files/templates/sub/subs.html @@ -1,6 +1,6 @@ {% extends "default.html" %} {% block content %} - +
 
diff --git a/files/templates/submission.html b/files/templates/submission.html
index f6baac16b..1b2e2d1cf 100644
--- a/files/templates/submission.html
+++ b/files/templates/submission.html
@@ -152,7 +152,7 @@
 			}
 		
 		
- Blade's toe + Blade's toe
{% if p.award_count("toe") > 1 %} @@ -163,7 +163,7 @@ }
- Blade's toe + Blade's toe
{% endif %} @@ -175,7 +175,7 @@ }
- Blade's toe + Blade's toe
{% endif %} @@ -187,7 +187,7 @@ }
- Blade's toe + Blade's toe
{% endif %} {% endif %} @@ -268,7 +268,7 @@
- Blade's toe + Blade's toe
@@ -276,7 +276,7 @@ {% if p.award_count("toe") > 1 %} - Blade's toe + Blade's toe {% endif %} @@ -284,7 +284,7 @@ {% if p.award_count("toe") > 2 %} - Blade's toe + Blade's toe {% endif %} @@ -292,7 +292,7 @@ {% if p.award_count("toe") > 3 %} - Blade's toe + Blade's toe {% endif %} @@ -395,24 +395,24 @@ - croag + croag {% if p.award_count("croag") > 1 %} - croag + croag {% endif %} {% if p.award_count("croag") > 2 %} - croag + croag {% endif %} {% if p.award_count("croag") > 3 %} - croag + croag {% endif %} {% endif %} @@ -496,7 +496,7 @@ - + {% if p.is_video %} {% endif %} @@ -508,7 +508,7 @@ - + {% else %} @@ -521,7 +521,7 @@ {% if p.author %}{% endif %} - + {% if p.url and p.is_video %} {% endif %} @@ -533,7 +533,7 @@ {% if p.author %}{% endif %} - + {% endif %} @@ -694,9 +694,9 @@ {% if p.domain == "twitter.com" %} {{p.embed_url | safe}} {% if v and v.theme.split("_")[0] in ["light", "coffee", "4chan"] %} - + {% else %} - + {% endif %} {% elif p.domain in ['youtu.be','youtube.com'] and p.embed_url and p.embed_url.startswith(' 1 and v.admin_level > 2) %} - + {% endif %} {% if v %} - + {% endif %} {% if not v or v.highlightcomments %} - + {% endif %} - + {% if not p.comment_count %} {% include "comments.html" %} {% endif %} {% if p.award_count("shit") %} - - + + {% endif %} {% if p.award_count("fireflies") %} - - + + {% endif %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 106512a61..31c594ca8 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -9,7 +9,7 @@ {% endif %} {% if not v or v.highlightcomments %} - + {% endif %}