Add "listapps" API

V2_Rewrite
Skylar Ittner 6 years ago
parent e5294bbecd
commit 627b7f9278

@ -296,6 +296,15 @@ switch ($VARS['action']) {
} else {
exit(json_encode(["status" => "ERROR", "msg" => lang("no such code or code expired", false)]));
}
case "listapps":
$apps = EXTERNAL_APPS;
// Format paths as absolute URLs
foreach ($apps as $k => $v) {
if (strpos($apps[$k]['url'], "http") === FALSE) {
$apps[$k]['url'] = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://" . $_SERVER['HTTP_HOST'] . ($_SERVER['SERVER_PORT'] != 80 || $_SERVER['SERVER_PORT'] != 443 ? ":" . $_SERVER['SERVER_PORT'] : "") . $apps[$k]['url'];
}
}
exit(json_encode(["status" => "OK", "apps" => $apps]));
default:
http_response_code(404);
die(json_encode("404 Not Found: the requested action is not available."));

Loading…
Cancel
Save