From e95b208af90cc386a7d8d1bcab426727cf4f0121 Mon Sep 17 00:00:00 2001 From: Minteck Date: Wed, 21 Sep 2022 22:42:33 +0200 Subject: Update time --- api/pluralkit-integration.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'api/pluralkit-integration.php') diff --git a/api/pluralkit-integration.php b/api/pluralkit-integration.php index 262d4a6..98f4cb9 100644 --- a/api/pluralkit-integration.php +++ b/api/pluralkit-integration.php @@ -53,6 +53,26 @@ if ($input["type"] === "CREATE_SWITCH" || $input["type"] === "UPDATE_SWITCH" || ] ])); + if ($system === "gdapd") { + $topic = "public-switches-raindrops"; + } else { + $topic = "public-switches-cloudburst"; + } + + file_get_contents('https://' . $ntfy["server"] . '/' . $topic, false, stream_context_create([ + 'http' => [ + 'method' => 'POST', + 'header' => + "Content-Type: text/plain\r\n" . + "Title: 🐴 Switch occurred in the $name\r\n" . + "Priority: default\r\n" . + "Tags: switch\r\n" . + "Actions: view, Open on Cold Haze, https://ponies.equestria.horse/" . $fronters["members"][0]["name"] . "/, clear=true\r\n" . + "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), + 'content' => ($fronters["members"][0]["display_name"] ?? $fronters["members"][0]["name"]) . " switched in just now" + ] + ])); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data.json-res", "affected: " . $input["type"] . " (" . gettype($input["type"]) . ")") and die(); } else { file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data.json-res", "invalid method: " . $input["type"] . " (" . gettype($input["type"]) . ")") and die(); -- cgit