From 5a0938a8d07b069b341e45ba24d182965cf99f00 Mon Sep 17 00:00:00 2001 From: abbodi1406 <33669284+abbodi1406@users.noreply.github.com> Date: Wed, 15 Jul 2020 05:07:06 +0300 Subject: [PATCH] Add support for channels, keep compatibility with rings, update readme --- fetchupd.php | 10 ++++++--- readme.md | 12 ++++++----- shared/main.php | 2 +- shared/requests.php | 50 ++++++++++++++++++++++++++++++++++++++------- 4 files changed, 58 insertions(+), 16 deletions(-) diff --git a/fetchupd.php b/fetchupd.php index 15fd041..2844cf0 100644 --- a/fetchupd.php +++ b/fetchupd.php @@ -33,7 +33,7 @@ function uupFetchUpd( $arch = strtolower($arch); $ring = strtoupper($ring); $flight = ucwords(strtolower($flight)); - if($flight == 'Current') $flight = 'Active'; + $flight = 'Active'; if($build == 'latest' || (!$build)) { $builds = array('17134.1'); @@ -56,11 +56,11 @@ function uupFetchUpd( return array('error' => 'UNKNOWN_ARCH'); } - if(!($ring == 'WIF' || $ring == 'WIS' || $ring == 'RP' || $ring == 'RETAIL' || $ring == 'MSIT')) { + if(!($ring == 'DEV' || $ring == 'BETA' || $ring == 'RELEASEPREVIEW' || $ring == 'WIF' || $ring == 'WIS' || $ring == 'RP' || $ring == 'RETAIL' || $ring == 'MSIT')) { return array('error' => 'UNKNOWN_RING'); } - if(!($flight == 'Skip' || $flight == 'Active')) { + if(!($flight == 'Mainline' || $flight == 'Active' || $flight == 'Skip')) { return array('error' => 'UNKNOWN_FLIGHT'); } @@ -76,6 +76,10 @@ function uupFetchUpd( return array('error' => 'ILLEGAL_MINOR'); } + if($ring == 'DEV') $ring = 'WIF'; + if($ring == 'BETA') $ring = 'WIS'; + if($ring == 'RELEASEPREVIEW') $ring = 'RP'; + if($flight == 'Active' && $ring == 'RP') $flight = 'Current'; $build = '10.0.'.$build.'.'.$minor; diff --git a/readme.md b/readme.md index a6a02a4..96401d5 100644 --- a/readme.md +++ b/readme.md @@ -7,13 +7,15 @@ Fetches latest update information from Windows Update servers. Parameters: - `arch` - Architecture of build to find - - **Supported values:** `amd64`, `arm64`, `x86` + - **Supported values:** `amd64`, `x86`, `arm64`, `all` - - `ring` - Ring to use when fetching information - - **Supported values:** `WIF`, `WIS`, `RP`, `RETAIL` + - `ring` - Channel to use when fetching information (Previously called Ring) + - **Supported values:** `Dev`, `Beta`, `ReleasePreview`, `Retail` + - **Supported Ring values :** `WIF`, `WIS`, `RP` - - `flight` - Flight to use when fetching information - - **Supported values:** `Active`, `Skip`, `Current` + - `flight` - Content type to use when fetching information (Previously called Flight) + - **Supported values:** `Mainline` + - **Supported Flight values:** `Active`, `Skip`, `Current` - **NOTE:** `Skip` is for `WIF` ring only. `Current` is for `RP` ring only. - `build` - Build number to use when fetching information diff --git a/shared/main.php b/shared/main.php index 74ce99f..7010e76 100644 --- a/shared/main.php +++ b/shared/main.php @@ -16,7 +16,7 @@ limitations under the License. */ function uupApiVersion() { - return '1.29.0'; + return '1.30.2'; } require_once dirname(__FILE__).'/auths.php'; diff --git a/shared/requests.php b/shared/requests.php index 067a7a5..19a71b3 100644 --- a/shared/requests.php +++ b/shared/requests.php @@ -26,18 +26,50 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku) { $arch = $arch[0]; } + if($sku == 125 || $sku == 126 || $sku == 7 || $sku == 8 || $sku == 120 || $sku == 145 || $sku == 146 || $sku == 168) + $blockUpgrades = 1; + + $fltContent = 'Mainline'; + $fltRing = 'External'; + if($ring == 'RETAIL') { + $fltBranch = ''; + $fltContent = ''; + $fltRing = 'Retail'; $flightEnabled = 0; $isRetail = 1; } - if($sku == 125 || $sku == 126) - $blockUpgrades = 1; + if($ring == 'WIF') { + $fltBranch = 'Dev'; + } + + if($ring == 'WIS') { + $fltBranch = 'Beta'; + } + + if($ring == 'RP') { + $fltBranch = 'ReleasePreview'; + } + + if($ring == 'MSIT') { + $fltBranch = 'MSIT'; + $fltRing = 'Internal'; + } + + $bldnum = explode('.', $build); + $bldnum = $bldnum[2]; + + if($bldnum < 17763) { + $fltBranch = 'external'; + $fltContent = $flight; + $fltRing = $ring; + } $attrib = array( 'App=WU_OS', 'AppVer='.$build, - 'AttrDataVer=96', + 'AttrDataVer=99', 'BlockFeatureUpdates='.$blockUpgrades, 'BranchReadinessLevel=CB', 'CurrentBranch='.$branch, @@ -48,9 +80,9 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku) { 'DeviceFamily=Windows.Desktop', 'EKB19H2InstallCount=1', 'EKB19H2InstallTimeEpoch=1255000000', - 'FlightContent='.$flight, - 'FlightRing='.$ring, - 'FlightingBranchName=external', + 'FlightingBranchName='.$fltBranch, + 'FlightContent='.$fltContent, + 'FlightRing='.$fltRing, 'Free=32to64', 'GStatus_20H1=2', 'GStatus_20H1Setup=2', @@ -124,6 +156,10 @@ function branchFromBuild($build) { $branch = 'vb_release'; break; + case 19042: //19042 is a fake build based on 19041 + $branch = 'vb_release'; + break; + default: $branch = 'rs_prerelease'; break; @@ -206,7 +242,7 @@ function composeFetchUpdRequest($device, $encData, $arch, $flight, $ring, $build $branch = branchFromBuild($build); - if($sku == 7 || $sku == 8) { + if($sku == 7 || $sku == 8 || $sku == 120 || $sku == 145 || $sku == 146 || $sku == 168) { $mainProduct = 'Server.OS'; } else { $mainProduct = 'Client.OS.rs2';