From 6e55605fb274d2346dbca640d711201a5e491b62 Mon Sep 17 00:00:00 2001 From: eraseyourknees <112027564+eraseyourknees@users.noreply.github.com> Date: Mon, 29 Aug 2022 17:33:10 +0200 Subject: [PATCH 1/6] Update readme --- readme.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index cd18c19..000fbcc 100644 --- a/readme.md +++ b/readme.md @@ -82,7 +82,7 @@ Parameters: - **Supported values:** any update UUID -#### updateinfo.php: `uupUpdateInfo($updateId, $onlyInfo);` +#### updateinfo.php: `uupUpdateInfo($updateId, $onlyInfo, $ignoreFiles);` Outputs specified information of specified `updateId`. Parameters: @@ -92,12 +92,36 @@ Parameters: - `onlyInfo` - Key to output - **Supported values:** any string + - `ignoreFiles` - Skips the `files` key in the output + - **Supported values:** `true` or `false` + #### shared/main.php: `uupApiVersion();` Returns version of the API. Parameters: - None +#### shared/utils.php: `uupApiCheckUpdateId($updateId);` +Checks if the provided update ID is correctly formatted. + +Parameters: + - `updateId` - update ID to check + - **Supported values:** Any string + +#### shared/utils.php: `uupApiIsServer($skuId);` +Checks if the provided SKU ID is a Windows Sever SKU. + +Parameters: + - `skuId` - SKU ID to check + - **Supported values:** Any integer + +#### shared/utils.php: `uupApiBuildMajor($build);` +Returns a build major of the build number. + +Parameters: + - `build` - Build number (for example 22621.1) to split + - **Supported values:** Any correctly formatted build number + ### Error codes thrown by API **fetchupd.php** - UNKNOWN_ARCH From 0ea0de8c2c41126dca576df3d2b5139ad69bdca5 Mon Sep 17 00:00:00 2001 From: eraseyourknees <112027564+eraseyourknees@users.noreply.github.com> Date: Tue, 6 Sep 2022 17:22:36 +0200 Subject: [PATCH 2/6] Add curl timeouts --- shared/utils.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shared/utils.php b/shared/utils.php index 6c8284c..0c97bd6 100644 --- a/shared/utils.php +++ b/shared/utils.php @@ -64,6 +64,8 @@ function sendWuPostRequest($url, $postData) { curl_setopt($req, CURLOPT_RETURNTRANSFER, 1); curl_setopt($req, CURLOPT_ENCODING, ''); curl_setopt($req, CURLOPT_POSTFIELDS, $postData); + curl_setopt($req, CURLOPT_CONNECTTIMEOUT, 5); + curl_setopt($req, CURLOPT_TIMEOUT, 15); curl_setopt($req, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($req, CURLOPT_HTTPHEADER, array( 'User-Agent: Windows-Update-Agent/10.0.10011.16384 Client-Protocol/2.50', From a3c006570659545ca056d5ec4c5e08ce8a3eecfe Mon Sep 17 00:00:00 2001 From: eraseyourknees <112027564+eraseyourknees@users.noreply.github.com> Date: Tue, 6 Sep 2022 17:22:54 +0200 Subject: [PATCH 3/6] 1.35.1 --- shared/main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/main.php b/shared/main.php index 4b5851a..26ee88e 100644 --- a/shared/main.php +++ b/shared/main.php @@ -16,7 +16,7 @@ limitations under the License. */ function uupApiVersion() { - return '1.35.0'; + return '1.35.1'; } require_once dirname(__FILE__).'/auths.php'; From 749fd657692c919b8866cdfbde1d4d1170cb7c0e Mon Sep 17 00:00:00 2001 From: eraseyourknees <112027564+eraseyourknees@users.noreply.github.com> Date: Wed, 7 Sep 2022 01:03:23 +0200 Subject: [PATCH 4/6] Fix deprecated usage of str_contains --- shared/main.php | 2 +- shared/utils.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/shared/main.php b/shared/main.php index 26ee88e..84504c6 100644 --- a/shared/main.php +++ b/shared/main.php @@ -16,7 +16,7 @@ limitations under the License. */ function uupApiVersion() { - return '1.35.1'; + return '1.36.0-dev'; } require_once dirname(__FILE__).'/auths.php'; diff --git a/shared/utils.php b/shared/utils.php index 0c97bd6..0275a47 100644 --- a/shared/utils.php +++ b/shared/utils.php @@ -147,8 +147,11 @@ function uupApiIsServer($skuId) { } function uupApiBuildMajor($build) { - if(!str_contains($build, '.')) { + if($build == null) + return null; + + if(!str_contains($build, '.')) return intval($build); - } + return intval(explode('.', $build)[0]); } From 6a524aa0c0b65133874bd1a9e72982b8ee0a1e43 Mon Sep 17 00:00:00 2001 From: eraseyourknees <112027564+eraseyourknees@users.noreply.github.com> Date: Wed, 7 Sep 2022 01:28:19 +0200 Subject: [PATCH 5/6] Move download link replacements --- get.php | 2 +- shared/utils.php | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/get.php b/get.php index d98e437..596de3d 100644 --- a/get.php +++ b/get.php @@ -329,7 +329,7 @@ function uupGetFiles( $filesNew = array(); foreach($filesInfoKeys as $val) { $filesNew[$val] = $filesInfoList[$val]; - $filesNew[$val]['url'] = str_replace('http://tlu.dl.delivery.mp.microsoft.com', 'https://uupdump.sf.tlu.dl.delivery.mp.microsoft.com', $filesInfoList[$val]['url']); + $filesNew[$val]['url'] = uupApiFixDownloadLink($filesInfoList[$val]['url']); } $files = $filesNew; diff --git a/shared/utils.php b/shared/utils.php index 0275a47..6a78915 100644 --- a/shared/utils.php +++ b/shared/utils.php @@ -155,3 +155,14 @@ function uupApiBuildMajor($build) { return intval(explode('.', $build)[0]); } + +function uupApiFixDownloadLink($link) { + if($link == null) + return null; + + return str_replace( + 'http://tlu.dl.delivery.mp.microsoft.com', + 'https://uupdump.sf.tlu.dl.delivery.mp.microsoft.com', + $link + ); +} From e310ab42461dd3df348271810c864e039aec0216 Mon Sep 17 00:00:00 2001 From: eraseyourknees <112027564+eraseyourknees@users.noreply.github.com> Date: Wed, 7 Sep 2022 01:50:31 +0200 Subject: [PATCH 6/6] 1.36.0 --- shared/main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/main.php b/shared/main.php index 84504c6..96ba75b 100644 --- a/shared/main.php +++ b/shared/main.php @@ -16,7 +16,7 @@ limitations under the License. */ function uupApiVersion() { - return '1.36.0-dev'; + return '1.36.0'; } require_once dirname(__FILE__).'/auths.php';