diff --git a/files/classes/badges.py b/files/classes/badges.py index c751247d5..596f8ab40 100644 --- a/files/classes/badges.py +++ b/files/classes/badges.py @@ -46,7 +46,7 @@ class Badge(Base): @property @lazy def path(self): - return f"/assets/images/badges/{self.name.replace(' ','%20')}.webp" + return f"/static/assets/images/badges/{self.name.replace(' ','%20')}.webp" @property @lazy diff --git a/files/classes/submission.py b/files/classes/submission.py index e316d82a2..d40ed1146 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -216,11 +216,11 @@ class Submission(Base): @property @lazy def thumb_url(self): - if self.over_18: return f"https://{site}/assets/images/nsfw.webp" - elif not self.url: return f"https://{site}/assets/images/{site_name}/default_text.webp" + if self.over_18: return f"https://{site}/static/assets/images/nsfw.webp" + elif not self.url: return f"https://{site}/static/assets/images/{site_name}/default_text.webp" elif self.thumburl: return self.thumburl - elif "youtu.be" in self.domain or "youtube.com" == self.domain: return f"https://{site}/assets/images/default_thumb_yt.webp" - else: return f"https://{site}/assets/images/default_thumb_link.webp" + elif "youtu.be" in self.domain or "youtube.com" == self.domain: return f"https://{site}/static/assets/images/default_thumb_yt.webp" + else: return f"https://{site}/static/assets/images/default_thumb_link.webp" @property @lazy diff --git a/files/classes/user.py b/files/classes/user.py index cdb9368cf..2ceab63a0 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -272,7 +272,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="/assets/images/loading.webp"', '') + return self.bio_html.replace('data-src', 'src').replace('src="/static/assets/images/loading.webp"', '') @property @lazy @@ -419,16 +419,16 @@ class User(Base): @lazy def banner_url(self): if self.bannerurl: return self.bannerurl - else: return f"https://{site}/assets/images/{site_name}/preview.webp?v=200" + else: return f"https://{site}/static/assets/images/{site_name}/preview.webp?a=200" @property @lazy def profile_url(self): - if self.grincheffect: return f"https://{site}/assets/images/grinch.webp?v=200" - if self.agendaposter: return f"https://{site}/assets/images/defaultpictures/agendaposter/{random.randint(1, 50)}.webp?v=200" + if self.grincheffect: return f"https://{site}/static/assets/images/grinch.webp?a=200" + if self.agendaposter: return f"https://{site}/static/assets/images/defaultpictures/agendaposter/{random.randint(1, 50)}.webp?a=200" if self.profileurl: return self.profileurl - if "rama" in site: return f"https://{site}/assets/images/defaultpictures/{random.randint(1, 150)}.webp?v=200" - return f"https://{site}/assets/images/default-profile-pic.webp" + if "rama" in site: return f"https://{site}/static/assets/images/defaultpictures/{random.randint(1, 150)}.webp?a=200" + return f"https://{site}/static/assets/images/default-profile-pic.webp" @lazy def json_popover(self, v): diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index f98f07bbf..c3bd1d1e8 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -137,7 +137,7 @@ def sanitize(sanitized, noimages=False): tag["class"] = "in-comment-image" tag["loading"] = "lazy" tag["data-src"] = tag["src"] - tag["src"] = "/assets/images/loading.webp" + tag["src"] = "/static/assets/images/loading.webp" tag['alt'] = f'![]({tag["src"]})' link = soup.new_tag("a") @@ -183,8 +183,8 @@ def sanitize(sanitized, noimages=False): classes = 'height=60 class="emoji-md" ' remoji = emoji - if path.isfile(f'files/assets/images/emojis/{remoji}.webp'): - new = re.sub(f'(?', new, flags=re.I) + if path.isfile(f'files/static/assets/images/emojis/{remoji}.webp'): + new = re.sub(f'(?', new, flags=re.I) sanitized = sanitized.replace(old, new) @@ -193,15 +193,15 @@ def sanitize(sanitized, noimages=False): emoji = i.group(1).lower() if emoji.startswith("!"): emoji = emoji[1:] - if path.isfile(f'files/assets/images/emojis/{emoji}.webp'): - sanitized = re.sub(f'(?', sanitized, flags=re.I) + if path.isfile(f'files/static/assets/images/emojis/{emoji}.webp'): + sanitized = re.sub(f'(?', sanitized, flags=re.I) - elif path.isfile(f'files/assets/images/emojis/{emoji}.webp'): - sanitized = re.sub(f'(?', sanitized, flags=re.I) + elif path.isfile(f'files/static/assets/images/emojis/{emoji}.webp'): + sanitized = re.sub(f'(?', sanitized, flags=re.I) - 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.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("m.wikipedia.org", "wikipedia.org").replace("https://m.youtube", "https://youtube") + sanitized = sanitized.replace("https://www.", "https://").replace("https://youtu.be/", "https://youtube.com/watch?a=").replace("https://music.youtube.com/watch?a=", "https://youtube.com/watch?a=").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?a=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("m.wikipedia.org", "wikipedia.org").replace("https://m.youtube", "https://youtube") - if "https://youtube.com/watch?v=" in sanitized: sanitized = sanitized.replace("?t=", "&t=") + if "https://youtube.com/watch?a=" in sanitized: sanitized = sanitized.replace("?t=", "&t=") for i in re.finditer('" target="_blank">(https://youtube\.com/watch\?v\=(.*?))', sanitized): url = i.group(1) @@ -242,11 +242,11 @@ def filter_emojis_only(title): if emoji.startswith("!"): emoji = emoji[1:] - if path.isfile(f'files/assets/images/emojis/{emoji}.webp'): - title = re.sub(f'(?', title, flags=re.I) + if path.isfile(f'files/static/assets/images/emojis/{emoji}.webp'): + title = re.sub(f'(?', title, flags=re.I) - elif path.isfile(f'files/assets/images/emojis/{emoji}.webp'): - title = re.sub(f'(?', title, flags=re.I) + elif path.isfile(f'files/static/assets/images/emojis/{emoji}.webp'): + title = re.sub(f'(?', title, flags=re.I) if len(title) > 1500: abort(400) else: return title \ No newline at end of file diff --git a/files/routes/posts.py b/files/routes/posts.py index a029bcf37..2233b7df9 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -749,7 +749,7 @@ def submit_post(v): for rd in ["https://reddit.com/", "https://new.reddit.com/", "https://www.reddit.com/", "https://redd.it/"]: url = url.replace(rd, "https://old.reddit.com/") - url = url.replace("old.reddit.com/gallery", "new.reddit.com/gallery").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.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("m.wikipedia.org", "wikipedia.org").replace("https://m.youtube", "https://youtube").replace("https://www.youtube", "https://youtube") + url = url.replace("old.reddit.com/gallery", "new.reddit.com/gallery").replace("https://youtu.be/", "https://youtube.com/watch?a=").replace("https://music.youtube.com/watch?a=", "https://youtube.com/watch?a=").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?a=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("m.wikipedia.org", "wikipedia.org").replace("https://m.youtube", "https://youtube").replace("https://www.youtube", "https://youtube") if url.startswith("https://streamable.com/") and not url.startswith("https://streamable.com/e/"): url = url.replace("https://streamable.com/", "https://streamable.com/e/") @@ -785,8 +785,8 @@ def submit_post(v): elif "twitter.com" == domain: try: embed = requests.get("https://publish.twitter.com/oembed", timeout=5, params={"url":url, "omit_script":"t"}).json()["html"] except: embed = None - elif url.startswith('https://youtube.com/watch?v='): - yt_id = url.split('https://youtube.com/watch?v=')[1].split('&')[0].split('%')[0] + elif url.startswith('https://youtube.com/watch?a='): + yt_id = url.split('https://youtube.com/watch?a=')[1].split('&')[0].split('%')[0] params = parse_qs(urlparse(url).query) t = params.get('t', params.get('start', [0]))[0] if isinstance(t, str): t = t.replace('s','') diff --git a/files/routes/settings.py b/files/routes/settings.py index a96f80974..eb3f53c62 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -1046,7 +1046,7 @@ def settings_song_change(v): return redirect("/settings/profile") song = song.replace("https://music.youtube.com", "https://youtube.com") - if song.startswith(("https://www.youtube.com/watch?v=", "https://youtube.com/watch?v=", "https://m.youtube.com/watch?v=")): + if song.startswith(("https://www.youtube.com/watch?a=", "https://youtube.com/watch?a=", "https://m.youtube.com/watch?a=")): id = song.split("v=")[1] elif song.startswith("https://youtu.be/"): id = song.split("https://youtu.be/")[1] @@ -1099,7 +1099,7 @@ def settings_song_change(v): } with youtube_dl.YoutubeDL(ydl_opts) as ydl: - try: ydl.download([f"https://youtube.com/watch?v={id}"]) + try: ydl.download([f"https://youtube.com/watch?a={id}"]) except Exception as e: print(e) if not v or v.oldsite: template = '' diff --git a/files/routes/static.py b/files/routes/static.py index 4c90ed5d4..e020235e2 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -15,7 +15,7 @@ site_name = environ.get("SITE_NAME").strip() @app.get("/emojis") @auth_desired def emojis(v): - emojis = (x.replace('.webp','') for x in os.listdir("files/assets/images/emojis")) + emojis = (x.replace('.webp','') for x in os.listdir("files/static/assets/images/emojis")) if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}emojis.html", v=v, emojis=emojis) @@ -235,9 +235,9 @@ def log_item(id, v): else: template = 'CHRISTMAS/' return render_template(f"{template}log.html", v=v, actions=[action], next_exists=False, page=1, action=action, admins=admins, types=types) -@app.get("/assets/favicon.ico") +@app.get("/static/assets/favicon.ico") def favicon(): - return send_file(f"./assets/images/{site_name}/icon.webp?v=200") + return send_file(f"./static/assets/images/{site_name}/icon.webp?a=200") @app.get("/api") @auth_desired @@ -388,7 +388,7 @@ def formatting(v): @app.get("/service-worker.js") def serviceworker(): - with open("files/assets/js/service-worker.js", "r") as f: return Response(f.read(), mimetype='application/javascript') + with open("files/static/assets/js/service-worker.js", "r") as f: return Response(f.read(), mimetype='application/javascript') @app.get("/settings/security") @auth_required diff --git a/files/templates/admin/badge_grant.html b/files/templates/admin/badge_grant.html index dd285ad6b..dea5f4bc9 100644 --- a/files/templates/admin/badge_grant.html +++ b/files/templates/admin/badge_grant.html @@ -60,7 +60,7 @@ - + {{v['name']}} {{v['description']}} diff --git a/files/templates/authforms.html b/files/templates/authforms.html index 432633dac..4669f35ed 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -14,11 +14,11 @@ {% if v %} - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} @@ -90,7 +90,7 @@
- + diff --git a/files/templates/award_modal.html b/files/templates/award_modal.html index f740aec4f..2164ec4a6 100644 --- a/files/templates/award_modal.html +++ b/files/templates/award_modal.html @@ -1,4 +1,4 @@ - + diff --git a/files/templates/message_success.html b/files/templates/message_success.html index 9d53df323..a85960f1a 100644 --- a/files/templates/message_success.html +++ b/files/templates/message_success.html @@ -9,7 +9,7 @@ {% block content %}
- success state + success state
{{title}}

{{text}}

diff --git a/files/templates/mobile_navigation_bar.html b/files/templates/mobile_navigation_bar.html index c68a2fde9..a74583575 100644 --- a/files/templates/mobile_navigation_bar.html +++ b/files/templates/mobile_navigation_bar.html @@ -68,7 +68,7 @@
- + - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} - + - + {% include "header.html" %}
@@ -239,7 +239,7 @@ {% block onload %}{% endblock %} - + - + {% else %} - + {% endif %} - + - + {% include "header.html" %} diff --git a/files/templates/settings_blocks.html b/files/templates/settings_blocks.html index 28fe70f09..0595c6abd 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 10b6c22db..e0ac900db 100644 --- a/files/templates/settings_profile.html +++ b/files/templates/settings_profile.html @@ -701,7 +701,7 @@
- + {% include "emoji_modal.html" %} {% include "gif_modal.html" %} diff --git a/files/templates/settings_security.html b/files/templates/settings_security.html index 57a4a4f7e..6a7a24e1b 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 9859f5ceb..6d8c4ea4d 100644 --- a/files/templates/shop.html +++ b/files/templates/shop.html @@ -8,7 +8,7 @@ {% block Banner %}
- +

Stir drama. Earn coins.

Total sales: {{sales}} coins
Dramacoins spent by you: {{v.coins_spent}} coins
diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index 75fbb6492..5bec42dd3 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -4,7 +4,7 @@ - + @@ -13,7 +13,7 @@ - + @@ -24,13 +24,13 @@ - + {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}Sign up - {{'SITE_NAME' | app_config}}{% endif %} - + @@ -140,7 +140,7 @@
- +
@@ -148,10 +148,10 @@ - + {% if hcaptcha %} - + {% endif %} diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index ddc5261a9..b56d6c4c2 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -5,7 +5,7 @@ - + @@ -14,7 +14,7 @@ - + @@ -25,13 +25,13 @@ - + {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}{{'SITE_NAME' | app_config}}{% endif %} - + @@ -83,7 +83,7 @@
- + diff --git a/files/templates/submission.html b/files/templates/submission.html index 9cf0341ab..d1e6eb732 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -87,19 +87,19 @@ } - + {% endif %} {% if p.award_count("train") > 1 %} - + {% endif %} {% if p.award_count("train") > 2 %} - + {% endif %} {% if p.award_count("train") > 3 %} - + {% endif %} @@ -116,7 +116,7 @@ - + {% if p.url and (p.url.lower().endswith('.mp4') or p.url.lower().endswith('.webm')) %} {% endif %} @@ -128,7 +128,7 @@ - + {% if linked_comment.author.is_private %} @@ -145,7 +145,7 @@ {% if p.author %}{% endif %} - + {% if p.url and (p.url.lower().endswith('.mp4') or p.url.lower().endswith('.webm')) %} {% endif %} @@ -157,7 +157,7 @@ {% if p.author %}{% endif %} - + {% if p.author.is_private %} @@ -337,7 +337,7 @@ {% if p.active_flags %}{{p.active_flags}} Reports{% endif %} {% if p.author.verified %} {% endif %} - {{p.author.username}}{% if p.author.customtitle %}  {% if p.author.quadrant %}{% endif %}{{p.author.customtitle | safe}}{% endif %} + {{p.author.username}}{% if p.author.customtitle %}  {% if p.author.quadrant %}{% endif %}{{p.author.customtitle | safe}}{% endif %}  {{p.age_string}} ({% if p.is_image %}image post{% elif p.is_video %}video post{% elif p.realurl(v) %}{{p.domain}}{% else %}text post{% endif %}) @@ -388,9 +388,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(' {% if offset %} - + {% endif %} {% elif not p.replies and p.deleted_utc == 0 %} @@ -810,32 +810,32 @@ {% endif %} {% if v and (v.id == p.author_id or v.admin_level > 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 c753371e2..3668db471 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 %} - - \ No newline at end of file + + + \ No newline at end of file diff --git a/files/templates/submit.html b/files/templates/submit.html index db9ceb0d3..8d11dba55 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -3,13 +3,13 @@ - + - + {% if request.host == 'pcmemes.net' %} {% set cc='Splash Mountain' %} @@ -25,18 +25,18 @@ {% block stylesheets %} {% if v %} - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - - + + {% endif %} {% endblock %} - + - + {% include "header.html" %} @@ -175,9 +175,9 @@ {% endblock %} - - - + + + {% include "emoji_modal.html" %} diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 98a3222ff..ff1ec078c 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -97,7 +97,7 @@ - {% if u.customtitle %}

{% if u.quadrant %}{% endif %}{{u.customtitle | safe}}

+ {% if u.customtitle %}

{% if u.quadrant %}{% endif %}{{u.customtitle | safe}}

{% else %}

 				{% endif %}
 
@@ -105,10 +105,10 @@
 
 				
{{u.coins}} -    +    {{u.procoins}} -    +    {% if u.stored_subscriber_count >=1 and not u.is_nofollow %}{{u.stored_subscriber_count}} follower{{'s' if u.stored_subscriber_count != 1 else ''}}   {% endif %} joined {{u.created_date}} @@ -367,7 +367,7 @@ {% if v and v.has_follower(u) and not v.is_nofollow %} Follows you {% endif %} - {% if u.customtitle %}

{% if u.quadrant %}{% endif %}{{u.customtitle | safe}}

+ {% if u.customtitle %}

{% if u.quadrant %}{% endif %}{{u.customtitle | safe}}

{% else %}

 				{% endif %}
@@ -376,10 +376,10 @@
 				
 				
{{u.coins}} -    +    {{u.procoins}} -    +    {% if u.stored_subscriber_count >=1 and not u.is_nofollow %}{{u.stored_subscriber_count}} follower{{'s' if u.stored_subscriber_count != 1 else ''}}   {% endif %} {% if u.basedcount %} @@ -688,11 +688,11 @@ {% if v %}
{% if v.patron or u.patron %}0{% else %}0.03{% endif %}
- +
{{u.username}}
{% endif %} - + {% endblock %} diff --git a/files/templates/userpage_comments.html b/files/templates/userpage_comments.html index 528274d8e..ec44aaced 100644 --- a/files/templates/userpage_comments.html +++ b/files/templates/userpage_comments.html @@ -110,9 +110,9 @@ {% if v %}
{% if v.patron or u.patron %}0{% else %}0.03{% endif %}
- +
{{u.username}}
{% endif %} - + {% endblock %} \ No newline at end of file diff --git a/files/templates/userpage_private.html b/files/templates/userpage_private.html index c81bd3d82..f49edc6c4 100644 --- a/files/templates/userpage_private.html +++ b/files/templates/userpage_private.html @@ -44,9 +44,9 @@ {% if v %}
{% if v.patron or u.patron %}0{% else %}0.03{% endif %}
- +
{{u.username}}
{% endif %} - + {% endblock %} \ No newline at end of file