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/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 diff --git a/shared/main.php b/shared/main.php index 4b5851a..96ba75b 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.36.0'; } require_once dirname(__FILE__).'/auths.php'; diff --git a/shared/utils.php b/shared/utils.php index 6c8284c..6a78915 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', @@ -145,8 +147,22 @@ 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]); } + +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 + ); +}