From 365ab644806a5b0fa1952fe4fa3942cc0bb46e64 Mon Sep 17 00:00:00 2001 From: whatever127 <46111995+whatever127@users.noreply.github.com> Date: Mon, 16 Sep 2019 18:09:57 +0200 Subject: [PATCH] Add option to skip retrieval of download links in get.php --- get.php | 6 ++++-- readme.md | 5 ++++- shared/main.php | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/get.php b/get.php index 6ff5690..60cd2e5 100644 --- a/get.php +++ b/get.php @@ -6,17 +6,19 @@ require_once 'shared/ratelimits.php'; $updateId = isset($_GET['id']) ? $_GET['id'] : null; $usePack = isset($_GET['lang']) ? $_GET['lang'] : 0; $desiredEdition = isset($_GET['edition']) ? $_GET['edition'] : 0; +$noLinks = isset($_GET['noLinks']) ? $_GET['noLinks'] : 0; header('Content-Type: application/json'); $resource = hash('sha1', strtolower("get-$updateId-$usePack-$desiredEdition")); -if(checkIfUserIsRateLimited($resource)) { +if(checkIfUserIsRateLimited($resource) && !$noLinks) { http_response_code(429); sendResponse(['error' => 'USER_RATE_LIMITED']); die(); } -$apiResponse = uupGetFiles($updateId, $usePack, $desiredEdition, 1); +$mode = $noLinks ? 2 : 1; +$apiResponse = uupGetFiles($updateId, $usePack, $desiredEdition, $mode); if(isset($apiResponse['error'])) { switch($apiResponse['error']) { case 'NO_FILES': diff --git a/readme.md b/readme.md index e06859c..d5dadd0 100644 --- a/readme.md +++ b/readme.md @@ -20,7 +20,7 @@ Example response: Responses from the UUP dump API are always returned in the `response` key. -If requests fails, a HTTP error code will be set to: +If request fails, a HTTP error code will be set to: - `400` if request was malformed - `429` if user is being rate limited - `500` if retrieval of data was unsuccessful @@ -81,6 +81,9 @@ Parameters: - **Supported values:** any edition name - **NOTE:** You need to specify `lang` to get successful request + - `noLinks` - Do not retrieve download links for created UUP set (optional) + - **Supported values:** 0 = Disable, 1 = Enable + #### `/listlangs.php` Lists available languages for specified Update ID diff --git a/shared/main.php b/shared/main.php index 367201c..aaaba76 100644 --- a/shared/main.php +++ b/shared/main.php @@ -1,5 +1,5 @@