From 6d1ea4e93ba519372dbdf9311d19adb357cab7a6 Mon Sep 17 00:00:00 2001 From: Nico Verbruggen Date: Thu, 2 Feb 2023 19:27:58 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20timeout=20for=20updater?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- phpmon-updater/Updater.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpmon-updater/Updater.swift b/phpmon-updater/Updater.swift index df2bae1..5d6e314 100644 --- a/phpmon-updater/Updater.swift +++ b/phpmon-updater/Updater.swift @@ -79,7 +79,7 @@ class Updater: NSObject, NSApplicationDelegate { system_quiet("rm -rf \(updaterDirectory)/*.zip") // Download the file (and follow redirects + no output on failure) - system_quiet("cd \(updaterDirectory) && curl \(manifest.url) -fLO") + system_quiet("cd \(updaterDirectory) && curl \(manifest.url) -fLO --max-time 20") // Identify the downloaded file let filename = system("cd \(updaterDirectory) && ls | grep .zip") @@ -88,7 +88,7 @@ class Updater: NSObject, NSApplicationDelegate { // Ensure the zip exists if filename.isEmpty { print("The update has not been downloaded. Sadly, that means that PHP Monitor cannot not updated!") - await Alert.show(description: "PHP Monitor has not been updated. The update was not downloaded, or the file could not be written to disk. Please try again.") + await Alert.show(description: "The update could not be downloaded, or the file was not correctly written to disk. \n\nPlease try again. \n\n(Note that the download will time-out after 20 seconds, so for slow connections it is recommended to manually download the update.)") } // Calculate the checksum for the downloaded file