From 067f7f2937a11c41cb1715443b92be4ec0748d10 Mon Sep 17 00:00:00 2001 From: eraseyourknees <112027564+eraseyourknees@users.noreply.github.com> Date: Mon, 29 Aug 2022 03:01:11 +0200 Subject: [PATCH 1/4] Add some helper functions --- shared/main.php | 2 +- shared/utils.php | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/shared/main.php b/shared/main.php index 242d7fb..ec7931d 100644 --- a/shared/main.php +++ b/shared/main.php @@ -16,7 +16,7 @@ limitations under the License. */ function uupApiVersion() { - return '1.34.0'; + return '1.35.0-dev'; } require_once dirname(__FILE__).'/auths.php'; diff --git a/shared/utils.php b/shared/utils.php index 083b92a..6c8284c 100644 --- a/shared/utils.php +++ b/shared/utils.php @@ -134,3 +134,19 @@ function uupApiCheckUpdateId($updateId) { $updateId ); } + +function uupApiIsServer($skuId) { + $serverSkus = [ + 7, 8, 12, 13, 79, 80, 120, 145, 146, + 147, 148, 159, 160, 406, 407, 408 + ]; + + return in_array($skuId, $serverSkus); +} + +function uupApiBuildMajor($build) { + if(!str_contains($build, '.')) { + return intval($build); + } + return intval(explode('.', $build)[0]); +} From be2a2f2877b762553884810f5afde9d3dfb19be9 Mon Sep 17 00:00:00 2001 From: eraseyourknees <112027564+eraseyourknees@users.noreply.github.com> Date: Mon, 29 Aug 2022 03:36:33 +0200 Subject: [PATCH 2/4] A little cleanup of the caching class --- shared/cache.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/shared/cache.php b/shared/cache.php index 59e13cc..dcb9797 100644 --- a/shared/cache.php +++ b/shared/cache.php @@ -17,15 +17,13 @@ limitations under the License. class UupDumpCache { private $cacheFile; - private $isCompressed; private $newCacheVersion = 1; - public function __construct($resource, $compressed = true) { + public function __construct($resource, private $isCompressed = true) { $res = $resource."+cache_v".$this->newCacheVersion; $cacheHash = hash('sha256', strtolower($res)); - $ext = $compressed ? '.json.gz' : '.json'; + $ext = $isCompressed ? '.json.gz' : '.json'; $this->cacheFile = 'cache/'.$cacheHash.$ext; - $this->isCompressed = $compressed; } public function getFileName() { From 64959ebf3d9052cc4ad36dac54fd3fc9c331d03f Mon Sep 17 00:00:00 2001 From: eraseyourknees <112027564+eraseyourknees@users.noreply.github.com> Date: Mon, 29 Aug 2022 16:59:10 +0200 Subject: [PATCH 3/4] Use shared functions instead of constants --- shared/requests.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/requests.php b/shared/requests.php index 4483934..a40977d 100644 --- a/shared/requests.php +++ b/shared/requests.php @@ -34,7 +34,7 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) { if($sku == 119) { $dvcFamily = 'Windows.Team'; } - if(in_array($sku, [7,8,12,13,79,80,120,145,146,147,148,159,160,406,407,408])) { + if(uupApiIsServer($sku)) { $dvcFamily = 'Windows.Server'; $insType = 'Server'; $blockUpgrades = 1; @@ -329,7 +329,7 @@ function composeFetchUpdRequest($device, $encData, $arch, $flight, $ring, $build $branch = branchFromBuild($build); $mainProduct = 'Client.OS.rs2'; - if(in_array($sku, [7,8,12,13,79,80,120,145,146,147,148,159,160,406,407,408])) { + if(uupApiIsServer($sku)) { $mainProduct = 'Server.OS'; } /*/ Hololens From 6cd9c0c41419f6a6515f9acaf77ff833ac887469 Mon Sep 17 00:00:00 2001 From: eraseyourknees <112027564+eraseyourknees@users.noreply.github.com> Date: Mon, 29 Aug 2022 17:02:26 +0200 Subject: [PATCH 4/4] 1.35.0 --- shared/main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/main.php b/shared/main.php index ec7931d..4b5851a 100644 --- a/shared/main.php +++ b/shared/main.php @@ -16,7 +16,7 @@ limitations under the License. */ function uupApiVersion() { - return '1.35.0-dev'; + return '1.35.0'; } require_once dirname(__FILE__).'/auths.php';