diff --git a/fetchupd.php b/fetchupd.php index 69fa50a..c246a4a 100644 --- a/fetchupd.php +++ b/fetchupd.php @@ -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'); } diff --git a/shared/main.php b/shared/main.php index 1bb826c..baca341 100644 --- a/shared/main.php +++ b/shared/main.php @@ -16,7 +16,7 @@ limitations under the License. */ function uupApiVersion() { - return '1.38.0'; + return '1.39.0'; } require_once dirname(__FILE__).'/auths.php'; diff --git a/shared/requests.php b/shared/requests.php index a40977d..aa89595 100644 --- a/shared/requests.php +++ b/shared/requests.php @@ -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 << @@ -523,7 +530,7 @@ function composeFetchUpdRequest($device, $encData, $arch, $flight, $ring, $build - false + $syncCurrentStr $deviceAttributes $callerAttrib $products diff --git a/shared/utils.php b/shared/utils.php index 8c9c1cb..b3b4c3a 100644 --- a/shared/utils.php +++ b/shared/utils.php @@ -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; +}