diff --git a/files/helpers/jinja2.py b/files/helpers/jinja2.py index 8c7b14792..63b960a29 100644 --- a/files/helpers/jinja2.py +++ b/files/helpers/jinja2.py @@ -22,6 +22,12 @@ def template_asset(asset_path): return assetcache_path(asset_path) +@app.template_filter("asset_siteimg") +def template_asset_siteimg(asset_path): + # TODO: Add hashing for these using files.helpers.assetcache + return f'/i/{SITE_NAME}/{asset_path}?v=3010' + + @app.template_filter("timestamp") def timestamp(timestamp): diff --git a/files/templates/authforms.html b/files/templates/authforms.html index 9703a6baa..f8e49e068 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -1,4 +1,3 @@ -{%- from 'util/assetcache.html' import asset, asset_siteimg with context -%} {%- import 'util/helpers.html' as help -%} @@ -12,7 +11,7 @@ - + {% block pagetitle %}{{SITE_NAME}}{% endblock %} @@ -107,7 +106,7 @@
- cover + cover diff --git a/files/templates/chat.html b/files/templates/chat.html index bc103f8c7..3ebee27f9 100644 --- a/files/templates/chat.html +++ b/files/templates/chat.html @@ -1,4 +1,3 @@ -{%- from 'util/assetcache.html' import asset, asset_siteimg with context -%} {%- import 'util/helpers.html' as help -%} @@ -10,7 +9,7 @@ - + Chat diff --git a/files/templates/comments.html b/files/templates/comments.html index 7166bff2f..8bae90f06 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -1,4 +1,3 @@ -{%- from 'util/assetcache.html' import asset, asset_siteimg with context -%} {%- import 'util/helpers.html' as help -%} {% if not request.headers.get("xhr") %} {% if comment_info %} diff --git a/files/templates/default.html b/files/templates/default.html index 911beee36..3a40b03d5 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -1,4 +1,3 @@ -{%- from 'util/assetcache.html' import asset, asset_siteimg with context -%} {%- import 'util/helpers.html' as help -%} @@ -78,16 +77,16 @@ - + - + {% block title %} {{SITE_NAME}} - + @@ -97,7 +96,7 @@ - + {% endblock %} @@ -106,10 +105,10 @@ - + - - + + @@ -121,127 +120,127 @@ {% block fixedMobileBarJS %} @@ -277,20 +276,20 @@ {% else %} {% set path = "assets/images/" + SITE_NAME + "/banners" %} {% set image = "/" + path + "/" + listdir('files/' + path)|random() + '?v=25' %} - site banner + site banner {% endif %} {% else %} {% if SITE_NAME == 'WPD' %} {% if v %} - {% set banner = asset_siteimg('banner.webp') %} + {% set banner = 'banner.webp' | asset_siteimg %} {% else %} - {% set banner = asset_siteimg('cached.webp') %} + {% set banner = 'cached.webp' | asset_siteimg %} {% endif %} {% elif SITE_NAME == 'PCM' %} - {% set banner = asset_siteimg('banners/great-value-v2.webp') %} + {% set banner = 'banners/great-value-v2.webp' | asset_siteimg %} {% else %} - {% set banner = asset_siteimg('banner.webp') %} + {% set banner = 'banner.webp' | asset_siteimg %} {% endif %} diff --git a/files/templates/header.html b/files/templates/header.html index 2d5fbfd44..93589d8fa 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -59,7 +59,7 @@ diff --git a/files/templates/lottery.html b/files/templates/lottery.html index 28022c403..420030cc6 100644 --- a/files/templates/lottery.html +++ b/files/templates/lottery.html @@ -62,7 +62,7 @@ data-bs-toggle="tooltip" data-bs-placement="bottom" height="13" - src="{{asset_siteimg('coins.webp')}}" + src="{{'coins.webp' | asset_siteimg}}" aria-label="coins" title="coins" style="display: none; position: relative; top: -2px" @@ -122,7 +122,7 @@ data-bs-toggle="tooltip" data-bs-placement="bottom" height="13" - src="{{asset_siteimg('coins.webp')}}" + src="{{'coins.webp' | asset_siteimg}}" aria-label="coins" title="coins" /> diff --git a/files/templates/settings.html b/files/templates/settings.html index a70b2e109..705062762 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -1,4 +1,3 @@ -{%- from 'util/assetcache.html' import asset, asset_siteimg with context -%} {%- import 'util/helpers.html' as help -%} @@ -13,13 +12,13 @@ - + {% block pagetitle %}Settings - {{SITE_NAME}}{% endblock %} - + @@ -29,7 +28,7 @@ - + diff --git a/files/templates/settings2.html b/files/templates/settings2.html index cc3ddb338..34f96d022 100644 --- a/files/templates/settings2.html +++ b/files/templates/settings2.html @@ -1,4 +1,3 @@ -{%- from 'util/assetcache.html' import asset, asset_siteimg with context -%} {%- import 'util/helpers.html' as help -%} @@ -13,13 +12,13 @@ - - + + - + @@ -29,7 +28,7 @@ - + diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index a006baa28..71b81596f 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -1,11 +1,10 @@ -{%- from 'util/assetcache.html' import asset, asset_siteimg with context -%} {%- import 'util/helpers.html' as help -%} - + @@ -17,7 +16,7 @@ - + @@ -27,7 +26,7 @@ - + {% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}Sign up - {{SITE_NAME}}{% endif %} @@ -132,7 +131,7 @@
- cover + cover diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index cf223c569..6a973b955 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -1,4 +1,3 @@ -{%- from 'util/assetcache.html' import asset, asset_siteimg with context -%} {%- import 'util/helpers.html' as help -%} @@ -6,7 +5,7 @@ - + @@ -18,7 +17,7 @@ - + @@ -28,7 +27,7 @@ - + {% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %} @@ -75,7 +74,7 @@
- cover + cover diff --git a/files/templates/submission.html b/files/templates/submission.html index 4353d0e04..f9d7b1494 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -511,13 +511,13 @@ {% if not v_forbid_deleted -%} - + {% if p.is_video %} {% elif p.is_audio %} {% endif %} - + {% endif %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 726233b36..76254ac42 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -1,4 +1,3 @@ -{%- from 'util/assetcache.html' import asset, asset_siteimg with context -%} {%- import 'util/helpers.html' as help -%} {% if v %} diff --git a/files/templates/submit.html b/files/templates/submit.html index eab29179b..6ff61d9a8 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -1,4 +1,3 @@ -{%- from 'util/assetcache.html' import asset, asset_siteimg with context -%} {%- import 'util/helpers.html' as help -%} @@ -12,7 +11,7 @@ - + {% if SITE == 'pcmemes.net' %} {% set cc='Splash Mountain' %} diff --git a/files/templates/userpage.html b/files/templates/userpage.html index f2c33d806..3e4c51035 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -130,7 +130,7 @@
{{u.coins}} - coins   + coins   {% if FEATURES['PROCOINS'] %} {{u.procoins}} @@ -465,7 +465,7 @@
{{u.coins}} - coins   + coins   {% if FEATURES['PROCOINS'] %} {{u.procoins}} diff --git a/files/templates/util/assetcache.html b/files/templates/util/assetcache.html deleted file mode 100644 index c5467fb98..000000000 --- a/files/templates/util/assetcache.html +++ /dev/null @@ -1,3 +0,0 @@ -{%- macro asset_siteimg(name) -%} - /i/{{SITE_NAME}}/{{name}}?v=3009 -{%- endmacro -%}