From 79730cdd24fb41d07343cb56c5799b845e7dbcf7 Mon Sep 17 00:00:00 2001 From: eraseyourknees <112027564+eraseyourknees@users.noreply.github.com> Date: Thu, 15 Sep 2022 16:12:10 +0200 Subject: [PATCH 1/5] Add pack check helper function --- shared/main.php | 2 +- shared/utils.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/shared/main.php b/shared/main.php index 1bb826c..4b453b9 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-dev'; } require_once dirname(__FILE__).'/auths.php'; diff --git a/shared/utils.php b/shared/utils.php index 8c9c1cb..390a478 100644 --- a/shared/utils.php +++ b/shared/utils.php @@ -179,3 +179,7 @@ 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'); +} From 1cc48ae9d8b4bae9ac51dae69a6998f6f4e32b3f Mon Sep 17 00:00:00 2001 From: eraseyourknees <112027564+eraseyourknees@users.noreply.github.com> Date: Fri, 16 Sep 2022 00:24:18 +0200 Subject: [PATCH 2/5] Add config reader helper --- shared/utils.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/shared/utils.php b/shared/utils.php index 390a478..b3b4c3a 100644 --- a/shared/utils.php +++ b/shared/utils.php @@ -183,3 +183,12 @@ function uupApiWriteJson($path, $data) { 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; +} From f5f4795cd9ce6e73b56b8ac2560fd6f296650698 Mon Sep 17 00:00:00 2001 From: eraseyourknees <112027564+eraseyourknees@users.noreply.github.com> Date: Fri, 16 Sep 2022 00:34:44 +0200 Subject: [PATCH 3/5] Add support for the internal corpnet --- fetchupd.php | 3 ++- shared/requests.php | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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/requests.php b/shared/requests.php index a40977d..a94d02f 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)); } From c025da99dc3ee7d062a8a3ddf716f66091f77242 Mon Sep 17 00:00:00 2001 From: eraseyourknees <112027564+eraseyourknees@users.noreply.github.com> Date: Fri, 16 Sep 2022 00:45:03 +0200 Subject: [PATCH 4/5] Add fetching specific builds only --- shared/requests.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shared/requests.php b/shared/requests.php index a94d02f..aa89595 100644 --- a/shared/requests.php +++ b/shared/requests.php @@ -406,6 +406,9 @@ function composeFetchUpdRequest($device, $encData, $arch, $flight, $ring, $build $type ); + $syncCurrent = uupApiConfigIsTrue('fetch_sync_current_only'); + $syncCurrentStr = $syncCurrent ? 'true' : 'false'; + return << @@ -527,7 +530,7 @@ function composeFetchUpdRequest($device, $encData, $arch, $flight, $ring, $build - false + $syncCurrentStr $deviceAttributes $callerAttrib $products From cf34eea8e1bb7aa77f87a760ad3e133e448e21d0 Mon Sep 17 00:00:00 2001 From: eraseyourknees <112027564+eraseyourknees@users.noreply.github.com> Date: Fri, 16 Sep 2022 00:48:39 +0200 Subject: [PATCH 5/5] 1.39.0 --- shared/main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/main.php b/shared/main.php index 4b453b9..baca341 100644 --- a/shared/main.php +++ b/shared/main.php @@ -16,7 +16,7 @@ limitations under the License. */ function uupApiVersion() { - return '1.39.0-dev'; + return '1.39.0'; } require_once dirname(__FILE__).'/auths.php';