Add option to skip retrieval of download links in get.php
This commit is contained in:
parent
4ca7678737
commit
365ab64480
6
get.php
6
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':
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
$webApiVersion = '0.1.1';
|
||||
$webApiVersion = '0.2.0';
|
||||
|
||||
function sendResponse($apiResponse) {
|
||||
global $webApiVersion;
|
||||
|
Loading…
Reference in New Issue
Block a user