diff options
-rw-r--r-- | .idea/deployment.xml | 4 | ||||
-rw-r--r-- | _icons/disable.svg | 1 | ||||
-rw-r--r-- | includes/kiosk/dev.equestria.delta.kiosk.RejectLogin/index.php | 32 | ||||
-rw-r--r-- | includes/kiosk/dev.equestria.delta.kiosk.RequestApproval/index.php | 42 | ||||
-rw-r--r-- | includes/navigation.php | 10 | ||||
-rw-r--r-- | lang/en.json | 4 | ||||
-rw-r--r-- | lang/fr.json | 11 | ||||
-rw-r--r-- | logout/action/index.php | 6 | ||||
-rw-r--r-- | pass/index.php | 7 | ||||
-rw-r--r-- | plus/subscribe/index.php | 2 | ||||
-rw-r--r-- | version | 2 |
11 files changed, 98 insertions, 23 deletions
diff --git a/.idea/deployment.xml b/.idea/deployment.xml index 5b40d78..9c9d978 100644 --- a/.idea/deployment.xml +++ b/.idea/deployment.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> - <component name="PublishConfigData" autoUpload="Always" serverName="Minteck.org" remoteFilesAllowedToDisappearOnAutoupload="false"> + <component name="PublishConfigData" autoUpload="Always" serverName="zephyrheights" remoteFilesAllowedToDisappearOnAutoupload="false"> <serverData> - <paths name="Minteck.org"> + <paths name="zephyrheights"> <serverdata> <mappings> <mapping deploy="/mnt/delta" local="$PROJECT_DIR$" web="/" /> diff --git a/_icons/disable.svg b/_icons/disable.svg new file mode 100644 index 0000000..8ad4255 --- /dev/null +++ b/_icons/disable.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 96 960 960" width="48" fill="#000000"><path d="M278 779q-84.583 0-143.792-59.191Q75 660.618 75 576.059t59.208-143.809Q193.417 373 278 373h404q84.583 0 143.792 59.191Q885 491.382 885 575.941T825.792 719.75Q766.583 779 682 779H278Zm.286-35H682q68.875 0 118.438-49.001Q850 645.998 850 575.911q0-70.086-49.562-118.999Q750.875 408 682 408H278.286q-70.168 0-119.227 48.965Q110 505.929 110 575.965 110 646 159.059 695t119.227 49Zm-.227-67q42.524 0 71.733-29.15Q379 618.701 379 576.059q0-42.642-29.15-71.851Q320.701 475 278.176 475q-42.524 0-72.35 29.15Q176 533.299 176 575.941q0 42.642 29.767 71.851Q235.534 677 278.059 677ZM480 576Z"/></svg>
\ No newline at end of file diff --git a/includes/kiosk/dev.equestria.delta.kiosk.RejectLogin/index.php b/includes/kiosk/dev.equestria.delta.kiosk.RejectLogin/index.php new file mode 100644 index 0000000..4505c9a --- /dev/null +++ b/includes/kiosk/dev.equestria.delta.kiosk.RejectLogin/index.php @@ -0,0 +1,32 @@ +<?php + +header("Content-Type: application/json"); +$requests = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/../kiosk.json"), true); + +$data = [ + "success" => false +]; + +function encode($string) { + return preg_replace("/[^a-zA-Z0-9.]/m", "", base64_encode($string)); +} + +if (isset($_GET["id"]) && isset($_GET["key"]) && in_array($_GET["id"], array_map(function ($i) { return $i["id"]; }, $requests))) { + foreach ($requests as $index => $request) { + if ($request["id"] === $_GET["id"] && $request["key"] === $_GET["key"] && time() - strtotime($request["date"]) < 60) { + $data["success"] = true; + + $token = encode(openssl_random_pseudo_bytes(128)); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/../tokens/" . $token, json_encode([ + "user" => $request["user"], + "date" => date('c') + ])); + + $requests[$index]["token"] = false; + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/../kiosk.json", json_encode($requests, JSON_PRETTY_PRINT)); + break; + } + } +} + +die(json_encode($data, JSON_PRETTY_PRINT));
\ No newline at end of file diff --git a/includes/kiosk/dev.equestria.delta.kiosk.RequestApproval/index.php b/includes/kiosk/dev.equestria.delta.kiosk.RequestApproval/index.php index 1326270..f9f7013 100644 --- a/includes/kiosk/dev.equestria.delta.kiosk.RequestApproval/index.php +++ b/includes/kiosk/dev.equestria.delta.kiosk.RequestApproval/index.php @@ -48,19 +48,35 @@ if (isset($_GET["id"]) && in_array($_GET["id"], $users)) { ]; file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/../kiosk.json", json_encode($requests, JSON_PRETTY_PRINT)); - file_get_contents('https://notifications.equestria.dev/delta', false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush("Approve log in request?") . "\r\n" . - "Priority: default\r\n" . - "Tags: delta\r\n" . - "Actions: http, Approve, http://192.168.1.121:8081/dev.equestria.delta.kiosk.ApproveLogin/?id=" . $data["id"] . "&key=" . $key . ", clear=true\r\n" . - "Authorization: Basic " . base64_encode($config["ntfyuser"] . ":" . $config["ntfypass"]), - 'content' => formatPonypush($userData["first_name"] . " " . $userData["last_name"] . " (" . $_GET["id"] . ") is trying to log in to Delta from a kiosk, do you want to approve it?") - ] - ])); + if (isset($_GET["activate"])) { + file_get_contents('https://notifications.equestria.dev/delta', false, stream_context_create([ + 'http' => [ + 'method' => 'POST', + 'header' => + "Content-Type: text/plain\r\n" . + "Title: " . formatPonypush("Enable Delta Kiosk?") . "\r\n" . + "Priority: default\r\n" . + "Tags: delta\r\n" . + "Actions: http, Approve, http://192.168.1.121:8081/dev.equestria.delta.kiosk.ApproveLogin/?id=" . $data["id"] . "&key=" . $key . ", clear=true; http, Reject, http://192.168.1.121:8081/dev.equestria.delta.kiosk.RejectLogin/?id=" . $data["id"] . "&key=" . $key . ", clear=true\r\n" . + "Authorization: Basic " . base64_encode($config["ntfyuser"] . ":" . $config["ntfypass"]), + 'content' => formatPonypush("Someone is trying to enable a new Delta Kiosk instance, do you want to allow it and enable this kiosk?") + ] + ])); + } else { + file_get_contents('https://notifications.equestria.dev/delta', false, stream_context_create([ + 'http' => [ + 'method' => 'POST', + 'header' => + "Content-Type: text/plain\r\n" . + "Title: " . formatPonypush("Approve log in request?") . "\r\n" . + "Priority: default\r\n" . + "Tags: delta\r\n" . + "Actions: http, Approve, http://192.168.1.121:8081/dev.equestria.delta.kiosk.ApproveLogin/?id=" . $data["id"] . "&key=" . $key . ", clear=true; http, Reject, http://192.168.1.121:8081/dev.equestria.delta.kiosk.RejectLogin/?id=" . $data["id"] . "&key=" . $key . ", clear=true\r\n" . + "Authorization: Basic " . base64_encode($config["ntfyuser"] . ":" . $config["ntfypass"]), + 'content' => formatPonypush($userData["first_name"] . " " . $userData["last_name"] . " (" . $_GET["id"] . ") is trying to log in to Delta from a kiosk, do you want to approve it?") + ] + ])); + } $data["ok"] = true; } diff --git a/includes/navigation.php b/includes/navigation.php index 13e7b1e..a99bbac 100644 --- a/includes/navigation.php +++ b/includes/navigation.php @@ -128,6 +128,12 @@ <span style="vertical-align: middle;"><?= l("lang_kiosk_reload") ?></span> </a> </li> + <li> + <a class="dropdown-item" href="/_dev.equestria.delta.kiosk.DisableKiosk"> + <img class="icon" src="/icons/disable.svg"> + <span style="vertical-align: middle;"><?= l("lang_kiosk_disable") ?></span> + </a> + </li> <li> <a class="dropdown-item" href="/_dev.equestria.delta.kiosk.ShutdownKiosk"> <img class="icon" src="/icons/shutdown.svg"> @@ -288,7 +294,7 @@ </div> <?php endif; ?> </div> - <div style="display: grid; grid-template-columns: repeat(<?= isset($_PROFILE["admin"]) && $_PROFILE["admin"] ? ($betaEligible ? "6" : "5") : ($betaEligible ? "5" : "4") ?>, 1fr); background-color: var(--bs-light);"> + <div style="display: grid; grid-template-columns: repeat(<?= isset($_PROFILE["admin"]) && $_PROFILE["admin"] && !isset($_COOKIE["DeltaKiosk"]) ? ($betaEligible ? "6" : "5") : ($betaEligible ? "5" : "4") ?>, 1fr); background-color: var(--bs-light);"> <a href="/people" class="newnav-link-bottom <?= str_starts_with($_SERVER['REQUEST_URI'], "/people/") || $_SERVER['REQUEST_URI'] === "/people" ? "newnav-link-bottom-checked" : "" ?>" title="<?= l("lang_navigation_people") ?>" data-bs-placement="top" data-bs-toggle="tooltip" style="display: flex; align-items: center; justify-content: center;"> <img src="/icons/people.svg" style="width: 32px;"> </a> @@ -312,7 +318,7 @@ </a> <?php endif; ?> - <?php if (isset($_PROFILE["admin"]) && $_PROFILE["admin"]): ?> + <?php if (isset($_PROFILE["admin"]) && $_PROFILE["admin"] && !isset($_COOKIE["DeltaKiosk"])): ?> <a href="/admin" class="newnav-link-bottom <?= str_starts_with($_SERVER['REQUEST_URI'], "/admin/") || $_SERVER['REQUEST_URI'] === "/admin" ? "newnav-link-bottom-checked" : "" ?>" title="Admin" data-bs-placement="top" data-bs-toggle="tooltip" style="display: flex; align-items: center; justify-content: center;"> <img src="/icons/admin.svg" style="width: 32px;"> </a> diff --git a/lang/en.json b/lang/en.json index 000f1b0..5c0c3ef 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1012,11 +1012,13 @@ "loading": "Gathering information, please wait...", "yes": "Yes", "no": "No", - "organizer": "Events Pass organiser" + "organizer": "Events Pass organiser", + "kiosk": "The Events Pass is not available when using a Delta kiosk. Open this page on your own device to access your Events Pass." }, "kiosk": { "shutdown": "Shutdown this kiosk", "devtools": "Toggle developer options", + "disable": "Disable this kiosk", "reload": "Reload this page" } }
\ No newline at end of file diff --git a/lang/fr.json b/lang/fr.json index 8f8345e..b497e73 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -843,7 +843,7 @@ "sections": [ "Accès à Delta", "Contenu textuel et graphique", - "Operations administratives et modération", + "Opérations administratives et modération", "Sécurité et confidentialité", "Options et abonnements payants", "Garantie et problèmes techniques" @@ -1012,6 +1012,13 @@ "loading": "Récupération des informations, veuillez patienter...", "yes": "Oui", "no": "Non", - "organizer": "Organisateur·ice Pass Événements" + "organizer": "Organisateur·ice Pass Événements", + "kiosk": "Le Pass Événements n'est pas disponible depuis un kiosque Delta. Ouvrez cette page sur votre propre appareil pour accéder à votre Pass Événements." + }, + "kiosk": { + "shutdown": "Éteindre ce kiosque", + "devtools": "Options de développement", + "disable": "Désactiver ce kiosuqe", + "reload": "Recharger la page" } }
\ No newline at end of file diff --git a/logout/action/index.php b/logout/action/index.php index a35df8d..71df267 100644 --- a/logout/action/index.php +++ b/logout/action/index.php @@ -6,4 +6,8 @@ global $_PROFILE; unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $_COOKIE['DeltaSession']); setcookie("DeltaSession", "", 1, "/"); -header("Location: /");
\ No newline at end of file +if (isset($_COOKIE["DeltaKiosk"])) { + header("Location: /_dev.equestria.delta.kiosk.SessionEnd"); +} else { + header("Location: /"); +}
\ No newline at end of file diff --git a/pass/index.php b/pass/index.php index 588cc40..e6b436f 100644 --- a/pass/index.php +++ b/pass/index.php @@ -26,6 +26,12 @@ global $palette; <div class="container"> <br><br> <h1><?= l("lang_pass_title") ?></h1> + + <?php if (isset($_COOKIE["DeltaKiosk"])): ?> + <div class="alert alert-secondary"> + <?= l("lang_pass_kiosk") ?> + </div> + <?php else: ?> <p><?= l("lang_pass_description") ?></p> <div> @@ -43,6 +49,7 @@ global $palette; <a href="/pass/scan"><?= l("lang_pass_scan") ?></a> </div> <?php endif; ?> + <?php endif; ?> <br><br><br> </div> diff --git a/plus/subscribe/index.php b/plus/subscribe/index.php index 1a2c10c..7a9939c 100644 --- a/plus/subscribe/index.php +++ b/plus/subscribe/index.php @@ -116,7 +116,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/navigation.php"; <?php endif; ?> </p> - <?php if ($planTarget < $currentPlan): ?> + <?php if ($planTarget === 0): ?> <div class="alert alert-warning"> <b><?= l("lang_plus_confirm_refund_0") ?></b> <?= l("lang_plus_confirm_refund_1") ?> </div> @@ -1 +1 @@ -5.0.0-eap5.4
\ No newline at end of file +5.0.0-eap5.9
\ No newline at end of file |