first commit

This commit is contained in:
Mateusz Gruszczyński
2026-03-13 15:17:32 +01:00
commit 986ffb200a
91 changed files with 4423 additions and 0 deletions

18
app/services/assets.py Normal file
View File

@@ -0,0 +1,18 @@
import hashlib
from functools import lru_cache
from pathlib import Path
from flask import url_for
@lru_cache(maxsize=128)
def asset_version(file_path: str) -> str:
path = Path(file_path)
if not path.exists():
return '0'
return hashlib.md5(path.read_bytes()).hexdigest()[:10]
def asset_url(relative_path: str) -> str:
base_path = Path(__file__).resolve().parent.parent / 'static' / relative_path
return url_for('static', filename=relative_path, v=asset_version(str(base_path)))