From d189daf93ac17a151f093d416f8d61bdb9efe8c5 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Wed, 27 Dec 2023 00:00:30 +0100 Subject: Updated 2 files and added pages/schedule.inc (automated) --- includes/external/signal/index.js | 1 + includes/pages.json | 4 +- pages/schedule.inc | 248 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 251 insertions(+), 2 deletions(-) create mode 100644 pages/schedule.inc diff --git a/includes/external/signal/index.js b/includes/external/signal/index.js index 8bb6c05..7531fb5 100644 --- a/includes/external/signal/index.js +++ b/includes/external/signal/index.js @@ -60,6 +60,7 @@ const child_process = require("child_process"); fs.writeFileSync("/tmp/chm-" + user + "-pfp-final", pfp); child_process.execFileSync("signal-cli", [ "-a", number, "updateProfile", "--given-name", name, "--family-name", "", "--avatar", "/tmp/chm-" + user + "-pfp-final" ]); + child_process.execFileSync("signal-cli", [ "-a", number, "updateAccount", "--device-name", "Ponycule to Signal integration (v" + new Date().toISOString().split("T")[0].replaceAll("-", ".") + ")" ]); child_process.execFileSync("signal-cli", [ "-a", number, "sendSyncRequest" ]); fs.unlinkSync("/tmp/chm-" + user + "-pfp-final"); })(); \ No newline at end of file diff --git a/includes/pages.json b/includes/pages.json index 75dfdd6..09c5fe2 100644 --- a/includes/pages.json +++ b/includes/pages.json @@ -76,9 +76,9 @@ "admin": true, "limited": true }, - "schedules": { + "schedule": { "name": { - "en": "Schedules" + "en": "Raindrops System schedule" }, "admin": true, "limited": true diff --git a/pages/schedule.inc b/pages/schedule.inc new file mode 100644 index 0000000..f61d43b --- /dev/null +++ b/pages/schedule.inc @@ -0,0 +1,248 @@ + 0) { + $thisIndex = array_search($thisMember[0], $switches); + + $frontingStart = $thisMember[0]; + $frontingEnd = $switches[$thisIndex - 1]; + } + + if ($frontingEnd !== null && isset($frontingStart)) { + $i["_lastFronted"] = strtotime($frontingEnd["timestamp"]); + } + } + + return $i; +}, array_values(array_filter(scoreOrderGlobal(), function ($i) { + return $i["_system"] === "gdapd"; +}))); + +if (isset($_GET["ignore"]) && isset($_GET["day"])) { + if ($_GET["ignore"] === "1") { + if (preg_match("/^\d{4}-\d{2}-\d{2}$/m", $_GET["day"]) === false) { + header("Location: /-/schedule"); + die(); + } + + if (!in_array($_GET["day"], $ignored)) { + $ignored[] = $_GET["day"]; + } + + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/schedule/ignored.json", json_encode($ignored)); + header("Location: /-/schedule"); + die(); + } elseif ($_GET["ignore"] === "0") { + if (preg_match("/^\d{4}-\d{2}-\d{2}$/m", $_GET["day"]) === false) { + header("Location: /-/schedule"); + die(); + } + + if (in_array($_GET["day"], $ignored)) { + unset($ignored[array_search($_GET["day"], $ignored)]); + } + + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/schedule/ignored.json", json_encode($ignored)); + header("Location: /-/schedule"); + die(); + } + + die(); +} + + +?> + + + +
+
+
+ +

Raindrops System schedule

+
+
    + " . (getMemberWithoutSystem($id)["display_name"] ?? getMemberWithoutSystem($id)["name"]) . ""); + } else { + echo("
  • NULL (" . $id . ")
  • "); + } + } ?> +
+
    + 0) $times[] = getLastFronted($members, $id); + } + + $timeA = time() - min($times); + $times = []; + + foreach ($b as $id) { + if (getLastFronted($members, $id) > 0) $times[] = getLastFronted($members, $id); + } + + $timeB = time() - min($times); + + if ($timeA < 5 || $timeB < 5) { + return -INF; + } else { + return $timeB - $timeA; + } + }); $pairsM = array_values($pairs); foreach ($pairsM as $pair): $times = []; ?> +
  • + + "> + + () +
  • + +
+
    + 0) $times[] = getLastFronted($members, $id); + } + + $timeA = time() - min($times); + $times = []; + + foreach ($b as $id) { + if (getLastFronted($members, $id) > 0) $times[] = getLastFronted($members, $id); + } + + $timeB = time() - min($times); + + if ($timeA < 5 || $timeB < 5) { + return -INF; + } else { + return $timeB - $timeA; + } + }); $pairsM = array_values($pairs2); foreach ($pairsM as $pair): $times = []; ?> +
  • + + "> + + () +
  • + +
+
+ + +
+
+
+ During the day: +
+
+ + ">"> + and + +
+
+ In the evening: +
+
+ + ">"> + and + Nopony on this day"); endif; ?> +
+
+ +
+ +
+ + -- cgit