feat(ui): mostrato hash e messaggio dell'ultimo commit nel footer tramite subprocess
This commit is contained in:
@@ -12,6 +12,7 @@ import re
|
|||||||
import queue
|
import queue
|
||||||
import hashlib
|
import hashlib
|
||||||
import secrets
|
import secrets
|
||||||
|
import subprocess
|
||||||
from contextlib import closing
|
from contextlib import closing
|
||||||
from pywebpush import webpush, WebPushException
|
from pywebpush import webpush, WebPushException
|
||||||
from logging.handlers import RotatingFileHandler
|
from logging.handlers import RotatingFileHandler
|
||||||
@@ -660,8 +661,18 @@ def add_security_headers(resp):
|
|||||||
resp.headers['Cache-Control'] = 'no-store'
|
resp.headers['Cache-Control'] = 'no-store'
|
||||||
return resp
|
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('/')
|
@app.route('/')
|
||||||
def index(): return render_template('index.html')
|
def index():
|
||||||
|
return render_template('index.html', git_commit=SERVER_COMMIT)
|
||||||
|
|
||||||
@app.route('/api/clients')
|
@app.route('/api/clients')
|
||||||
def get_clients():
|
def get_clients():
|
||||||
|
|||||||
@@ -266,10 +266,11 @@
|
|||||||
<span>GitHub Mirror</span>
|
<span>GitHub Mirror</span>
|
||||||
</a>
|
</a>
|
||||||
<span style="opacity: 0.5;">|</span>
|
<span style="opacity: 0.5;">|</span>
|
||||||
|
<span style="font-family: 'JetBrains Mono', monospace; color: var(--accent);">Rev: {{ git_commit }}</span>
|
||||||
|
<span style="opacity: 0.5;">|</span>
|
||||||
<span id="last-update">Sync: --:--</span>
|
<span id="last-update">Sync: --:--</span>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<div id="login-modal" class="modal-overlay">
|
<div id="login-modal" class="modal-overlay">
|
||||||
<div class="modal-content" style="width:90%; max-width:400px;">
|
<div class="modal-content" style="width:90%; max-width:400px;">
|
||||||
<div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--border-color); padding-bottom:15px; margin-bottom:20px;">
|
<div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--border-color); padding-bottom:15px; margin-bottom:20px;">
|
||||||
|
|||||||
Reference in New Issue
Block a user