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() { diff --git a/shared/main.php b/shared/main.php index 242d7fb..4b5851a 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'; } require_once dirname(__FILE__).'/auths.php'; 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 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]); +}