summaryrefslogtreecommitdiff
path: root/pages/api/me.php
blob: 0e91189a07f772d506aa3e3306ef511403337add (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 = $GLOBALS["ColdHazeApp"];

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"] === "Moonglow") {
    die(json_encode([
        "valid" => true,
        "name" => "Moonglow",
        "id" => "moonglow",
        "pluralkit" => "hrbom",
        "avatar" => getAsset("hrbom"),
        "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"]
    ]));
}