summaryrefslogtreecommitdiff
path: root/includes/jobs/FrontersNotification.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/jobs/FrontersNotification.php')
-rw-r--r--includes/jobs/FrontersNotification.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/includes/jobs/FrontersNotification.php b/includes/jobs/FrontersNotification.php
index d95f273..f29a1e5 100644
--- a/includes/jobs/FrontersNotification.php
+++ b/includes/jobs/FrontersNotification.php
@@ -5,6 +5,12 @@ $_SERVER['DOCUMENT_ROOT'] = "../..";
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/composer/vendor/autoload.php';
use ColorThief\ColorThief;
+if (!function_exists("formatPonypush")) {
+ function formatPonypush($message) {
+ return "Update to Ponypush 3.1.0 or later — (\$PA1$\$" . base64_encode($message) . "\$\$)";
+ }
+}
+
$app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true);
$system = $options["system"];
@@ -48,12 +54,12 @@ if (count($fronters["members"]) > 1) {
'method' => 'POST',
'header' =>
"Content-Type: text/plain\r\n" .
- "Title: 🐴 Switch occurred in $name\r\n" .
+ "Title: " . formatPonypush("🐴 Switch occurred in $name") . "\r\n" .
"Priority: default\r\n" .
"Tags: switch\r\n" .
"Actions: view, Open " . $fronters["members"][0]["display_name"] . " on Cold Haze, https://ponies.equestria.horse/" . $fronters["members"][0]["name"] . "/, clear=true;view, Open " . $fronters["members"][1]["display_name"] . " on Cold Haze, https://ponies.equestria.horse/" . $fronters["members"][1]["name"] . "/, clear=true\r\n" .
"Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
- 'content' => ($fronters["members"][0]["display_name"] ?? $fronters["members"][0]["name"]) . " and " . ($fronters["members"][1]["display_name"] ?? $fronters["members"][1]["name"]) . " switched in just now"
+ 'content' => formatPonypush(($fronters["members"][0]["display_name"] ?? $fronters["members"][0]["name"]) . " and " . ($fronters["members"][1]["display_name"] ?? $fronters["members"][1]["name"]) . " switched in just now")
]
]);
} else if (count($fronters["members"]) > 0) {
@@ -62,12 +68,12 @@ if (count($fronters["members"]) > 1) {
'method' => 'POST',
'header' =>
"Content-Type: text/plain\r\n" .
- "Title: 🐴 Switch occurred in $name\r\n" .
+ "Title: " . formatPonypush("🐴 Switch occurred in $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"
+ 'content' => formatPonypush(($fronters["members"][0]["display_name"] ?? $fronters["members"][0]["name"]) . " switched in just now")
]
]);
} else {
@@ -76,12 +82,12 @@ if (count($fronters["members"]) > 1) {
'method' => 'POST',
'header' =>
"Content-Type: text/plain\r\n" .
- "Title: 🐴 Switch occurred in $name\r\n" .
+ "Title: " . formatPonypush("🐴 Switch occurred in $name") . "\r\n" .
"Priority: default\r\n" .
"Tags: switch\r\n" .
"Actions: view, Open on Cold Haze, https://ponies.equestria.horse/, clear=true\r\n" .
"Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
- 'content' => "The fallback pony switched in just now"
+ 'content' => formatPonypush("The fallback pony switched in just now")
]
]);
}