diff options
Diffstat (limited to 'api')
-rw-r--r-- | api/pluralkit-integration.php | 26 | ||||
-rw-r--r-- | api/test1.php | 9 |
2 files changed, 27 insertions, 8 deletions
diff --git a/api/pluralkit-integration.php b/api/pluralkit-integration.php index 6d1166c..b3badd7 100644 --- a/api/pluralkit-integration.php +++ b/api/pluralkit-integration.php @@ -1,5 +1,7 @@ <?php +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/agewarning.inc"; + $user = $_GET['user'] ?? null; $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON, true); @@ -34,8 +36,10 @@ if ($input['system_id'] === "7d9f543e-f742-40f6-9d07-86c3f2983124") { $lastFronter = json_decode(@file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/last.json"), true) ?? ""; if ($input["type"] === "CREATE_SWITCH" || $input["type"] === "UPDATE_SWITCH" || $input["type"] === "DELETE_SWITCH") { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/fronters")); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/switches")); + sleep(1.5); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json", file_get_contents("https://api.pluralkit.me/v2/systems/$input[system_id]/fronters")); + sleep(1.5); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json", file_get_contents("https://api.pluralkit.me/v2/systems/$input[system_id]/switches")); $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json"), true); $currentFronter = $fronters["members"][0]["id"]; @@ -45,6 +49,24 @@ if ($input["type"] === "CREATE_SWITCH" || $input["type"] === "UPDATE_SWITCH" || file_put_contents("/mnt/ponytown-chat/tokens/" . $ponytown, $fronters["members"][0]["display_name"]); + if (count($fronters["members"]) > 0) { + foreach ($fronters["members"] as $member) { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member["id"] . ".json")) { + $metadata = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member["id"] . ".json"), true); + + if (!isset($metadata["birth"])) { + showWarning($member["display_name"] ?? $member["name"], $member["name"], $system); + } else if (isset($metadata['birth']["age"]) && $metadata["birth"]["age"] === 0 && (!isset($metadata['birth']["year"]) || $metadata["birth"]["year"] < 1900)) { + showWarning($member["display_name"] ?? $member["name"], $member["name"], $system); + } else if (isset($metadata['birth']["year"]) && $metadata["birth"]["year"] < 1900) { + showWarning($member["display_name"] ?? $member["name"], $member["name"], $system); + } else if (!isset($metadata['birth']["year"]) && !isset($metadata['birth']["age"])) { + showWarning($member["display_name"] ?? $member["name"], $member["name"], $system); + } + } + } + } + if (count($fronters["members"]) > 1) { $context = stream_context_create([ 'http' => [ diff --git a/api/test1.php b/api/test1.php index 6d25f85..a8c9c97 100644 --- a/api/test1.php +++ b/api/test1.php @@ -1,8 +1,5 @@ <?php -$img = imagecreate(2048, 1024); -$color = imagecolorallocate($img, 255, 0, 0); - -header("Content-type: image/jpeg"); -imagejpeg($img); -imagedestroy($img);
\ No newline at end of file +die(); +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/agewarning.inc"; +showWarning("Zoom Zephyrwing", "zoomzephyrwing", "gdapd");
\ No newline at end of file |