This commit is contained in:
1 parent
6d9fd2f2a2
commit
280e6e0313
1 file changed
+7
-13
@@ -132,20 +132,14 @@ def get(session):
|
|||||||
@rt('/check_updates')
|
@rt('/check_updates')
|
||||||
def get():
|
def get():
|
||||||
try:
|
try:
|
||||||
res = requests.get("https://gitea.aethas38.duckdns.org/xavier/MULTI-IA-CODAGE/git/commits/main", timeout=3).json()
|
# Appel à l'API Gitea officielle pour récupérer le dernier commit
|
||||||
remote_commit = res.get("sha", "")
|
res = requests.get("https://gitea.aethas38.duckdns.org/api/v1/repos/xavier/MULTI-IA-CODAGE/commits?limit=1", timeout=3)
|
||||||
local_commit = ""
|
if res.status_code == 200:
|
||||||
if os.path.exists(".git/refs/heads/main"):
|
remote_commit = res.json()[0].get("sha", "")[:7]
|
||||||
with open(".git/refs/heads/main", "r") as f:
|
return Span(f"🟢 Gitea Connecté (Dernier commit : {remote_commit})", style="color:#10b981;")
|
||||||
local_commit = f.read().strip()
|
|
||||||
|
|
||||||
if local_commit and remote_commit and remote_commit != local_commit:
|
|
||||||
return Span("🚀 MAJ disponible (GitHub)", style="color:#fbbf24;")
|
|
||||||
elif local_commit == remote_commit:
|
|
||||||
return Span("🟢 Système à jour", style="color:#10b981;")
|
|
||||||
else:
|
else:
|
||||||
return Span(f"🟢 Connecté (Git: {remote_commit[:7]})", style="color:#38bdf8;")
|
return Span("🟠 Gitea injoignable", style="color:#fbbf24;")
|
||||||
except:
|
except Exception as e:
|
||||||
return Span("⚪ Statut réseau inconnu", style="color:#94a3b8;")
|
return Span("⚪ Statut réseau inconnu", style="color:#94a3b8;")
|
||||||
|
|
||||||
os.makedirs("sessions", exist_ok=True)
|
os.makedirs("sessions", exist_ok=True)
|
||||||
|
|||||||
Reference in new issue
Block a user