fix(update): fast direct HTTP check & force cache bypass on check click (v1.3.7)
This commit is contained in:
1 parent
7ccb2189e7
commit
54fe591355
5 files changed
+33
-4
No files matched your search
@@ -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
|
||||
|
||||
|
||||
@@ -2242,6 +2242,25 @@ try {
|
||||
$remoteChangelog = [];
|
||||
$remoteDate = '';
|
||||
|
||||
// 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) {
|
||||
@@ -2252,6 +2271,7 @@ try {
|
||||
$remoteDate = $remoteData['release_date'] ?? '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$hasUpdate = version_compare($remoteVer, $currentVer, '>');
|
||||
$localHash = trim((string)shell_exec("git --git-dir={$appDir}/.git rev-parse HEAD 2>/dev/null"));
|
||||
|
||||
@@ -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 = `<svg class="animate-spin w-4 h-4 text-cyan-400" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v8H4z"></path></svg><span>Vérification en cours...</span>`;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+4
-4
@@ -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"
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user