summaryrefslogtreecommitdiffstats
path: root/modules-available/locationinfo/api.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/locationinfo/api.inc.php')
-rw-r--r--modules-available/locationinfo/api.inc.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/modules-available/locationinfo/api.inc.php b/modules-available/locationinfo/api.inc.php
index 1a3bd76e..cd2ffd5a 100644
--- a/modules-available/locationinfo/api.inc.php
+++ b/modules-available/locationinfo/api.inc.php
@@ -42,6 +42,8 @@ function HandleParameters()
$output = LocationInfo::getCalendar($locationIds, time() + 3);
} elseif ($get === "manifest") {
$output = generateManifest($uuid);
+ } elseif ($get === 'list') {
+ $output = generatePublicPanelList();
}
if ($output !== null) {
Header('Content-Type: application/json; charset=utf-8');
@@ -170,4 +172,26 @@ function generateManifest(string $uuid): array
];
}
return $data;
+}
+
+function generatePublicPanelList(): array
+{
+ $base = Util::shouldRedirectDomain();
+ if ($base !== null) {
+ $base = 'https://' . $base;
+ } else {
+ $base = ($_SERVER['HTTPS'] ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'];
+ }
+ $result = [
+ 'server_name' => 'To be filled by O.E.M.',
+ 'panels' => [],
+ ];
+ $res = Database::simpleQuery("SELECT paneluuid, panelname FROM locationinfo_panel WHERE ispublic = 1");
+ foreach ($res as $row) {
+ $result['panels'][] = [
+ 'title' => $row['panelname'],
+ 'url' => $base . '/panel/' . $row['paneluuid'],
+ ];
+ }
+ return $result;
} \ No newline at end of file