forked from Business/AccountHub
Add "listapps" API
This commit is contained in:
parent
e5294bbecd
commit
627b7f9278
9
api.php
9
api.php
@ -296,6 +296,15 @@ switch ($VARS['action']) {
|
|||||||
} else {
|
} else {
|
||||||
exit(json_encode(["status" => "ERROR", "msg" => lang("no such code or code expired", false)]));
|
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:
|
default:
|
||||||
http_response_code(404);
|
http_response_code(404);
|
||||||
die(json_encode("404 Not Found: the requested action is not available."));
|
die(json_encode("404 Not Found: the requested action is not available."));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user