From 6679588e43b0f694421d48e4ddb071972a127dca Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Sun, 11 Jun 2023 16:47:34 +0200 Subject: Updated 11 files and added 2 files (automated) --- .idea/inspectionProfiles/Project_Default.xml | 3 +- assets/icons/evening.svg | 1 + includes/components/navigation.inc | 14 +- includes/components/planner.inc | 4 +- includes/external/addressbook/twitter-tag-to-id.js | 4 +- includes/luna.php | 2 +- includes/pages.json | 11 +- includes/util/functions.inc | 12 + pages/api/computer.php | 2 + pages/api/computername.php | 2 + pages/computers.inc | 6 +- pages/evening.inc | 262 +++++++++++++++++++++ pages/fronting.inc | 3 +- 13 files changed, 314 insertions(+), 12 deletions(-) create mode 100644 assets/icons/evening.svg create mode 100644 pages/evening.inc diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index a43a458..4558473 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -5,7 +5,7 @@ diff --git a/assets/icons/evening.svg b/assets/icons/evening.svg new file mode 100644 index 0000000..c18d9ef --- /dev/null +++ b/assets/icons/evening.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/includes/components/navigation.inc b/includes/components/navigation.inc index 478420d..4d0cc5e 100644 --- a/includes/components/navigation.inc +++ b/includes/components/navigation.inc @@ -118,13 +118,21 @@ $navigation_admin = [ "minimal" => false, "items" => [ time() >= 1686787200 ? null : [ - "name" => $pages["fronting"]["name"][$lang["_name"]], + "name" => "Front plannerEOL", "icon" => "/assets/icons/fronting.svg", "invert" => true, "link" => "/-/fronting", "stepped" => null, "private" => false ], + [ + "name" => $pages["evening"]["name"][$lang["_name"]] . (time() >= 1686787200 ? "" : "Beta"), + "icon" => "/assets/icons/evening.svg", + "invert" => true, + "link" => "/-/evening", + "stepped" => null, + "private" => false + ], [ "name" => $pages["profiles"]["name"][$lang["_name"]], "icon" => "/assets/icons/profiles.svg", @@ -173,8 +181,8 @@ $navigation_admin = [ "stepped" => null, "private" => true ], - [ - "name" => $pages["computers"]["name"][$lang["_name"]] . "EOL", + time() >= 1688169600 ? null : [ + "name" => "DevicesEOL", "icon" => "/assets/icons/computers.svg", "invert" => true, "link" => "/-/computers", diff --git a/includes/components/planner.inc b/includes/components/planner.inc index b5fc7a5..9385b67 100644 --- a/includes/components/planner.inc +++ b/includes/components/planner.inc @@ -577,7 +577,7 @@ if (fronting[system][date][id][0] === "lzlaq" || fronting[system][date][id][0] === "irxyh") { document.getElementById("edit-fronter-name").innerText = "merged members"; } else { - document.getElementById("edit-fronter-name").innerText = names[fronting[system][date][id][0]] ?? fronting[system][date][id][0]; + document.getElementById("edit-fronter-name").innerText = names[fronting[system][date][id][0]] ?? fronting[system][date][id][0] + " [" + fronting[system][date][id][0] + "]"; } document.getElementById("edit-fronter-date").innerText = display; @@ -863,7 +863,7 @@
- " style="width:24px;"> + " style="width:24px;"> [] Multiple merged members Other/unknown diff --git a/includes/external/addressbook/twitter-tag-to-id.js b/includes/external/addressbook/twitter-tag-to-id.js index 663f195..6abccc0 100644 --- a/includes/external/addressbook/twitter-tag-to-id.js +++ b/includes/external/addressbook/twitter-tag-to-id.js @@ -29,6 +29,8 @@ function sleep(ms) { Authorization: `Bearer ${app.twitter.bearer}` } })).data.data[0].id); - } catch (e) {} + } catch (e) { + console.error(e); + } } })(); \ No newline at end of file diff --git a/includes/luna.php b/includes/luna.php index ceb9266..4033a9e 100644 --- a/includes/luna.php +++ b/includes/luna.php @@ -15,6 +15,6 @@ file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, st "Title: " . formatPonypush("⚠️ Luna is out of support") . "\r\n" . "Tags: reminder\r\n" . "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush("Luna is now out of support on Windows, Linux, macOS, Chrome OS and Android. It is recommended that you uninstall the application before the servers are disabled later this summer.") + 'content' => formatPonypush("Luna is now out of support on Windows, Linux, macOS, Chrome OS and Android. It is recommended that you uninstall the application before the servers are disabled on July 1st.") ] ])); \ No newline at end of file diff --git a/includes/pages.json b/includes/pages.json index 4753214..9cb2bf5 100644 --- a/includes/pages.json +++ b/includes/pages.json @@ -15,7 +15,7 @@ }, "computers": { "name": { - "en": "Devices" + "en": "Devices [EOL]" }, "admin": true, "limited": false @@ -55,9 +55,16 @@ "admin": true, "limited": true }, + "evening": { + "name": { + "en": "Evening schedule" + }, + "admin": true, + "limited": true + }, "fronting": { "name": { - "en": "Front planner" + "en": "Front planner [EOL]" }, "admin": true, "limited": true diff --git a/includes/util/functions.inc b/includes/util/functions.inc index e64bc5a..ad54706 100644 --- a/includes/util/functions.inc +++ b/includes/util/functions.inc @@ -5,6 +5,18 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/bitset.inc"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/homepage.inc"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/random.inc"; +if (!function_exists("getLastFronted")) { + function getLastFronted($members, $id) { + foreach ($members as $member) { + if ($member["id"] === $id) { + return $member["_lastFronted"]; + } + } + + return -1; + } +} + if (!function_exists("createJob")) { function createJob($title, $options) { $job = [ diff --git a/pages/api/computer.php b/pages/api/computer.php index 7dce4b6..2c75183 100644 --- a/pages/api/computer.php +++ b/pages/api/computer.php @@ -1,5 +1,7 @@ = 1688169600) die(); + if (isset($_GET["chrome"])) { header("Access-Control-Allow-Origin: chrome-extension://" . preg_replace("/[^a-z]/m", "", $_GET["chrome"])); header("Access-Control-Allow-Credentials: true"); diff --git a/pages/api/computername.php b/pages/api/computername.php index 1a719b0..477a8e6 100644 --- a/pages/api/computername.php +++ b/pages/api/computername.php @@ -1,5 +1,7 @@ = 1688169600) die(); + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $_PROFILE; if (!$isLoggedIn) header("Location: /-/login") and die(); diff --git a/pages/computers.inc b/pages/computers.inc index 643fe87..55d8ec5 100644 --- a/pages/computers.inc +++ b/pages/computers.inc @@ -1,5 +1,9 @@ = 1688169600) { + peh_error("Page not found: computers", 404); +} + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $pagename; global $_USER; global $_PROFILE; $computer = []; $parts = explode("/", $pagename); @@ -897,7 +901,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc';

Click on a device to view information about it

- Luna and the Cold Haze Devices software are deprecated. These applications are now deprecated and monitoring devices through Luna is not supported anymore. Basic support and servers will be shut down in August 2023. + Luna and the Cold Haze Devices software are deprecated. These applications are now deprecated and monitoring devices through Luna is not supported anymore. Basic support and servers will be shut down on July 1st.
    diff --git a/pages/evening.inc b/pages/evening.inc new file mode 100644 index 0000000..6f9e7b8 --- /dev/null +++ b/pages/evening.inc @@ -0,0 +1,262 @@ + 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"] === "ynmuc"; + }))), + ...array_map(function ($i) { + $system = "gdapd"; + $i["_lastFronted"] = -1; + $id = $i["id"]; + $memberData = $i; + + $fronters = array_map(function ($item) { + return $item["id"]; + }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json"), true)["members"]); + + if (in_array($id, $fronters)) { + $i["_lastFronted"] = time(); + } else { + $switches = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json"), true); + + $thisMember = array_filter($switches, function ($item) use ($memberData) { + return in_array($memberData["id"], $item["members"]); + }); + + $thisMember = array_values($thisMember); + $frontingEnd = null; + + if (count($thisMember) > 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"; + }))) + ]; + + ?> + + + +
    +
    +
    +

    = 1686787200 ? "" : " (Beta)" ?>

    + +
    + The evening schedule will replace the fronting schedule starting June 15th. The fronting schedule page contains more information and shows the schedule up to that date. The evening schedule is experimental until then. +
    + +
    + +

    Click on the "Ignore" button to mark an evening as ignored and shift the schedule one day after. You can revert this by clicking on "Unignore".

    +
    +
      + +
    • + + "> + + with + + "> + + () +
    • + +
    +
    + + = 1686787200): ?> +

    +
    +
    +
    + + ">">
    + +
    +
    +
    +
    + + ">">
    + +
    +
    +
    + +
    +
    + + Unignore + + Ignore + +
    +
    + " : "" ?> + +
    +
    + + + diff --git a/pages/fronting.inc b/pages/fronting.inc index 9873b81..1c16a80 100644 --- a/pages/fronting.inc +++ b/pages/fronting.inc @@ -1,7 +1,8 @@ = 1686787200) { - peh_error("Page not found: fronting", 404); + header("Location: /evening"); + die(); } require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; -- cgit