summaryrefslogtreecommitdiff
path: root/api/violette.php
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2024-03-29 22:05:35 +0100
committerRaindropsSys <raindrops@equestria.dev>2024-03-29 22:05:35 +0100
commit5860551daa0f60103ad24e93da29f401a653f144 (patch)
tree9ad97e04152a6edc11d5096c87880978df39086a /api/violette.php
parenta51979ad60074db84af78a06d30fcb888ccb0b03 (diff)
downloadpluralconnect-5860551daa0f60103ad24e93da29f401a653f144.tar.gz
pluralconnect-5860551daa0f60103ad24e93da29f401a653f144.tar.bz2
pluralconnect-5860551daa0f60103ad24e93da29f401a653f144.zip
Updated 20 files, added 6 files, deleted 144 files and renamed .idea/ponycule.iml (automated)
Diffstat (limited to 'api/violette.php')
-rw-r--r--api/violette.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/api/violette.php b/api/violette.php
new file mode 100644
index 0000000..1f6f4f0
--- /dev/null
+++ b/api/violette.php
@@ -0,0 +1,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)); \ No newline at end of file