summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-12-10 22:27:08 +0100
committerMinteck <contact@minteck.org>2022-12-10 22:27:08 +0100
commit30303a3ad0d0f31d93c25f42bfd10d70e8277b72 (patch)
tree622964e7895c759232aff28230394aa5cc747be9 /api
parentf850a8a53efd719fef6c8784c5af7b89dd9a6a2f (diff)
downloadpluralconnect-30303a3ad0d0f31d93c25f42bfd10d70e8277b72.tar.gz
pluralconnect-30303a3ad0d0f31d93c25f42bfd10d70e8277b72.tar.bz2
pluralconnect-30303a3ad0d0f31d93c25f42bfd10d70e8277b72.zip
Update
Diffstat (limited to 'api')
-rw-r--r--api/camera.php6
-rw-r--r--api/pluralkit-integration.php30
2 files changed, 36 insertions, 0 deletions
diff --git a/api/camera.php b/api/camera.php
new file mode 100644
index 0000000..cbf7efc
--- /dev/null
+++ b/api/camera.php
@@ -0,0 +1,6 @@
+<?php
+
+if (!isset($_GET['t']) || preg_match("/[^a-zA-Z\d]/m", $_GET['t'])) die();
+
+header("Content-Type: image/jpeg");
+die(base64_decode(exec('ssh root@192.168.1.27 "cd /root/alarm; node open.js ' . $_GET['t'] . '"'))); \ No newline at end of file
diff --git a/api/pluralkit-integration.php b/api/pluralkit-integration.php
index 0bc5d23..6d1166c 100644
--- a/api/pluralkit-integration.php
+++ b/api/pluralkit-integration.php
@@ -93,6 +93,36 @@ if ($input["type"] === "CREATE_SWITCH" || $input["type"] === "UPDATE_SWITCH" ||
if ($system === "gdapd") {
$topic = "public-switches-raindrops";
+
+ if (count($fronters["members"]) > 0) {
+ file_get_contents('https://' . $ntfy["server"] . '/public-switches-fr', false, stream_context_create([
+ 'http' => [
+ 'method' => 'POST',
+ 'header' =>
+ "Content-Type: text/plain\r\n" .
+ "Title: 🐴 $name vient de switch\r\n" .
+ "Priority: default\r\n" .
+ "Tags: switch\r\n" .
+ "Actions: view, Voir sur Cold Haze, https://fr.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"]) . " est désormais au front"
+ ]
+ ]));
+ } else {
+ file_get_contents('https://' . $ntfy["server"] . '/public-switches-fr', false, stream_context_create([
+ 'http' => [
+ 'method' => 'POST',
+ 'header' =>
+ "Content-Type: text/plain\r\n" .
+ "Title: 🐴 $name vient de switch\r\n" .
+ "Priority: default\r\n" .
+ "Tags: switch\r\n" .
+ "Actions: view, Voir sur Cold Haze, https://fr.equestria.horse/, clear=true\r\n" .
+ "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
+ 'content' => "Le poney de trait est désormais au front"
+ ]
+ ]));
+ }
} else {
$topic = "public-switches-cloudburst";
}