summaryrefslogtreecommitdiff
path: root/pages/api/me.php
diff options
context:
space:
mode:
Diffstat (limited to 'pages/api/me.php')
-rw-r--r--pages/api/me.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/pages/api/me.php b/pages/api/me.php
new file mode 100644
index 0000000..817b106
--- /dev/null
+++ b/pages/api/me.php
@@ -0,0 +1,21 @@
+<?php
+
+$app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true);
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; global $isLowerLoggedIn;
+if (!$isLoggedIn && !$isLowerLoggedIn) header("Location: /-/login") and die();
+global $_PROFILE;
+
+header("Content-Type: application/json");
+
+if ($_PROFILE['login'] === "raindrops") {
+ die('{"name": "Raindrops System", "id": "raindrops", "pluralkit": "gdapd"}');
+} else if ($_PROFILE["login"] === "cloudburst") {
+ die('{"name": "Cloudburst System", "id": "cloudburst", "pluralkit": "ynmuc"}');
+} else {
+ die(json_encode([
+ "name" => $app["other"]["name"],
+ "id" => $app["other"]["slug"],
+ "pluralkit" => $app["other"]["id"]
+ ]));
+} \ No newline at end of file