summaryrefslogtreecommitdiff
path: root/api/pluralkit-integration.php
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-10-18 08:59:09 +0200
committerMinteck <contact@minteck.org>2022-10-18 08:59:09 +0200
commit2c4ae43e688a9873e86211ea0e7aeb9ba770dd77 (patch)
tree17848d95522dab25d3cdeb9c4a6450e2a234861f /api/pluralkit-integration.php
parent108525534c28013cfe1897c30e4565f9893f3766 (diff)
downloadpluralconnect-2c4ae43e688a9873e86211ea0e7aeb9ba770dd77.tar.gz
pluralconnect-2c4ae43e688a9873e86211ea0e7aeb9ba770dd77.tar.bz2
pluralconnect-2c4ae43e688a9873e86211ea0e7aeb9ba770dd77.zip
Update
Diffstat (limited to 'api/pluralkit-integration.php')
-rw-r--r--api/pluralkit-integration.php8
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' => [