aboutsummaryrefslogtreecommitdiff
path: root/modules/services/nixos/jta/index.html
diff options
context:
space:
mode:
authorCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2026-10-02 11:23:45 -0500
committerCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2026-10-02 11:23:45 -0500
commitb768ad0ca4208e8b3588b881067c43d85246e967 (patch)
tree460dca5c6568307efc94e256186346be0271478a /modules/services/nixos/jta/index.html
parent84364a52c3d7ca2f550cb3f7af56848405902bee (diff)
experiment with modular services; more unix domain sockets, clean up old code
Diffstat (limited to 'modules/services/nixos/jta/index.html')
-rw-r--r--modules/services/nixos/jta/index.html134
1 files changed, 0 insertions, 134 deletions
diff --git a/modules/services/nixos/jta/index.html b/modules/services/nixos/jta/index.html
deleted file mode 100644
index 96b6f5f..0000000
--- a/modules/services/nixos/jta/index.html
+++ /dev/null
@@ -1,134 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>JTA Login</title>
- <link rel="stylesheet" href="style.css">
- <style>
- body {
- margin: 0;
- min-height: 100vh;
- display: grid;
- place-items: center;
- padding: 1rem;
- background: var(--bg);
- }
-
- .card {
- width: min(520px, 100%);
- background: var(--card);
- border: 1px solid var(--border);
- border-radius: 16px;
- padding: 1.5rem;
- box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
- }
-
- h1 {
- margin: 0 0 0.25rem 0;
- text-align: center;
- font-family: var(--font-heading);
- font-size: var(--step-2);
- line-height: 1.15;
- font-weight: 700;
- }
-
- p {
- margin: 0.5rem 0 1.2rem 0;
- text-align: center;
- color: var(--text-soft);
- line-height: 1.5;
- }
-
- .actions {
- display: flex;
- justify-content: center;
- gap: 0.75rem;
- }
-
- button {
- appearance: none;
- border: 1px solid var(--border);
- border-radius: 12px;
- background: #0f172a;
- color: var(--text);
- padding: 0.65rem 1rem;
- font-size: var(--step-0);
- font-weight: 600;
- cursor: pointer;
- transition: transform 0.15s ease, box-shadow 0.15s ease;
- }
-
- button:hover {
- transform: translateY(-1px);
- box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
- }
-
- #status {
- margin-top: 1rem;
- text-align: center;
- min-height: 1.25rem;
- font-size: var(--step--1);
- color: var(--text-soft);
- }
- </style>
- </head>
- <body>
- <div class="card">
- <h1>JTA Portal</h1>
- <p>Public landing page. Login is required to view assignments and all other pages.</p>
-
- <div class="actions">
- <button id="login-btn" type="button">Login</button>
- </div>
-
- <div id="status" aria-live="polite"></div>
- </div>
-
- <script>
- const authCookieName = "jta_auth";
- const status = document.getElementById("status");
- const loginButton = document.getElementById("login-btn");
-
- function toHex(buffer) {
- const bytes = new Uint8Array(buffer);
- return Array.from(bytes)
- .map((b) => b.toString(16).padStart(2, "0"))
- .join("");
- }
-
- async function sha256Hex(input) {
- const data = new TextEncoder().encode(input);
- const digest = await crypto.subtle.digest("SHA-256", data);
- return toHex(digest);
- }
-
- function setAuthCookie(hashValue) {
- const maxAge = 10 * 365 * 24 * 60 * 60;
- document.cookie = `${authCookieName}=${hashValue}; Path=/; Max-Age=${maxAge}; SameSite=Lax`;
- }
-
- async function loginWithPrompt() {
- const password = prompt("Enter password");
- if (password === null) {
- status.textContent = "Login cancelled.";
- return;
- }
-
- status.textContent = "Logging in...";
-
- const hashValue = await sha256Hex(password);
- setAuthCookie(hashValue);
-
- status.textContent = "Success. Redirecting...";
- window.location.href = "/assignments";
- }
-
- loginButton.addEventListener("click", () => {
- loginWithPrompt().catch(() => {
- status.textContent = "Network error while logging in.";
- });
- });
- </script>
- </body>
-</html>