diff options
author | RaindropsSys <contact@minteck.org> | 2023-04-02 23:03:02 +0200 |
---|---|---|
committer | RaindropsSys <contact@minteck.org> | 2023-04-02 23:03:02 +0200 |
commit | 02eda3e4c9b4ba718f1fff70b7328ed8cdd5e63b (patch) | |
tree | 6d1dec61008998aadc6b69f7e750712794d99324 /pages/api | |
parent | f559308a1b42a9036135d764374a8c007b7d70a9 (diff) | |
download | pluralconnect-02eda3e4c9b4ba718f1fff70b7328ed8cdd5e63b.tar.gz pluralconnect-02eda3e4c9b4ba718f1fff70b7328ed8cdd5e63b.tar.bz2 pluralconnect-02eda3e4c9b4ba718f1fff70b7328ed8cdd5e63b.zip |
Updated 35 files, added 11 files and deleted includes/components/search.inc (automated)
Diffstat (limited to 'pages/api')
-rw-r--r-- | pages/api/emergency-real.php | 10 | ||||
-rw-r--r-- | pages/api/emergency.php | 10 | ||||
-rw-r--r-- | pages/api/me.php | 2 | ||||
-rw-r--r-- | pages/api/pleasure-real.php | 6 | ||||
-rw-r--r-- | pages/api/pleasure.php | 6 | ||||
-rw-r--r-- | pages/api/plex-thumb.php | 2 | ||||
-rw-r--r-- | pages/api/plex.php | 2 | ||||
-rw-r--r-- | pages/api/pluralkit-integration.php | 8 | ||||
-rw-r--r-- | pages/api/wakeup-real.php | 6 | ||||
-rw-r--r-- | pages/api/wakeup.php | 6 |
10 files changed, 29 insertions, 29 deletions
diff --git a/pages/api/emergency-real.php b/pages/api/emergency-real.php index d0412c8..a67f549 100644 --- a/pages/api/emergency-real.php +++ b/pages/api/emergency-real.php @@ -9,18 +9,18 @@ if (!$isLoggedIn && !$isLowerLoggedIn) { global $_PROFILE; -$ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"]; +$ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ 'http' => [ 'method' => 'POST', 'header' => "Content-Type: text/plain\r\n" . - "Title: ⚠️🆘 EMERGENCY ⚠️🆘\r\n" . + "Title: " . formatPonypush("⚠️🆘 EMERGENCY ⚠️🆘") . "\r\n" . "Priority: urgent\r\n" . "Tags: emergency\r\n" . "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => "This is an emergency, " . $_PROFILE['name'] . " is in need of IMMEDIATE help. Please act now!" + 'content' => formatPonypush("This is an emergency, " . $_PROFILE['name'] . " is in need of IMMEDIATE help. Please act now!") ] ])); @@ -29,11 +29,11 @@ file_get_contents('https://' . $ntfy["server"] . '/emergency', false, stream_con 'method' => 'POST', 'header' => "Content-Type: text/plain\r\n" . - "Title: ⚠️🆘 EMERGENCY ⚠️🆘\r\n" . + "Title: " . formatPonypush("⚠️🆘 EMERGENCY ⚠️🆘") . "\r\n" . "Priority: urgent\r\n" . "Tags: emergency\r\n" . "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => "This is an emergency, " . $_PROFILE['name'] . " is in need of IMMEDIATE help. Please act now!" + 'content' => formatPonypush("This is an emergency, " . $_PROFILE['name'] . " is in need of IMMEDIATE help. Please act now!") ] ])); diff --git a/pages/api/emergency.php b/pages/api/emergency.php index 2f764b1..24c975a 100644 --- a/pages/api/emergency.php +++ b/pages/api/emergency.php @@ -9,18 +9,18 @@ if (!$isLoggedIn && !$isLowerLoggedIn) { global $_PROFILE; -$ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"]; +$ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ 'http' => [ 'method' => 'POST', 'header' => "Content-Type: text/plain\r\n" . - "Title: [Test] ⚠️🆘 EMERGENCY ⚠️🆘\r\n" . + "Title: " . formatPonypush("[Test] ⚠️🆘 EMERGENCY ⚠️🆘") . "\r\n" . "Priority: urgent\r\n" . "Tags: emergency\r\n" . "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => "[This notification is test] This is an emergency, " . $_PROFILE['name'] . " is in need of IMMEDIATE help. Please act now! [This notification is test]" + 'content' => formatPonypush("[This notification is test] This is an emergency, " . $_PROFILE['name'] . " is in need of IMMEDIATE help. Please act now! [This notification is test]") ] ])); @@ -29,11 +29,11 @@ file_get_contents('https://' . $ntfy["server"] . '/emergency', false, stream_con 'method' => 'POST', 'header' => "Content-Type: text/plain\r\n" . - "Title: [Test] ⚠️🆘 EMERGENCY ⚠️🆘\r\n" . + "Title: " . formatPonypush("[Test] ⚠️🆘 EMERGENCY ⚠️🆘") . "\r\n" . "Priority: urgent\r\n" . "Tags: emergency\r\n" . "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => "[This notification is test] This is an emergency, " . $_PROFILE['name'] . " is in need of IMMEDIATE help. Please act now! [This notification is test]" + 'content' => formatPonypush("[This notification is test] This is an emergency, " . $_PROFILE['name'] . " is in need of IMMEDIATE help. Please act now! [This notification is test]") ] ])); diff --git a/pages/api/me.php b/pages/api/me.php index 4f86549..5b13208 100644 --- a/pages/api/me.php +++ b/pages/api/me.php @@ -1,6 +1,6 @@ <?php -$app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); +$app = $GLOBALS["ColdHazeApp"]; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; diff --git a/pages/api/pleasure-real.php b/pages/api/pleasure-real.php index 5ac0039..122d994 100644 --- a/pages/api/pleasure-real.php +++ b/pages/api/pleasure-real.php @@ -22,18 +22,18 @@ if ($_PROFILE["login"] === "raindrops" && isset($frontRaindrops[0])) { $pony = "somepony"; } -$ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"]; +$ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; file_get_contents('https://' . $ntfy["server"] . '/pleasure', false, stream_context_create([ 'http' => [ 'method' => 'POST', 'header' => "Content-Type: text/plain\r\n" . - "Title: 🏩 $pony wants to play for a bit\r\n" . + "Title: " . formatPonypush("🏩 $pony wants to play for a bit") . "\r\n" . "Priority: high\r\n" . "Tags: pleasure\r\n" . "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => "Hey, $pony wants to play and have fun for a bit, get up!" + 'content' => formatPonypush("Hey, $pony wants to play and have fun for a bit, get up!") ] ])); diff --git a/pages/api/pleasure.php b/pages/api/pleasure.php index 705adfe..14abada 100644 --- a/pages/api/pleasure.php +++ b/pages/api/pleasure.php @@ -22,18 +22,18 @@ if ($_PROFILE["login"] === "raindrops" && isset($frontRaindrops[0])) { $pony = "somepony"; } -$ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"]; +$ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; file_get_contents('https://' . $ntfy["server"] . '/pleasure', false, stream_context_create([ 'http' => [ 'method' => 'POST', 'header' => "Content-Type: text/plain\r\n" . - "Title: [Test] 🏩 $pony wants to play for a bit\r\n" . + "Title: " . formatPonypush("[Test] 🏩 $pony wants to play for a bit") . "\r\n" . "Priority: high\r\n" . "Tags: pleasure\r\n" . "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => "[This is a test] Hey, $pony wants to play and have fun for a bit, get up!" + 'content' => formatPonypush("[This is a test] Hey, $pony wants to play and have fun for a bit, get up!") ] ])); diff --git a/pages/api/plex-thumb.php b/pages/api/plex-thumb.php index 4a20159..4009871 100644 --- a/pages/api/plex-thumb.php +++ b/pages/api/plex-thumb.php @@ -1,6 +1,6 @@ <?php -$app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); +$app = $GLOBALS["ColdHazeApp"]; if (isset($_GET["library"]) && isset($_GET["id"]) && is_numeric($_GET["library"]) && is_numeric($_GET["id"])) { header("Content-Type: image/jpg"); diff --git a/pages/api/plex.php b/pages/api/plex.php index a2fa739..00164c7 100644 --- a/pages/api/plex.php +++ b/pages/api/plex.php @@ -1,7 +1,7 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/random.inc"; -$app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); +$app = $GLOBALS["ColdHazeApp"]; function formatTitle($metadata) { if ($metadata['grandparentTitle']) { diff --git a/pages/api/pluralkit-integration.php b/pages/api/pluralkit-integration.php index 0efa8cb..69d99b1 100644 --- a/pages/api/pluralkit-integration.php +++ b/pages/api/pluralkit-integration.php @@ -2,14 +2,14 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/agewarning.inc"; -$app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); +$app = $GLOBALS["ColdHazeApp"]; $user = $_GET['user'] ?? null; $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"]; +$data = $GLOBALS["ColdHazeApp"]["webhook"]; -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]; +if (isset($GLOBALS["ColdHazeApp"]["ponytown"][$user])) { + $ponytown = $GLOBALS["ColdHazeApp"]["ponytown"][$user]; } else { header("HTTP/1.1 404 Not Found") and die(); } diff --git a/pages/api/wakeup-real.php b/pages/api/wakeup-real.php index fd113ba..f00d5ea 100644 --- a/pages/api/wakeup-real.php +++ b/pages/api/wakeup-real.php @@ -15,18 +15,18 @@ $frontRaindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/in $pony = "somepony"; if ($_PROFILE['login'] === "raindrops") $pony = $frontRaindrops[0]["display_name"]; else $pony = $frontCloudburst[0]["display_name"]; -$ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"]; +$ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ 'http' => [ 'method' => 'POST', 'header' => "Content-Type: text/plain\r\n" . - "Title: 🥱 Wake up!\r\n" . + "Title: " . formatPonypush("🥱 Wake up!") . "\r\n" . "Priority: high\r\n" . "Tags: wakeup\r\n" . "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => "Hey, $pony wants you to wake up!" + 'content' => formatPonypush("Hey, $pony wants you to wake up!") ] ])); diff --git a/pages/api/wakeup.php b/pages/api/wakeup.php index e4603ef..a5d2b9f 100644 --- a/pages/api/wakeup.php +++ b/pages/api/wakeup.php @@ -15,18 +15,18 @@ $frontRaindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/in $pony = "somepony"; if ($_PROFILE['login'] === "raindrops") $pony = $frontRaindrops[0]["display_name"]; else $pony = $frontCloudburst[0]["display_name"]; -$ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"]; +$ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ 'http' => [ 'method' => 'POST', 'header' => "Content-Type: text/plain\r\n" . - "Title: [Test] 🥱 Wake up!\r\n" . + "Title: " . formatPonypush("[Test] 🥱 Wake up!") . "\r\n" . "Priority: high\r\n" . "Tags: wakeup\r\n" . "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => "[This notification is test] Hey, $pony wants you to wake up! [This notification is test]" + 'content' => formatPonypush("[This notification is test] Hey, $pony wants you to wake up! [This notification is test]") ] ])); |