1
0
mirror of https://git.sr.ht/~tsileo/microblog.pub synced 2025-06-05 21:59:23 +02:00

Invalidate CSS cache when updated

This commit is contained in:
Thomas Sileo
2022-08-13 15:35:39 +02:00
parent 59688ad5f6
commit ce80e98d33
3 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,4 @@
import hashlib
import os
import secrets
from pathlib import Path
@ -25,6 +26,14 @@ try:
except ImportError:
pass
# Force reloading cache when the CSS is updated
CSS_HASH = "none"
try:
css_data = (ROOT_DIR / "app" / "static" / "css" / "main.css").read_bytes()
CSS_HASH = hashlib.md5(css_data, usedforsecurity=False).hexdigest()
except FileNotFoundError:
pass
VERSION = f"2.0.0+{VERSION_COMMIT}"
USER_AGENT = f"microblogpub/{VERSION}"