diff --git a/README.md b/README.md index b4c6567..68ad085 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ If the default `config.php` doesn't hold update information for this OEM, the co 4. To generate debug logs while developing: - Create a `php.ini` in the root folder with the following content: ``` - error_log = /Users/camila/client_updater_server/test.log + error_log = ~/client_updater_server/test.log log_errors = on ``` - Start the development php server with: `php -S 0.0.0.0:1234 -c php.ini -t .`. diff --git a/config/config.php b/config/config.php index 5de9c84..34747ae 100644 --- a/config/config.php +++ b/config/config.php @@ -20,20 +20,16 @@ $betaReleaseDate = '2025-11-25 13:40'; $betaVersionInternal = '4.0.2'; // short string $betaVersion = '4.0.2'; // long string like '3.16.0-rc3' used to hide the cryptical subversion like .58 from the user; -$betaVersionSignature = 'ynh6SBeDcS0XViB9XJn59gw//hVR9hEhunO83L6uQe5yedplGdW7yacGXFjxAPr/m40unlRH2SI5QGt/gofmCQ=='; -$betaVersionLength = 342008680; -$betaVersionFileProviderSignature = 'pfsfGlQUmrHptGCaf1TzssYjKbHxhnMV0rGvT3mmdtEf+URnbUC3eD8xrA27f3iZSIRLmBGuMMrImDSG+YxXDA=='; -$betaVersionFileProviderLength = 370127696; +$betaVersionSignature = 'pfsfGlQUmrHptGCaf1TzssYjKbHxhnMV0rGvT3mmdtEf+URnbUC3eD8xrA27f3iZSIRLmBGuMMrImDSG+YxXDA=='; +$betaVersionLength = 370127696; // // stable // $stableReleaseDate = '2025-11-25 13:40'; $stableVersion = '4.0.2'; -$stableVersionSignature = 'ynh6SBeDcS0XViB9XJn59gw//hVR9hEhunO83L6uQe5yedplGdW7yacGXFjxAPr/m40unlRH2SI5QGt/gofmCQ=='; -$stableVersionLength = 342008680; -$stableVersionFileProviderSignature = 'pfsfGlQUmrHptGCaf1TzssYjKbHxhnMV0rGvT3mmdtEf+URnbUC3eD8xrA27f3iZSIRLmBGuMMrImDSG+YxXDA=='; -$stableVersionFileProviderLength = 370127696; +$stableVersionSignature = 'pfsfGlQUmrHptGCaf1TzssYjKbHxhnMV0rGvT3mmdtEf+URnbUC3eD8xrA27f3iZSIRLmBGuMMrImDSG+YxXDA=='; +$stableVersionLength = 370127696; // // enterprise @@ -41,10 +37,8 @@ // $enterpriseReleaseDate = '2025-11-25 13:40'; $enterpriseVersion = '3.17.4'; -$enterpriseVersionSignature = 'uMKB/UoExWbv8y8VxzX1IAkrS5zhGThK+jemdPJYaxQveB73WyOIZVfi5Me2kFMT52oLJ7uyxLifAgSJ/PzFAg=='; -$enterpriseVersionLength = 332821925; -$enterpriseVersionFileProviderSignature = 'Etp40vzjOKAbiLOllzCZugCDkS+TMimkDUeIYigLCZAbIeKTMF7O+OpxiDEO58xfblj7xG2KKqvjej2fSrUcBA=='; -$enterpriseVersionFileProviderLength = 374673225; +$enterpriseVersionSignature = 'Etp40vzjOKAbiLOllzCZugCDkS+TMimkDUeIYigLCZAbIeKTMF7O+OpxiDEO58xfblj7xG2KKqvjej2fSrUcBA=='; +$enterpriseVersionLength = 374673225; // // stable Qt5 (legacy) @@ -138,16 +132,11 @@ 'macos' => [ 'version' => $stableVersion, 'versionstring' => $stableVersionString, - "fileProviderVersionString" => $stableVersionString, 'downloadurl' => $stableUrl . 'Nextcloud-' . $stableVersion . '.pkg', - 'fileProviderDownloadUrl' => $stableUrl . 'Nextcloud-' . $stableVersion . '-macOS-vfs.pkg', 'web' => 'https://nextcloud.com/install', "sparkleDownloadUrl" => $stableUrl . 'Nextcloud-' . $stableVersion . '.pkg.tbz', - "fileProviderSparkleDownloadUrl" => $stableUrl . 'Nextcloud-' . $stableVersion . '-macOS-vfs.pkg.tbz', "signature" => $stableVersionSignature, "length" => $stableVersionLength, - "fileProviderSignature" => $stableVersionFileProviderSignature, - "fileProviderLength" => $stableVersionFileProviderLength, ], ], 'enterprise' => [ @@ -167,16 +156,11 @@ 'macos' => [ 'version' => $enterpriseVersion, 'versionstring' => $enterpriseVersionString, - "fileProviderVersionString" => $enterpriseVersionString, 'downloadurl' => $enterpriseUrl . 'Nextcloud-' . $enterpriseVersion . '.pkg', - 'fileProviderDownloadUrl' => $enterpriseUrl . 'Nextcloud-' . $enterpriseVersion . '-macOS-vfs.pkg', 'web' => 'https://nextcloud.com/install', "sparkleDownloadUrl" => $enterpriseUrl . 'Nextcloud-' . $enterpriseVersion . '.pkg.tbz', - "fileProviderSparkleDownloadUrl" => $enterpriseUrl . 'Nextcloud-' . $enterpriseVersion . '-macOS-vfs.pkg.tbz', "signature" => $enterpriseVersionSignature, "length" => $enterpriseVersionLength, - "fileProviderSignature" => $enterpriseVersionFileProviderSignature, - "fileProviderLength" => $enterpriseVersionFileProviderLength, ], ], 'beta' => [ @@ -196,16 +180,11 @@ 'macos' => [ 'version' => $betaVersionInternal, 'versionstring' => $betaVersionString, - "fileProviderVersionString" => $betaVersionString, 'downloadurl' => $betaUrl . 'Nextcloud-' . $betaVersion . '.pkg', - 'fileProviderDownloadUrl' => $betaUrl . 'Nextcloud-' . $betaVersion . '-macOS-vfs.pkg', 'web' => 'https://nextcloud.com/install', "sparkleDownloadUrl" => $betaUrl . 'Nextcloud-' . $betaVersion . '.pkg.tbz', - "fileProviderSparkleDownloadUrl" => $betaUrl . 'Nextcloud-' . $betaVersion . '-macOS-vfs.pkg.tbz', "signature" => $betaVersionSignature, "length" => $betaVersionLength, - "fileProviderSignature" => $betaVersionFileProviderSignature, - "fileProviderLength" => $betaVersionFileProviderLength, ], ], 'daily' => [ diff --git a/index.php b/index.php index cec4662..b659257 100644 --- a/index.php +++ b/index.php @@ -73,7 +73,6 @@ $currentArch = isset($_GET['currentArch']) ? (string)$_GET['currentArch'] : "x86_64"; $version = isset($_GET['version']) ? (string)$_GET['version'] : null; $isSparkle = isset($_GET['sparkle']) ? true : false; -$isFileProvider = isset($_GET['fileprovider']) ? true : false; // due to a bug in an old version, the channels were translated. we need to catch them again $channel = isset($_GET['channel']) && in_array((string)$_GET['channel'], $allowedChannels, true) ? (string)$_GET['channel'] @@ -105,7 +104,6 @@ $kernelVersion, $channel, $isSparkle, - $isFileProvider, $config ); echo $response->buildResponse(); diff --git a/src/Response.php b/src/Response.php index 35fadda..6a45a0f 100644 --- a/src/Response.php +++ b/src/Response.php @@ -25,8 +25,6 @@ class Response { private $channel; /** @var bool */ private $isSparkle; - /** @var bool */ - private $isFileProvider; /** @var array */ private $config; @@ -38,7 +36,6 @@ public function __construct(string $oem, string $kernelVersion, string $channel, bool $isSparkle, - bool $isFileProvider, array $config) { $this->oem = $oem; $this->platform = $platform; @@ -48,7 +45,6 @@ public function __construct(string $oem, $this->kernelVersion = $kernelVersion; $this->channel = $channel; $this->isSparkle = $isSparkle; - $this->isFileProvider = $isFileProvider; $this->config = $config; } @@ -188,22 +184,22 @@ protected function getCurrentTimeStamp() : string { * Convenience functions to get specific file provider or standard client update information */ private function getSparkleUpdateUrl(array $updateVersion) : string { - $updateUrlKey = $this->isFileProvider ? 'fileProviderSparkleDownloadUrl' : 'sparkleDownloadUrl'; + $updateUrlKey = 'sparkleDownloadUrl'; return $updateVersion[$updateUrlKey]; } private function getSparkleUpdateSignature(array $updateVersion) : string { - $updateSignatureKey = $this->isFileProvider ? 'fileProviderSignature' : 'signature'; + $updateSignatureKey = 'signature'; return $updateVersion[$updateSignatureKey]; } private function getSparkleUpdateLength(array $updateVersion) : int { - $updateLengthKey = $this->isFileProvider ? 'fileProviderLength' : 'length'; + $updateLengthKey = 'length'; return $updateVersion[$updateLengthKey]; } private function getSparkleVersionString(array $updateVersion) : string { - $updateLengthKey = $this->isFileProvider ? 'fileProviderVersionString' : 'versionstring'; + $updateLengthKey = 'versionstring'; return $updateVersion[$updateLengthKey]; } diff --git a/tests/unit/ResponseTest.php b/tests/unit/ResponseTest.php index 3bae33b..376458e 100644 --- a/tests/unit/ResponseTest.php +++ b/tests/unit/ResponseTest.php @@ -140,7 +140,6 @@ public function updateDataProvider(): array "10.0.26080", 'stable', false, - false, $configThrottle, ' 2.2.2.6192Nextcloud Client 2.2.2 (build 6192)https://download.nextcloud.com/desktop/stable/ownCloud-2.2.2.6192-setup.exe @@ -156,7 +155,6 @@ public function updateDataProvider(): array "10.0.26080", 'stable', false, - false, $config, ' 2.2.2.6192Nextcloud Client 2.2.2 (build 6192)https://download.nextcloud.com/desktop/stable/ownCloud-2.2.2.6192-setup.exe @@ -172,7 +170,6 @@ public function updateDataProvider(): array "10.0.26080", 'stable', true, - false, $config, ' 2.2.2.6192Nextcloud Client 2.2.2 (build 6192)https://download.nextcloud.com/desktop/stable/ownCloud-2.2.2.6192-setup.exe @@ -188,7 +185,6 @@ public function updateDataProvider(): array '9.3', 'stable', false, - false, $config, ' 2.2.2Nextcloud Client 2.2.2https://download.nextcloud.com/desktop/stable/Nextcloud-2.2.2-x64.AppImagehttps://nextcloud.com/install/#install-clients @@ -204,7 +200,6 @@ public function updateDataProvider(): array '21.04.00', 'stable', false, - false, $config, ' 2.2.2.3472Nextcloud Client 2.2.2 (build 3472)https://download.owncloud.com/desktop/stable/ownCloud-2.2.2.3472.pkghttps://download.owncloud.com/desktop/stable/ownCloud-2.2.2.3472.pkg.tbzMC0CFQDmXR6biDmNVW7TvMh0bfPPTzCvtwIUCzASgpzYdi4lltOnwbFCeQwgDjY=62738920 @@ -220,7 +215,6 @@ public function updateDataProvider(): array "21.0.1", 'stable', true, - false, $config, ' @@ -247,7 +241,6 @@ public function updateDataProvider(): array "10.0.26080", 'beta', false, - false, $config, ' 2.2.3-rc3Nextcloud Client 2.2.3-rc3https://download.nextcloud.com/desktop/stable/Nextcloud-2.2.3-rc3-x86.msihttps://nextcloud.com/install/#install-clients @@ -263,7 +256,6 @@ public function updateDataProvider(): array "10.0.26080", 'beta', false, - false, $config, ' 2.2.3-rc3Nextcloud Client 2.2.3-rc3https://download.nextcloud.com/desktop/stable/Nextcloud-2.2.3-rc3-x86.msihttps://nextcloud.com/install/#install-clients @@ -279,7 +271,6 @@ public function updateDataProvider(): array '9.3', 'beta', false, - false, $config, ' 2.2.2Nextcloud Client 2.2.2https://download.nextcloud.com/desktop/stable/Nextcloud-2.2.2-x64.AppImagehttps://nextcloud.com/install/#install-clients @@ -295,7 +286,6 @@ public function updateDataProvider(): array "21.0.1", 'stable', false, - false, $config, ' @@ -311,7 +301,6 @@ public function updateDataProvider(): array '???', 'stable', false, - false, $config, ' @@ -327,7 +316,6 @@ public function updateDataProvider(): array "10.0.26080", 'stable', false, - false, $config, ' @@ -343,7 +331,6 @@ public function updateDataProvider(): array "10.0.26080", 'stable', true, - false, $config, ' @@ -359,7 +346,6 @@ public function updateDataProvider(): array '9.3', 'stable', false, - false, $config, ' @@ -375,7 +361,6 @@ public function updateDataProvider(): array '21.04.00', 'stable', false, - false, $config, ' @@ -391,7 +376,6 @@ public function updateDataProvider(): array '21.04.00', 'stable', true, - false, $config, ' @@ -418,7 +402,6 @@ public function updateDataProvider(): array "10.0.26080", 'stable', false, - false, $config, ' @@ -434,7 +417,6 @@ public function updateDataProvider(): array "10.0.26080", 'stable', true, - false, $config, ' @@ -450,7 +432,6 @@ public function updateDataProvider(): array '9.3', 'stable', false, - false, $config, ' @@ -466,7 +447,6 @@ public function updateDataProvider(): array '21.04.00', 'stable', false, - false, $config, ' @@ -482,7 +462,6 @@ public function updateDataProvider(): array '21.04.00', 'stable', true, - false, $config, ' @@ -509,7 +488,6 @@ public function updateDataProvider(): array '21.04.00', 'beta', true, - false, $config, ' @@ -536,7 +514,6 @@ public function updateDataProvider(): array '21.04.00', 'beta', true, - false, $config, ' @@ -563,7 +540,6 @@ public function updateDataProvider(): array '20', 'daily', false, - false, $config, ' 20240604Nextcloud Daily 20240604https://download.nextcloud.com/desktop/daily/linux/linux-20240604.AppImagehttps://nextcloud.com/install/#install-clients @@ -579,7 +555,6 @@ public function updateDataProvider(): array "06.01.00", 'stable', true, - false, $config, ' 2.0.0.0000Nextcloud Client 2.0.0 (build 0000)https://download.nextcloud.com/desktop/stable/Nextcloud-2.0.0.0000-setup.exe @@ -595,7 +570,6 @@ public function updateDataProvider(): array "10.0.1800", 'stable', true, - false, $config, ' 2.0.0.0000Nextcloud Client 2.0.0 (build 0000)https://download.nextcloud.com/desktop/stable/Nextcloud-2.0.0.0000-setup.exe @@ -611,7 +585,6 @@ public function updateDataProvider(): array "10.0.26080", 'stable', true, - false, $config, ' 2.2.2.6192Nextcloud Client 2.2.2 (build 6192)https://download.nextcloud.com/desktop/stable/ownCloud-2.2.2.6192-setup.exe @@ -627,7 +600,6 @@ public function updateDataProvider(): array "10.0.22622", 'stable', true, - false, $config, ' 2.2.2.6192Nextcloud Client 2.2.2 (build 6192)https://download.nextcloud.com/desktop/stable/ownCloud-2.2.2.6192-setup.exe @@ -643,7 +615,6 @@ public function updateDataProvider(): array '10.0.1500', 'beta', false, - false, $config, ' 2.0.0.0000Nextcloud Client 2.0.0 (build 0000)https://download.nextcloud.com/desktop/stable/Nextcloud-2.0.0.0000-setup.exe @@ -659,7 +630,6 @@ public function updateDataProvider(): array "21.0.1.00", 'stable', true, - false, $config, ' @@ -686,7 +656,6 @@ public function updateDataProvider(): array "10.0.17700", 'stable', true, - false, $config, ' 2.0.0.0000Nextcloud Client 2.0.0 (build 0000)https://download.nextcloud.com/desktop/stable/Nextcloud-2.0.0.0000-setup.exe @@ -702,7 +671,6 @@ public function updateDataProvider(): array '5.5.0', 'stable', false, - false, $config, ' 2.0.0Nextcloud Client 2.0.0https://download.nextcloud.com/desktop/stable/Nextcloud-2.0.0-x64.AppImagehttps://nextcloud.com/install/#install-clients @@ -718,7 +686,6 @@ public function updateDataProvider(): array '6.6.0', 'stable', false, - false, $config, ' 2.2.2Nextcloud Client 2.2.2https://download.nextcloud.com/desktop/stable/Nextcloud-2.2.2-x64.AppImagehttps://nextcloud.com/install/#install-clients @@ -734,7 +701,6 @@ public function updateDataProvider(): array '5.5.0', 'stable', false, - false, $config, ' 2.0.0Nextcloud Client 2.0.0https://download.nextcloud.com/desktop/stable/Nextcloud-2.0.0-x64.AppImagehttps://nextcloud.com/install/#install-clients @@ -750,7 +716,6 @@ public function updateDataProvider(): array '6.6.0', 'stable', false, - false, $config, ' 2.2.2Nextcloud Client 2.2.2https://download.nextcloud.com/desktop/stable/Nextcloud-2.2.2-x64.AppImagehttps://nextcloud.com/install/#install-clients @@ -766,7 +731,6 @@ public function updateDataProvider(): array '5.5.0', 'stable', false, - false, $config, ' 2.0.0Nextcloud Client 2.0.0https://download.nextcloud.com/desktop/stable/Nextcloud-2.0.0-x64.AppImagehttps://nextcloud.com/install/#install-clients @@ -782,7 +746,6 @@ public function updateDataProvider(): array '6.6.0', 'stable', false, - false, $config, ' 2.2.2Nextcloud Client 2.2.2https://download.nextcloud.com/desktop/stable/Nextcloud-2.2.2-x64.AppImagehttps://nextcloud.com/install/#install-clients @@ -798,7 +761,6 @@ public function updateDataProvider(): array '6.6.0', 'enterprise', false, - false, $config, ' 2.2.2Nextcloud Client 2.2.2https://download.nextcloud.com/desktop/stable/Nextcloud-2.2.2-x64.AppImagehttps://nextcloud.com/install/#install-clients @@ -814,7 +776,6 @@ public function updateDataProvider(): array "10.0.22622", 'enterprise', true, - false, $config, ' 2.2.2.6192Nextcloud Client 2.2.2 (build 6192)https://download.nextcloud.com/desktop/stable/ownCloud-2.2.2.6192-setup.exe @@ -830,7 +791,6 @@ public function updateDataProvider(): array '21.04.00', 'enterprise', true, - false, $config, ' @@ -860,7 +820,6 @@ public function updateDataProvider(): array * @param string $kernelVersion * @param string $channel * @param bool $isSparkle - * @param bool $isFileProvider * @param array $config * @param string $expected */ @@ -872,7 +831,6 @@ public function testBuildResponse(string $oem, string $kernelVersion, string $channel, bool $isSparkle, - bool $isFileProvider, array $config, string $expected) { $response = $this->getMockBuilder('\ClientUpdateServer\Response') @@ -885,7 +843,6 @@ public function testBuildResponse(string $oem, $kernelVersion, $channel, $isSparkle, - $isFileProvider, $config]) ->setMethods(['getCurrentTimeStamp']) ->getMock();