diff options
Diffstat (limited to 'api/pluralkit-integration.php')
-rw-r--r-- | api/pluralkit-integration.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/api/pluralkit-integration.php b/api/pluralkit-integration.php index 2736f67..0bc5d23 100644 --- a/api/pluralkit-integration.php +++ b/api/pluralkit-integration.php @@ -5,7 +5,11 @@ $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON, true); $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["webhook"]; -file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data.json", json_encode($input, JSON_PRETTY_PRINT)); +if (isset(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ponytown"][$user])) { + $ponytown = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ponytown"][$user]; +} else { + header("HTTP/1.1 404 Not Found") and die(); +} if ($user === null) { header("HTTP/1.1 500 Internal Server Error") and die(); @@ -39,6 +43,8 @@ if ($input["type"] === "CREATE_SWITCH" || $input["type"] === "UPDATE_SWITCH" || $ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"]; + file_put_contents("/mnt/ponytown-chat/tokens/" . $ponytown, $fronters["members"][0]["display_name"]); + if (count($fronters["members"]) > 1) { $context = stream_context_create([ 'http' => [ |