Compare commits

..

27 Commits

Author SHA1 Message Date
21b1500490 Fix warning 2024-06-22 18:50:39 +02:00
fb2c89b2f8 Remove DesktopDeployment from appx sets 2024-06-21 21:07:17 +02:00
846feb2629 Update WU parameters 2024-06-21 15:37:16 +02:00
5e31a6f724 Add additional appx presence checks 2024-06-21 13:31:41 +02:00
faa3b7fa45 Add Appx presence check 2024-06-19 13:29:23 +02:00
42b1091c0b Save architecture used to fetch the build to fileinfo 2024-05-09 22:22:29 +02:00
aa2dbd2938 Add ProfessionalCountrySpecific 2024-04-19 23:01:21 +02:00
42c1c12405 Update auto branch detection for 26100 2024-04-17 21:35:02 +02:00
092e968f0c Initial WNC support
The value was revealed to me in a dream
2024-03-18 20:16:47 +01:00
d58f53de42 Fix broken minor support 2024-03-12 20:50:07 +01:00
ca81835609 Branch selection support 2024-02-28 18:38:42 +01:00
d10e24cf5b Ignore case of specified build 2023-11-11 03:39:16 +01:00
140613f657 Minor flags fixes 2023-11-09 20:36:28 +01:00
4694c8dc00 Add flags verification 2023-11-09 20:29:25 +01:00
0477fd5fa6 Gracefully handle lack of the cookie 2023-11-08 23:58:39 +01:00
1ef84cb879 Replace children's toy with real man's computer 2023-11-05 00:08:40 +01:00
9e618c405a 1.43.0 2023-11-03 20:23:10 +01:00
7711645f23 Update readme 2023-11-03 20:22:26 +01:00
d597a83422 Add option to provide optional fetch flags 2023-11-03 20:13:28 +01:00
d0bad95c11 1.42.1 2023-11-03 17:11:47 +01:00
2a57ae0fe6 Add fallback parameters 2023-11-03 17:10:43 +01:00
7bdc01bdb9 1.42.0 2023-10-29 01:40:56 +02:00
b13403cf59 Use uupApiGetPacks in get.php 2023-10-29 00:07:48 +02:00
5777ff09b6 listeditions.php cleanup 2023-10-28 23:17:34 +02:00
954547ea84 listlangs.php cleanup 2023-10-28 23:03:40 +02:00
db1e155c8d uupGetGenPacks -> uupApiGetPacks 2023-10-28 23:02:43 +02:00
543e4c52e4 Fix fltBranch warning 2023-10-24 22:36:44 +02:00
10 changed files with 255 additions and 141 deletions

View File

