diff --git a/ap.py b/ap.py index d2a94ff..0dac78b 100644 --- a/ap.py +++ b/ap.py @@ -3476,10 +3476,37 @@ _update_cache = { } def get_current_commit(): - """Récupère le SHA du commit actuel (variable AP_GIT_COMMIT, version.json ou git).""" + """Récupère le SHA du commit actuel (variable AP_GIT_COMMIT, git rev-parse ou version.json).""" env_c = os.environ.get('AP_GIT_COMMIT', '').strip() if env_c: return env_c + + # 1. Priorité au dépôt Git réel si disponible + try: + c = command('git', 'rev-parse', 'HEAD') + if c and len(c.strip()) >= 7: + git_sha = c.strip() + # Mettre à jour version.json s'il existe et est désynchronisé + for v_path in ( + os.path.join(BASE_DIR, 'version.json'), + os.path.join(os.getcwd(), 'version.json'), + 'version.json' + ): + if os.path.isfile(v_path): + try: + with open(v_path, 'r', encoding='utf-8') as f: + vdata = json.load(f) + if vdata.get('commit') != git_sha: + vdata['commit'] = git_sha + with open(v_path, 'w', encoding='utf-8') as f: + json.dump(vdata, f, indent=2) + except Exception: + pass + return git_sha + except Exception: + pass + + # 2. Sinon, lecture de version.json (conteneur Docker où .git n'est pas présent) for path in ( os.path.join(BASE_DIR, 'version.json'), '/app/version.json', @@ -3496,12 +3523,6 @@ def get_current_commit(): return c except Exception: pass - try: - c = command('git', 'rev-parse', 'HEAD') - if c and len(c.strip()) >= 7: - return c.strip() - except Exception: - pass return '' def check_gitea_update(force_refresh=False): @@ -3545,10 +3566,14 @@ def check_gitea_update(force_refresh=False): date_str = (c_info.get('author') or {}).get('date', '') html_url = first.get('html_url') or GITEA_REPO_URL if current_sha and latest_sha: - c_low = current_sha.lower() - l_low = latest_sha.lower() + c_low = current_sha.lower().strip() + l_low = latest_sha.lower().strip() if not l_low.startswith(c_low) and not c_low.startswith(l_low): available = True + else: + available = False + else: + available = False except Exception as e: err_msg = str(e) diff --git a/index.html b/index.html index fa30dbd..e897063 100644 --- a/index.html +++ b/index.html @@ -83,9 +83,9 @@ } .wrap { - max-width: 1100px; + max-width: 1200px; margin: 0 auto; - padding: 24px; + padding: 20px 24px; width: 100% } @@ -94,49 +94,52 @@ justify-content: space-between; align-items: center; margin-bottom: 20px; - gap: 12px; - flex-wrap: wrap + gap: 16px; } h1 { margin: 0; - font-size: 26px + font-size: 24px; + white-space: nowrap; } .sub { color: var(--muted); - font-size: 14px; - margin-top: 4px + font-size: 13px; + margin-top: 3px } .header-actions { display: flex; - gap: 8px; - flex-wrap: wrap; - align-items: center + gap: 6px; + align-items: center; + flex-wrap: nowrap; } .header-actions button { display: inline-flex; align-items: center; justify-content: center; - gap: 8px; - height: 38px; - padding: 9px 16px; - font-size: 14px; + gap: 6px; + height: 36px; + padding: 7px 12px; + font-size: 13px; font-weight: 600; border-radius: 8px; box-sizing: border-box; line-height: 1; + white-space: nowrap; } .btn-update-available { - background: rgba(16, 185, 129, 0.16) !important; + background: rgba(16, 185, 129, 0.15) !important; + border: 1px solid #10b981 !important; color: #10b981 !important; - border: 1px solid rgba(16, 185, 129, 0.5) !important; box-shadow: 0 0 10px rgba(16, 185, 129, 0.2); transition: all 0.2s ease-in-out; cursor: pointer; + padding: 7px 12px !important; + font-size: 13px !important; } .btn-update-available:hover { @@ -2007,6 +2010,21 @@ } } + /* Écrans moyens / Tablettes (<= 960px) */ + @media (max-width: 960px) { + header { + flex-direction: column; + align-items: flex-start; + gap: 14px; + } + + .header-actions { + width: 100%; + flex-wrap: wrap; + gap: 6px; + } + } + /* Téléphone et écrans compacts (<= 600px) */ @media (max-width:600px) { .wrap { @@ -5682,11 +5700,11 @@