From 4694c8dc003b06c33ead06bf6d9cfb9834de1665 Mon Sep 17 00:00:00 2001 From: orin Date: Thu, 9 Nov 2023 20:29:25 +0100 Subject: [PATCH] Add flags verification --- fetchupd.php | 8 +++++--- shared/main.php | 2 +- shared/utils.php | 9 +++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/fetchupd.php b/fetchupd.php index bc9fc46..af5e55f 100644 --- a/fetchupd.php +++ b/fetchupd.php @@ -25,10 +25,12 @@ function uupApiPrivateParseFlags($str) { $split = explode('+', $str); $flags = []; - if(isset($split[1])) - $flags = explode(',', strtolower($split[1])); + if(isset($split[1])) { + $flags = array_unique(explode(',', strtolower($split[1]))); + $flagsSafe = array_intersect(getAllowedFlags(), $flags); + } - return [$split[0], $flags]; + return [$split[0], $flagsSafe]; } function uupApiPrivateGetLatestBuild() { diff --git a/shared/main.php b/shared/main.php index 3707724..cf4998d 100644 --- a/shared/main.php +++ b/shared/main.php @@ -16,7 +16,7 @@ limitations under the License. */ function uupApiVersion() { - return '1.43.2'; + return '1.43.3'; } require_once dirname(__FILE__).'/auths.php'; diff --git a/shared/utils.php b/shared/utils.php index f406d76..f601a71 100644 --- a/shared/utils.php +++ b/shared/utils.php @@ -190,3 +190,12 @@ function uupApiConfigIsTrue($config) { return $data[$config] == true; } + +function getAllowedFlags() { + $flags = ['thisonly']; + + if(uupApiConfigIsTrue('allow_corpnet')) + $flags[] = 'corpnet'; + + return $flags; +}