From 54fe5913559f4afd2d3eef06b01c9527b63ea339 Mon Sep 17 00:00:00 2001 From: sorcier Date: Wed, 4 Nov 2026 03:42:14 +0100 Subject: [PATCH] fix(update): fast direct HTTP check & force cache bypass on check click (v1.3.7) --- install.sh | 1 + public/api.php | 28 ++++++++++++++++++++++++---- public/assets/app.js | 7 +++++++ scripts/update.sh | 1 + version.json | 8 ++++---- 5 files changed, 37 insertions(+), 8 deletions(-) diff --git a/install.sh b/install.sh index d0566a4..892a4a9 100755 --- a/install.sh +++ b/install.sh @@ -142,6 +142,7 @@ else echo " -> Clonage du dépôt public officiel depuis https://git.sorcier-research.com..." rm -rf "$TARGET_DIR" git clone https://git.sorcier-research.com/sorcier/NexusPBX.git "$TARGET_DIR" + git config --system --add safe.directory "$TARGET_DIR" 2>/dev/null || true cd "$TARGET_DIR" fi diff --git a/public/api.php b/public/api.php index d8559d3..c8792da 100644 --- a/public/api.php +++ b/public/api.php @@ -2242,15 +2242,35 @@ try { $remoteChangelog = []; $remoteDate = ''; - exec("git --git-dir={$appDir}/.git fetch origin main --quiet 2>/dev/null", $output, $code); - $remoteJsonRaw = shell_exec("git --git-dir={$appDir}/.git show origin/main:version.json 2>/dev/null"); - if ($remoteJsonRaw) { - $remoteData = json_decode($remoteJsonRaw, true); + // 1. Interrogation directe via HTTP Raw (indépendant de .git et ultra-rapide) + $rawHttp = @shell_exec("curl -k -s --connect-timeout 4 \"https://git.sorcier-research.com/sorcier/NexusPBX/raw/branch/main/version.json\" 2>/dev/null"); + if (empty($rawHttp)) { + $ctx = stream_context_create([ + 'http' => ['timeout' => 4], + 'ssl' => ['verify_peer' => false, 'verify_peer_name' => false] + ]); + $rawHttp = @file_get_contents("https://git.sorcier-research.com/sorcier/NexusPBX/raw/branch/main/version.json", false, $ctx); + } + + if (!empty($rawHttp)) { + $remoteData = json_decode((string)$rawHttp, true); if (is_array($remoteData) && !empty($remoteData['version'])) { $remoteVer = (string)$remoteData['version']; $remoteChangelog = $remoteData['changelog'] ?? []; $remoteDate = $remoteData['release_date'] ?? ''; } + } else { + // 2. Fallback local Git si indisponibilité du serveur HTTP + exec("git --git-dir={$appDir}/.git fetch origin main --quiet 2>/dev/null", $output, $code); + $remoteJsonRaw = shell_exec("git --git-dir={$appDir}/.git show origin/main:version.json 2>/dev/null"); + if ($remoteJsonRaw) { + $remoteData = json_decode($remoteJsonRaw, true); + if (is_array($remoteData) && !empty($remoteData['version'])) { + $remoteVer = (string)$remoteData['version']; + $remoteChangelog = $remoteData['changelog'] ?? []; + $remoteDate = $remoteData['release_date'] ?? ''; + } + } } $hasUpdate = version_compare($remoteVer, $currentVer, '>'); diff --git a/public/assets/app.js b/public/assets/app.js index 5b3ecbe..1e5a900 100644 --- a/public/assets/app.js +++ b/public/assets/app.js @@ -5745,11 +5745,17 @@ async function checkSystemUpdate(notify = false) { return; } catch (_) {} } + } else { + localStorage.removeItem(STORAGE_KEY_TIME); + localStorage.removeItem(STORAGE_KEY_DATA); } + let origBtnHtml = null; if (btnCheck) { btnCheck.disabled = true; btnCheck.classList.add('opacity-50'); + origBtnHtml = btnCheck.innerHTML; + btnCheck.innerHTML = `Vérification en cours...`; } try { @@ -5777,6 +5783,7 @@ async function checkSystemUpdate(notify = false) { if (btnCheck) { btnCheck.disabled = false; btnCheck.classList.remove('opacity-50'); + if (origBtnHtml) btnCheck.innerHTML = origBtnHtml; } } diff --git a/scripts/update.sh b/scripts/update.sh index dae9280..1fbccf6 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -37,6 +37,7 @@ for arg in "$@"; do done cd "$APP_DIR" || exit 1 +git config --system --add safe.directory "$APP_DIR" 2>/dev/null || true git config --global --add safe.directory "$APP_DIR" 2>/dev/null || true # Lecture de la version locale diff --git a/version.json b/version.json index 654ed30..ce22452 100644 --- a/version.json +++ b/version.json @@ -1,12 +1,12 @@ { - "version": "1.3.6", + "version": "1.3.7", "codename": "Helios", "release_date": "2026-11-04", "min_php_version": "8.2", "changelog": [ + "Vérification ultra-rapide des mises à jour en direct via cURL CLI et flux HTTP sans dépendre de git ou de php-curl", + "Bouton 'Vérifier les mises à jour' forçant le rafraîchissement immédiat du cache navigateur (bypass 24h)", "Nouvelle modale de confirmation de restauration système alignée sur le thème sombre NexusPBX", - "Remplacement des popups d'alerte natives du navigateur lors des restaurations locales et téléversées", - "Affichage détaillé des éléments restaurés (base SQLite, sons, messageries vocales, rechargement Asterisk)", - "Désactivation du bac à sable ProtectSystem=full sur PHP-FPM pour fiabiliser les mises à jour" + "Remplacement des popups d'alerte natives du navigateur lors des restaurations locales et téléversées" ] }