Replace nearly all ?v= cachebusts with assetcache.

Using the new assetcache module, we replace (almost) all instances
of `?v=` cachebusting query parameters in Python and in Jinja templates.
The primary exceptions were: user site backgrounds, and some
infrequently changed graphics referenced literally from .js files.
This commit is contained in:
TLSM 2022-08-30 17:02:46 -04:00
parent 6f3b995455
commit a35697e55e
No known key found for this signature in database
GPG key ID: E745A82778055C7E
44 changed files with 203 additions and 191 deletions

View file

@ -19,6 +19,7 @@ from .exiles import *
from .sub_block import *
from files.__main__ import app, Base, cache
from files.helpers.security import *
from files.helpers.assetcache import assetcache_path
import random
from datetime import datetime
from os import environ, remove, path
@ -528,16 +529,18 @@ class User(Base):
@property
@lazy
def banner_url(self):
if self.bannerurl: return self.bannerurl
else: return f"/assets/images/{SITE_ID}/site_preview.webp?v=1015"
if self.bannerurl:
return self.bannerurl
return assetcache_path(f'images/{SITE_ID}/site_preview.webp')
@property
@lazy
def profile_url(self):
if self.profileurl:
if self.profileurl.startswith('/'): return SITE_FULL + self.profileurl
if self.profileurl.startswith('/'):
return SITE_FULL + self.profileurl
return self.profileurl
return f"{SITE_FULL}/assets/images/default-profile-pic.webp?v=1008"
return assetcache_path('images/default-profile-pic.webp')
@lazy
def json_popover(self, v):