summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-08-26 22:29:23 +0200
committerMinteck <contact@minteck.org>2022-08-26 22:29:23 +0200
commit09bd0164ebc020a54b944b7326dcba496fb5d82c (patch)
tree0c5e765e627ecc94e534ccb6e2bc83917d58dc4c /api
parenta2df9a69dcc14cb70118cda2ded499055e7ee358 (diff)
downloadpluralconnect-09bd0164ebc020a54b944b7326dcba496fb5d82c.tar.gz
pluralconnect-09bd0164ebc020a54b944b7326dcba496fb5d82c.tar.bz2
pluralconnect-09bd0164ebc020a54b944b7326dcba496fb5d82c.zip
idk when was the last commit so I'm making a new one - Violet Dawn
Diffstat (limited to 'api')
-rw-r--r--api/cloudburst-banners.php1
-rw-r--r--api/emergency-real.php7
-rw-r--r--api/emergency.php7
-rw-r--r--api/me.php6
-rw-r--r--api/pleasure-real.php23
-rw-r--r--api/pleasure.php23
-rw-r--r--api/pluralkit-integration.php4
-rw-r--r--api/raindrops-banners.php1
8 files changed, 63 insertions, 9 deletions
diff --git a/api/cloudburst-banners.php b/api/cloudburst-banners.php
index 6e1d654..5cf06f8 100644
--- a/api/cloudburst-banners.php
+++ b/api/cloudburst-banners.php
@@ -9,6 +9,7 @@ $data = [];
foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true) as $member) {
if ($member['name'] === "unknown") continue;
+ if ($member['name'] === "fusion") continue;
$data[$member['name']] = getMemberBannerData($member['id'], "ynmuc");
}
diff --git a/api/emergency-real.php b/api/emergency-real.php
index 20a918f..6a569e8 100644
--- a/api/emergency-real.php
+++ b/api/emergency-real.php
@@ -4,14 +4,17 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLogg
if (!$isLoggedIn) header("Location: /login") and die();
global $_PROFILE;
-file_get_contents('https://ntfy.sh/' . json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"], false, stream_context_create([
+$ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["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" .
"Priority: urgent\r\n" .
- "Tags: emergency",
+ "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!"
]
]));
diff --git a/api/emergency.php b/api/emergency.php
index eb2a054..9a0ed7f 100644
--- a/api/emergency.php
+++ b/api/emergency.php
@@ -4,14 +4,17 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLogg
if (!$isLoggedIn) header("Location: /login") and die();
global $_PROFILE;
-file_get_contents('https://ntfy.sh/' . json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"], false, stream_context_create([
+$ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["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" .
"Priority: urgent\r\n" .
- "Tags: emergency",
+ "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]"
]
]));
diff --git a/api/me.php b/api/me.php
index 048bcd4..d8117de 100644
--- a/api/me.php
+++ b/api/me.php
@@ -6,8 +6,8 @@ global $_PROFILE;
header("Content-Type: application/json");
-if ($_PROFILE['name'] === "Cloudburst System") {
- die('{"name": "Cloudburst System", "id": "cloudburst", "pluralkit": "ynmuc"}');
-} else {
+if ($_PROFILE['login'] === "raindrops") {
die('{"name": "Raindrops System", "id": "raindrops", "pluralkit": "gdapd"}');
+} else {
+ die('{"name": "Cloudburst System", "id": "cloudburst", "pluralkit": "ynmuc"}');
}
diff --git a/api/pleasure-real.php b/api/pleasure-real.php
new file mode 100644
index 0000000..992f659
--- /dev/null
+++ b/api/pleasure-real.php
@@ -0,0 +1,23 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn;
+if (!$isLoggedIn) header("Location: /login") and die();
+global $_PROFILE;
+
+if ($_PROFILE['login'] === "raindrops") $pony = "Cloudy"; else $pony = "Lavender";
+$ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"];
+
+file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([
+ 'http' => [
+ 'method' => 'POST',
+ 'header' =>
+ "Content-Type: text/plain\r\n" .
+ "Title: 🏩 $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!"
+ ]
+]));
+
+die(); \ No newline at end of file
diff --git a/api/pleasure.php b/api/pleasure.php
new file mode 100644
index 0000000..702fe2f
--- /dev/null
+++ b/api/pleasure.php
@@ -0,0 +1,23 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn;
+if (!$isLoggedIn) header("Location: /login") and die();
+global $_PROFILE;
+
+if ($_PROFILE['login'] === "raindrops") $pony = "Cloudy"; else $pony = "Lavender";
+$ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["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] 🏩 $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 notification is test] Hey, $pony wants to play and have fun for a bit, get up! [This notification is test]"
+ ]
+]));
+
+die(); \ No newline at end of file
diff --git a/api/pluralkit-integration.php b/api/pluralkit-integration.php
index d3f7e45..b2247ce 100644
--- a/api/pluralkit-integration.php
+++ b/api/pluralkit-integration.php
@@ -27,9 +27,9 @@ if ($input['system_id'] === "7d9f543e-f742-40f6-9d07-86c3f2983124") {
if ($input["type"] === "CREATE_SWITCH" || $input["type"] === "UPDATE_SWITCH" || $input["type"] === "DELETE_SWITCH") {
usleep(550000);
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system-fronters.json", file_get_contents("https://api.pluralkit.me/v2/systems/$input[system_id]/fronters"));
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system-fronters.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/fronters"));
usleep(550000);
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system-switches.json", file_get_contents("https://api.pluralkit.me/v2/systems/$input[system_id]/switches"));
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system-switches.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/switches"));
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();
diff --git a/api/raindrops-banners.php b/api/raindrops-banners.php
index 700786b..715d7c4 100644
--- a/api/raindrops-banners.php
+++ b/api/raindrops-banners.php
@@ -9,6 +9,7 @@ $data = [];
foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true) as $member) {
if ($member['name'] === "unknown") continue;
+ if ($member['name'] === "fusion") continue;
$data[$member['name']] = getMemberBannerData($member['id'], "gdapd");
}