Merge pull request #25 from uup-dump-dev/master

1.39.0
This commit is contained in:
eraseyourknees 2022-09-21 17:03:48 +02:00 committed by GitHub
commit aeb86d4333
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 3 deletions

View File

@ -283,7 +283,8 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
return array('error' => 'BROKEN_UPDATE');
}
if(preg_match('/Corpnet Required/i', $updateTitle)) {
$isCorpnet = preg_match('/Corpnet Required/i', $updateTitle);
if($isCorpnet && !uupApiConfigIsTrue('allow_corpnet')) {
consoleLogger('Skipping corpnet only update...');
return array('error' => 'CORPNET_ONLY_UPDATE');
}

View File

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

View File

@ -184,6 +184,10 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type) {
'WuClientVer='.$build,
);
if($ring == 'MSIT' && uupApiConfigIsTrue('allow_corpnet')) {
$attrib[] = 'DUInternal=1';
}
return htmlentities('E:'.implode('&', $attrib));
}
@ -402,6 +406,9 @@ function composeFetchUpdRequest($device, $encData, $arch, $flight, $ring, $build
$type
);
$syncCurrent = uupApiConfigIsTrue('fetch_sync_current_only');
$syncCurrentStr = $syncCurrent ? '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">
<s:Header>
@ -523,7 +530,7 @@ function composeFetchUpdRequest($device, $encData, $arch, $flight, $ring, $build
</ExtendedUpdateInfoParameters>
<ClientPreferredLanguages/>
<ProductsParameters>
<SyncCurrentVersionOnly>false</SyncCurrentVersionOnly>
<SyncCurrentVersionOnly>$syncCurrentStr</SyncCurrentVersionOnly>
<DeviceAttributes>$deviceAttributes</DeviceAttributes>
<CallerAttributes>$callerAttrib</CallerAttributes>
<Products>$products</Products>

View File

@ -179,3 +179,16 @@ function uupApiReadJson($path) {
function uupApiWriteJson($path, $data) {
return file_put_contents($path, json_encode($data)."\n");
}
function uupApiPacksExist($updateId) {
return file_exists('packs/'.$updateId.'.json.gz');
}
function uupApiConfigIsTrue($config) {
$data = uupDumpApiGetConfig();
if(!isset($data[$config]))
return false;
return $data[$config] == true;
}