summaryrefslogtreecommitdiff
path: root/api/violette.php
blob: 1f6f4f06dc0bc162f5a8961b36107b18cd682524 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc";

$data = [
    "count" => 0,
    "ponies" => []
];

$list = scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true), "gdapd");

$data["count"] = count($list);
$data["ponies"] = array_values(array_filter(array_map(function ($i) {
    return [
        "url" => "https://ponycule.p.equestria.dev" . getAsset("gdapd", $i["id"] ?? "", "heads"),
        "label" => $i["display_name"] ?? $i["name"]
    ];
}, $list), function ($i) {
    return isset($i["url"]) && getAsset("gdapd", $i["id"] ?? "", "heads") !== null;
}));

header("Content-Type: application/json");
die(json_encode($data, JSON_PRETTY_PRINT));