From 2fa1b476c4f1c4116df4c1ec6566812923993617 Mon Sep 17 00:00:00 2001 From: Roby Date: Thu, 22 Oct 2026 01:36:35 +0200 Subject: [PATCH] feat(ui): mostrato hash e messaggio dell'ultimo commit nel footer tramite subprocess --- app.py | 13 ++++++++++++- templates/index.html | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index aff7d54..7c94258 100644 --- a/app.py +++ b/app.py @@ -12,6 +12,7 @@ import re import queue import hashlib import secrets +import subprocess from contextlib import closing from pywebpush import webpush, WebPushException from logging.handlers import RotatingFileHandler @@ -660,8 +661,18 @@ def add_security_headers(resp): resp.headers['Cache-Control'] = 'no-store' return resp +def get_git_commit(): + try: + # Legge i primi 7 caratteri dell'hash del commit corrente + return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('utf-8').strip() + except Exception: + return "sconosciuta" + +SERVER_COMMIT = get_git_commit() + @app.route('/') -def index(): return render_template('index.html') +def index(): + return render_template('index.html', git_commit=SERVER_COMMIT) @app.route('/api/clients') def get_clients(): diff --git a/templates/index.html b/templates/index.html index 9546533..fcb6c6b 100644 --- a/templates/index.html +++ b/templates/index.html @@ -266,10 +266,11 @@ GitHub Mirror | + Rev: {{ git_commit }} + | Sync: --:-- -