summaryrefslogtreecommitdiff
path: root/pages/api/me.php
blob: 4f8654905035f66aaaa0675268ec7b0264925589 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php

$app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true);

require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn;

header("Content-Type: application/json");

if (!$isLoggedIn && !$isLowerLoggedIn) die('{"valid": false}');
global $_PROFILE;

if ($_PROFILE['login'] === "raindrops") {
    die(json_encode([
        "valid" => true,
        "name" => "Raindrops System",
        "id" => "raindrops",
        "pluralkit" => "gdapd",
        "avatar" => getAsset("gdapd"),
        "email" => $_PROFILE["profile"]["email"]["email"]
    ]));
} else if ($_PROFILE["login"] === "cloudburst") {
    die(json_encode([
        "valid" => true,
        "name" => "Cloudburst System",
        "id" => "cloudburst",
        "pluralkit" => "ynmuc",
        "avatar" => getAsset("ynmuc"),
        "email" => $_PROFILE["profile"]["email"]["email"]
    ]));
} else {
    die(json_encode([
        "valid" => true,
        "name" => $app["other"]["name"],
        "id" => $app["other"]["slug"],
        "pluralkit" => $app["other"]["id"],
        "avatar" => getAsset($app["other"]["id"]),
        "email" => $_PROFILE["profile"]["email"]["email"]
    ]));
}