diff --git a/app.py b/app.py index 54324e3..5eca872 100644 --- a/app.py +++ b/app.py @@ -147,6 +147,25 @@ WEBP_SAVE_PARAMS = { "quality": 95, # tylko jeśli lossless=False } + +def build_fingerprint(paths): + h = hashlib.sha256() + for base in paths: + if not os.path.exists(base): + continue + for root, _, files in os.walk(base): + for f in sorted(files): + p = os.path.join(root, f) + try: + with open(p, "rb") as fh: + h.update(fh.read()) + except Exception: + pass + return h.hexdigest()[:8] + +APP_VERSION = f"{datetime.now():%Y.%m.%d}+{build_fingerprint(['templates','static','app.py'])}" +app.config['APP_VERSION'] = APP_VERSION + db = SQLAlchemy(app) socketio = SocketIO(app, async_mode="eventlet") login_manager = LoginManager(app) @@ -1320,6 +1339,11 @@ def load_user(user_id): return db.session.get(User, int(user_id)) +@app.context_processor +def inject_version(): + return {'APP_VERSION': app.config['APP_VERSION']} + + @app.context_processor def inject_time(): return dict(time=time) diff --git a/templates/admin/admin_panel.html b/templates/admin/admin_panel.html index d41f051..bc7346a 100644 --- a/templates/admin/admin_panel.html +++ b/templates/admin/admin_panel.html @@ -218,7 +218,8 @@ — {{ month_str|replace('-', ' / ') }} {% endif %} -