@ -21,6 +21,83 @@ require_once dirname(__FILE__).'/shared/cache.php';
require_once dirname(__FILE__).'/shared/fileinfo.php';
require_once dirname(__FILE__).'/listid.php';
function uupApiPrivateParseFlags($str) {
$split = explode('+', $str);
$flagsSafe = [];
if(isset($split[1])) {
$flags = array_unique(explode(',', strtolower($split[1])));
$flagsSafe = array_intersect(getAllowedFlags(), $flags);
}
return [$split[0], $flagsSafe];
}
function uupApiPrivateGetLatestBuild() {
$builds = array('22000.1');
$ids = uupListIds();
if(isset($ids['error'])) {
$ids['builds'] = array();
}
if(empty($ids['builds'])) {
$build = $builds[0];
} else {
$build = $ids['builds'][0]['build'];
}
return $build;
}
function uupApiPrivateGetAcceptableBranches() {
return [
'auto',
'rs2_release',
'rs3_release',
'rs4_release',
'rs5_release',
'rs5_release_svc_hci',
'19h1_release',
'vb_release',
'fe_release_10x',
'fe_release',
'co_release',
'ni_release',
'zn_release',
'ge_release',
'rs_prerelease',
];
}
function uupApiPrivateNormalizeFetchParams($params) {
$np = array_replace([
'arch' => 'amd64',
'ring' => 'WIF',
'flight' => 'Active',
'branch' => 'ge_release',
'build' => 'latest',
'minor' => 0,
'sku' => 48,
'type' => 'Production',
'flags' => [],
], $params);
if(!is_array($np['flags'])) $np['flags'] = [];
$np['arch'] = strtolower($np['arch']);
$np['ring'] = strtoupper($np['ring']);
$np['flight'] = ucwords(strtolower($np['flight']));
$np['branch'] = strtolower($np['branch']);
$np['build'] = strtolower($np['build']);
$np['minor'] = intval($np['minor']);
$np['sku'] = intval($np['sku']);
$np['type'] = ucwords(strtolower($np['type']));
$np['flags'] = array_map('strtolower', $np['flags']);
return $np;
}
function uupFetchUpd(
$arch = 'amd64',
$ring = 'WIF',
@ -31,33 +108,46 @@ function uupFetchUpd(
$type = 'Production',
$cacheRequests = 0
) {
[$build, $flags] = uupApiPrivateParseFlags($build);
$params = [
'arch' => $arch,
'ring' => $ring,
'flight' => $flight,
'build' => $build,
'minor' => $minor,
'sku' => $sku,
'type' => $type,
'flags' => $flags,
];
return uupFetchUpd2($params, $cacheRequests);
}
function uupFetchUpd2($params, $cacheRequests = 0) {
uupApiPrintBrand();
$arch = strtolower($arch);
$ring = strtoupper($ring);
$flight = ucwords(strtolower($flight));
$np = uupApiPrivateNormalizeFetchParams($params);
$arch = $np['arch'];
$ring = $np['ring'];
$flight = 'Active';
$branch = $np['branch'];
$build = $np['build'];
$minor = $np['minor'];
$sku = $np['sku'];
$type = $np['type'];
$flags = $np['flags'];
if($build == 'latest' || (!$build)) {
$builds = array('22000.1');
$flagsStr = implode(',', $flags);
$ids = uupListIds();
if(isset($ids['error'])) {
$ids['builds'] = array();
}
if(empty($ids['builds'])) {
$build = $builds[0];
} else {
$build = $ids['builds'][0]['build'];
}
unset($builds, $ids);
if(strtolower($build) == 'latest' || (!$build)) {
$build = uupApiPrivateGetLatestBuild();
}
$build = explode('.', $build);
if(isset($build[1])) $minor = intval($build[1]);
$build = intval($build[0]);
$sku = intval($sku);
if(!($arch == 'amd64' || $arch == 'x86' || $arch == 'arm64' || $arch == 'arm' || $arch == 'all')) {
return array('error' => 'UNKNOWN_ARCH');
@ -83,6 +173,9 @@ function uupFetchUpd(
return array('error' => 'ILLEGAL_MINOR');
}
if(!in_array($branch, uupApiPrivateGetAcceptableBranches()))
$branch = 'auto';
if($ring == 'DEV') $ring = 'WIF';
if($ring == 'BETA') $ring = 'WIS';
if($ring == 'RELEASEPREVIEW') $ring = 'RP';
@ -96,15 +189,15 @@ function uupFetchUpd(
$type = 'Production';
}
$res = "api-fetch-$arch-$ring-$flight-$build-$minor-$sku-$type";
$res = "api-fetch-$arch-$ring-$flight-$branch-$build-$flagsStr-$minor-$sku-$type";
$cache = new UupDumpCache($res);
$fromCache = $cache->get();
if($fromCache !== false) return $fromCache;
consoleLogger('Fetching information from the server...');
$composerArgs = [$arch, $flight, $ring, $build, $sku, $type];
$composerArgs = [$arch, $flight, $ring, $build, $sku, $type, $flags, $branch];
$out = sendWuPostRequestHelper('client', 'composeFetchUpdRequest', $composerArgs);
if($out['error'] != 200) {
if($out === false || $out['error'] != 200) {
consoleLogger('The request has failed');
return array('error' => 'WU_REQUEST_FAILED');
}
@ -130,7 +223,7 @@ function uupFetchUpd(
$num++;
consoleLogger("Checking build information for update {$num} of {$updatesNum}...");
$info = parseFetchUpdate($val, $out, $arch, $ring, $flight, $build, $sku, $type);
$info = parseFetchUpdate($val, $out, $arch, $ring, $flight, $build, $sku, $type, $flags, $branch);
if(isset($info['error'])) {
$errorCount++;
continue;
@ -160,7 +253,7 @@ function uupFetchUpd(
return $data;
}
function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku, $type) {
function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku, $type, $flags, $branch) {
$updateNumId = preg_replace('/<UpdateInfo><ID>|<\/ID>.*/i', '', $updateInfo);
$updates = preg_replace('/<Update>/', "\n<Update>", $out);
@ -338,7 +431,9 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
$temp['title'] = $updateTitle;
$temp['ring'] = $ring;
$temp['flight'] = $flight;
$temp['branch'] = $branch;
$temp['arch'] = $foundArch;
$temp['fetchArch'] = $arch == 'all' ? 'amd64' : $arch;
$temp['build'] = $foundBuild;
$temp['checkBuild'] = $build;
$temp['sku'] = $sku;
@ -351,6 +446,10 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
$temp['releasetype'] = $type;
}
if(!empty($flags)) {
$temp['flags'] = $flags;
}
$temp['created'] = time();
$temp['sha256ready'] = true;
$temp['files'] = $shaArray;

View File

@ -76,8 +76,10 @@ function uupGetFiles(
$info['sku'] = 48;
}
$genPack = [];
if($usePack) {
$genPack = uupGetGenPacks($build, $info['arch'], $updateId);
$genPack = uupApiGetPacks($updateId);
if(empty($genPack)) return array('error' => 'UNSUPPORTED_COMBINATION');
if(!isset($genPack[$usePack])) {
@ -298,7 +300,7 @@ function uupGetFiles(
$temp = preg_grep('/Windows(10|11)\.0-KB.*-baseless/i', $filesInfoKeys, PREG_GREP_INVERT);
if($appEdition) {
$temp = preg_grep('/.*?AggregatedMetadata.*?\.cab|.*?DesktopDeployment.*?\.cab/i', $temp);
$temp = preg_grep('/.*?AggregatedMetadata.*?\.cab/i', $temp);
} else if($build > 21380) {
$temp = preg_grep('/Windows(10|11)\.0-KB|SSU-.*?\....$|.*?AggregatedMetadata.*?\.cab|.*?DesktopDeployment.*?\.cab/i', $temp);
} else {
@ -372,6 +374,7 @@ function uupGetFiles(
'build' => $updateBuild,
'sku' => $updateSku,
'hasUpdates' => $hasUpdates,
'appxPresent' => uupAreAppxPresent($genPack),
'files' => $files,
];
@ -399,7 +402,7 @@ function uupGetOnlineFiles($updateId, $rev, $info, $cacheRequests, $type) {
$composerArgs = [$updateId, $info, $rev, $type];
$out = sendWuPostRequestHelper('clientSecured', 'composeFileGetRequest', $composerArgs);
if($out['error'] != 200) {
if($out === false || $out['error'] != 200) {
consoleLogger('The request has failed');
return array('error' => 'WU_REQUEST_FAILED');
}

View File

@ -1,6 +1,6 @@
<?php
/*
Copyright 2022 UUP dump API authors
Copyright 2023 UUP dump API authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -17,60 +17,35 @@ limitations under the License.
require_once dirname(__FILE__).'/shared/main.php';
require_once dirname(__FILE__).'/shared/packs.php';
require_once dirname(__FILE__).'/updateinfo.php';
function uupListEditions($lang = 'en-us', $updateId = 0) {
if($updateId) {
$info = uupUpdateInfo($updateId, false, true);
}
if(!$lang) {
return array('error' => 'UNSUPPORTED_LANG');
}
if(isset($info['info'])) $info = $info['info'];
$lang = strtolower($lang);
$genPack = uupApiGetPacks($updateId);
$fancyEditionNames = uupGetInfoTexts()['fancyEditionNames'];
if(isset($info['build'])) {
$build = explode('.', $info['build']);
$build = $build[0];
} else {
$build = 15063;
if(!isset($genPack[$lang])) {
return array('error' => 'UNSUPPORTED_LANG');
}
if(!isset($info['arch'])) {
$info['arch'] = null;
}
$editionList = [];
$editionListFancy = [];
$genPack = uupGetGenPacks($build, $info['arch'], $updateId);
$fancyTexts = uupGetInfoTexts();
$fancyEditionNames = $fancyTexts['fancyEditionNames'];
if($lang) {
$lang = strtolower($lang);
if(!isset($genPack[$lang])) {
return array('error' => 'UNSUPPORTED_LANG');
}
}
$editionList = array();
$editionListFancy = array();
foreach(array_keys($genPack[$lang]) as $edition) {
if($edition == 'LXP') continue;
if($edition == 'FOD') continue;
if(in_array($edition, ['LXP', 'FOD'])) continue;
if(isset($fancyEditionNames[$edition])) {
$fancyName = $fancyEditionNames[$edition];
} else {
$fancyName = $edition;
}
$fancyName = isset($fancyEditionNames[$edition]) ? $fancyEditionNames[$edition] : $edition;
$editionList[] = $edition;
$editionListFancy[$edition] = $fancyName;
}
return array(
return [
'apiVersion' => uupApiVersion(),
'editionList' => $editionList,
'editionFancyNames' => $editionListFancy,
);
];
}

View File

@ -1,6 +1,6 @@
<?php
/*
Copyright 2022 UUP dump API authors
Copyright 2023 UUP dump API authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -19,63 +19,45 @@ require_once dirname(__FILE__).'/shared/main.php';
require_once dirname(__FILE__).'/shared/packs.php';
require_once dirname(__FILE__).'/updateinfo.php';
function uupListLangs($updateId = 0) {
if($updateId) {
$info = uupUpdateInfo($updateId, false, true);
}
function uupListLangsInternal($updateId) {
$genPack = uupApiGetPacks($updateId);
$fancyLangNames = uupGetInfoTexts()['fancyLangNames'];
if(isset($info['info'])) {
$info = $info['info'];
unset($info['files']);
}
$langList = [];
$langListFancy = [];
if(isset($info['build'])) {
$build = explode('.', $info['build']);
$build = $build[0];
} else {
$build = 15063;
}
if(!isset($info['arch'])) {
$info['arch'] = null;
}
$genPack = uupGetGenPacks($build, $info['arch'], $updateId);
$fancyTexts = uupGetInfoTexts();
$fancyLangNames = $fancyTexts['fancyLangNames'];
$langList = array();
$langListFancy = array();
foreach($genPack as $key => $val) {
if(!count(array_diff(array_keys($val), array('LXP')))) {
continue;
}
if(!count(array_diff(array_keys($val), array('FOD')))) {
if(!count(array_diff(array_keys($val), ['LXP', 'FOD']))) {
continue;
}
if(isset($fancyLangNames[$key])) {
$fancyName = $fancyLangNames[$key];
} else {
$fancyName = $key;
}
$fancyName = isset($fancyLangNames[$key]) ? $fancyLangNames[$key] : $key;
$langList[] = $key;
$langListFancy[$key] = $fancyName;
}
if(isset($info)) {
return array(
'apiVersion' => uupApiVersion(),
'langList' => $langList,
'langFancyNames' => $langListFancy,
'updateInfo' => $info
);
} else {
return array(
'apiVersion' => uupApiVersion(),
'langList' => $langList,
'langFancyNames' => $langListFancy
);
}
return [
'langList' => $langList,
'langFancyNames' => $langListFancy,
'appxPresent' => uupAreAppxPresent($genPack),
];
}
function uupListLangs($updateId = 0, $returnInfo = true) {
if($returnInfo) {
$info = uupUpdateInfo($updateId, ignoreFiles: true);
$info = isset($info['info']) ? $info['info'] : false;
}
$langList = uupListLangsInternal($updateId);
$response = array_merge(
['apiVersion' => uupApiVersion()],
$langList
);
if($returnInfo) $response['updateInfo'] = $info;
return $response;
}

View File

@ -18,10 +18,10 @@ Parameters:
- **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
- **Supported values:** >= 9841 and <= PHP_INT_MAX-1
- `build` - Build number to use when fetching information. Can also be used to provide optional fetch flags in `major.minor+flag1,flag2` format.
- **Supported values:** Any correctly formatted build (`major` or `major.minor`) from range of 9841 and `PHP_INT_MAX-1`.
- `minor` - Build minor to use when fetching information
- `minor` - Build minor to use when fetching information. Unused when build is formatted in `major.minor` format
- **Supported values:** >= 0 and <= PHP_INT_MAX-1
- `sku` - SKU number to use when fetching information
@ -80,6 +80,8 @@ Outputs list of languages supported for specified Update ID.
Parameters:
- `updateId` - Update identifier (optional)
- **Supported values:** any update UUID
- `returnInfo` - Should the full update inforation be returned with a list of languages
- **Supported values:** `true` or `false`
#### updateinfo.php: `uupUpdateInfo($updateId, $onlyInfo, $ignoreFiles);`

View File

@ -60,6 +60,9 @@ function uupEncryptedData() {
if(empty($cookieInfo)) {
$data = sendWuPostRequestHelper('client', 'composeGetCookieRequest', [], false);
if($data === false || $data['error'] != 200)
return false;
$cookieInfo = uupSaveCookieFromResponse($data['out']);
}

View File

@ -16,7 +16,7 @@ limitations under the License.
*/
function uupApiVersion() {
return '1.41.0';
return '1.47.3';
}
require_once dirname(__FILE__).'/auths.php';

View File

@ -83,6 +83,7 @@ function uupGetInfoTexts() {
'PPIPRO' => 'Windows Team',
'PROFESSIONAL' => 'Windows Pro',
'PROFESSIONALN' => 'Windows Pro N',
'PROFESSIONALCOUNTRYSPECIFIC' => 'Windows Pro China Only',
'SERVERSTANDARD' => 'Windows Server Standard',
'SERVERSTANDARDCORE' => 'Windows Server Standard, Core',
'SERVERDATACENTER' => 'Windows Server Datacenter',
@ -202,7 +203,7 @@ function uupGetInfoTexts() {
);
}
function uupGetGenPacks($build = 15063, $arch = null, $updateId = null) {
function uupApiGetPacks($updateId) {
if(empty($updateId)) return [];
if(!file_exists('packs/'.$updateId.'.json.gz')) return [];
@ -212,3 +213,7 @@ function uupGetGenPacks($build = 15063, $arch = null, $updateId = null) {
$genPack = json_decode($genPack, 1);
return $genPack;
}
function uupGetGenPacks($build = 15063, $arch = null, $updateId = null) {
return uupApiGetPacks($updateId);
}

View File

@ -16,8 +16,10 @@ limitations under the License.
*/
// Composes DeviceAttributes parameter needed to fetch data
function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
$branch = branchFromBuild($build);
function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $flags, $branch) {
if($branch == 'auto')
$branch = branchFromBuild($build);
$blockUpgrades = 0;
$flightEnabled = 1;
$isRetail = 0;
@ -50,12 +52,12 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
$insType = 'FactoryOS';
}
$fltBranch = '';
$fltContent = 'Mainline';
$fltRing = 'External';
$flight = 'Active';
if($ring == 'RETAIL') {
$fltBranch = '';
$fltContent = $flight;
$fltRing = 'Retail';
$flightEnabled = 0;
@ -164,21 +166,22 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
'IsDeviceRetailDemo=0',
'IsFlightingEnabled='.$flightEnabled,
'IsRetailOS='.$isRetail,
'LCUVer=0.0.0.0',
'MediaBranch=',
'MediaVersion='.$build,
'CloudPBR=1',
'DUScan=1',
'OEMModel=Asus ROG Maximus Z690 Extreme',
'OEMModelBaseBoard=ROG MAXIMUS Z690 EXTREME',
'OEMName_Uncleaned=Contoso Corporation',
'OEMModel=21F6CTO1WW',
'OEMModelBaseBoard=21F6CTO1WW',
'OEMName_Uncleaned=LENOVO',
'OemPartnerRing=UPSFlighting',
'OSArchitecture='.$arch,
'OSSkuId='.$sku,
'OSUILocale=en-US',
'OSVersion='.$build,
'ProcessorIdentifier=Intel64 Family 6 Model 151 Stepping 2',
'ProcessorIdentifier=Intel64 Family 6 Model 186 Stepping 3',
'ProcessorManufacturer=GenuineIntel',
'ProcessorModel=12th Gen Intel(R) Core(TM) i9-12900K',
'ProcessorModel=13th Gen Intel(R) Core(TM) i7-1355U',
'ReleaseType='.$type,
'SdbVer_20H1=2000000000',
'SdbVer_19H1=2000000000',
@ -199,7 +202,10 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
'TPMVersion=2',
'UpdateManagementGroup=2',
'UpdateOfferedDays=0',
'UpgEx_GE24H2Setup=Green',
'UpgEx_GE24H2=Green',
'UpgEx_CU23H2=Green',
'UpgEx_NI23H2=Green',
'UpgEx_NI22H2=Green',
'UpgEx_CO21H2=Green',
'UpgEx_23H2=Green',
@ -212,15 +218,16 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
'UpgradeAccepted=1',
'UpgradeEligible=1',
'UserInPlaceUpgrade=1',
'VBSState=2',
'Version_RS5=2000000000',
'WuClientVer='.$build,
);
if(uupApiConfigIsTrue('fetch_sync_current_only')) {
if(in_array('thisonly', $flags)) {
$attrib[] = 'MediaBranch='.$branch;
}
if($ring == 'MSIT' && uupApiConfigIsTrue('allow_corpnet')) {
if(in_array('corpnet', $flags) && uupApiConfigIsTrue('allow_corpnet')) {
$attrib[] = 'DUInternal=1';
}
@ -289,6 +296,10 @@ function branchFromBuild($build) {
$branch = 'zn_release';
break;
case 26100:
$branch = 'ge_release';
break;
default:
$branch = 'rs_prerelease';
break;
@ -308,15 +319,23 @@ function composeFileGetRequest($updateId, $info, $rev = 1, $type = 'Production')
$created = gmdate(DATE_W3C, $createdTime);
$expires = gmdate(DATE_W3C, $expiresTime);
//$branch = branchFromBuild($info['checkBuild']);
$arch = 'amd64';
if(isset($info['fetchArch'])) {
$arch = $info['fetchArch'];
} elseif(isset($info['arch'])) {
$arch = $info['arch'];
}
$deviceAttributes = composeDeviceAttributes(
$info['flight'],
$info['ring'],
$info['checkBuild'],
$info['arch'],
$info['sku'],
$type
isset($info['flight']) ? $info['flight'] : 'Active',
isset($info['ring']) ? $info['ring'] : 'RETAIL',
isset($info['checkBuild']) ? $info['checkBuild'] : '10.0.19041.1',
$arch,
isset($info['sku']) ? $info['sku'] : 48,
$type,
isset($info['flags']) ? $info['flags'] : [],
isset($info['branch']) ? $info['branch'] : 'auto',
);
return <<<XML
@ -360,9 +379,12 @@ XML;
}
// Composes POST data for fetching the latest update information from Windows Update
function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type = 'Production') {
$device = uupDevice();
function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type = 'Production', $flags = [], $branch = 'auto') {
$encData = uupEncryptedData();
if($encData === false)
return false;
$device = uupDevice();
$uuid = genUUID();
$createdTime = time();
@ -373,7 +395,8 @@ function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type
$expires = gmdate(DATE_W3C, $expiresTime);
$cookieExpires = gmdate(DATE_W3C, $cookieExpiresTime);
$branch = branchFromBuild($build);
if($branch == 'auto')
$branch = branchFromBuild($build);
$mainProduct = 'Client.OS.rs2';
if(uupApiIsServer($sku)) {
@ -395,6 +418,10 @@ function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type
if($sku == 189) {
$mainProduct = 'WCOSDevice0.OS';
}
// WNC
if($sku == 210) {
$mainProduct = 'WNC.OS';
}
if($arch == 'all') {
$arch = array(
@ -448,11 +475,12 @@ function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type
$build,
$arch,
$sku,
$type
$type,
$flags,
$branch
);
$syncCurrent = uupApiConfigIsTrue('fetch_sync_current_only');
$syncCurrentStr = $syncCurrent ? 'true' : 'false';
$syncCurrent = in_array('thisonly', $flags) ? 'true' : 'false';
return <<<XML
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
@ -534,6 +562,7 @@ function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type
<int>2359977</int>
<int>24513870</int>
<int>28880263</int>
<int>296374060</int>
<int>3</int>
<int>30077688</int>
<int>30486944</int>
@ -575,7 +604,7 @@ function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type
</ExtendedUpdateInfoParameters>
<ClientPreferredLanguages/>
<ProductsParameters>
<SyncCurrentVersionOnly>$syncCurrentStr</SyncCurrentVersionOnly>
<SyncCurrentVersionOnly>$syncCurrent</SyncCurrentVersionOnly>
<DeviceAttributes>$deviceAttributes</DeviceAttributes>
<CallerAttributes>$callerAttrib</CallerAttributes>
<Products>$products</Products>

View File

@ -102,6 +102,9 @@ function sendWuPostRequestHelper(
];
$postData = call_user_func_array($postComposer, $postComposerArgs);
if($postData === false)
return false;
$data = sendWuPostRequestInternal($endpoints[$endpoint], $postData, $saveCookie);
if($data['error'] == 500 && preg_match('/<ErrorCode>(ConfigChanged|CookieExpired|InvalidCookie)<\/ErrorCode>/', $data['out'])) {
@ -187,3 +190,16 @@ function uupApiConfigIsTrue($config) {
return $data[$config] == true;
}
function getAllowedFlags() {
$flags = ['thisonly'];
if(uupApiConfigIsTrue('allow_corpnet'))
$flags[] = 'corpnet';
return $flags;
}
function uupAreAppxPresent($genPack) {
return isset($genPack['neutral']['APP']);
}