From 8fe2b5cf2890fcb38a1b9a15b7a21e5b410a8826 Mon Sep 17 00:00:00 2001 From: olcxja Date: Fri, 8 May 2026 13:26:01 +0200 Subject: [PATCH] Add groups section, actions-notifier and auth --- webroot/index.html | 64 ++++++++++++++++++++++++++++++++++++++++------ webroot/main.js | 39 +++++++++++++++++++++++++++- webroot/style.css | 31 +++++++++++++++++++++- 3 files changed, 124 insertions(+), 10 deletions(-) diff --git a/webroot/index.html b/webroot/index.html index 4e506b0c..9298315f 100644 --- a/webroot/index.html +++ b/webroot/index.html @@ -39,23 +39,71 @@
- - + + + + - + \ No newline at end of file diff --git a/webroot/main.js b/webroot/main.js index 2427ad3e..0bcc2dd3 100644 --- a/webroot/main.js +++ b/webroot/main.js @@ -4,6 +4,7 @@ var url = `${window.location.protocol}//${window.location.hostname}/_larpix`; var params = new URLSearchParams(window.location.search); const collapseDmsBtn = document.getElementById("collapse-dms"); +const collapseGroupsBtn = document.getElementById("collapse-groups"); const sidebarHome = document.getElementById("sidebar-home"); const sidebarHomeButton = sidebarHome.children.item(1); @@ -290,7 +291,7 @@ async function fetchEncrypted(request, body) } }); let data = await response.text(); - return data; + return decryptString(data, passwordHash); } function power(base, exponent, mod) { @@ -348,6 +349,38 @@ function showNotification(message, type = 'info', duration = 3500) { } +function showAction(message, actionid) { + let container = document.getElementById('notification-container'); + if (!container) { + container = document.createElement('div'); + container.id = 'notification-container'; + document.body.appendChild(container); + } + + const notif = document.createElement('div'); + notif.className = `notification action`; + notif.textContent = message; + notif.id = `notification-${actionid}`; + + container.appendChild(notif); + + requestAnimationFrame(() => { + requestAnimationFrame(() => { + notif.classList.add('show'); + }); + }); +} +function clearAction(actionid) { + + let notif = document.getElementById(`notification-${actionid}`); + notif.classList.remove('show'); + + notif.addEventListener('transitionend', () => { + notif.remove(); + }); +} + + async function hashSHA3_512(input) { const encoder = new TextEncoder(); const data = encoder.encode(input); @@ -369,12 +402,16 @@ async function mainJS() password = localStorage.getItem('password'); host = localStorage.getItem('host'); passwordHash = await hashSHA3_512(password); + url = `${window.location.protocol}//${host}/_larpix`; } mainJS(); collapseDmsBtn.addEventListener("click", () => { collapseDmsBtn.classList.toggle("collapsed"); }); +collapseGroupsBtn.addEventListener("click", () => { + collapseGroupsBtn.classList.toggle("collapsed"); +}); sidebarHomeButton.addEventListener("mouseenter", () => { sidebarHomeIndicator.classList.add("hover"); diff --git a/webroot/style.css b/webroot/style.css index d38a13d4..2e7d628d 100644 --- a/webroot/style.css +++ b/webroot/style.css @@ -140,15 +140,23 @@ sidebar { border-right: var(--border-width) solid var(--light-border-color); } sidebar.second { - width: 22rem; + width: 20rem; } +.sidebar-section-header { + display: flex; + align-items: center; + justify-content: space-between; +} + .collapse-text-button { padding-left: calc(var(--button-margin) + 0.2rem); flex-shrink: 0; + flex-grow: 1; border: none; background-color: transparent; height: 2rem; font-weight: 600; + gap: 0.3rem; } .collapse-text-button .chevron { @@ -159,6 +167,27 @@ sidebar.second { .collapse-text-button.collapsed .chevron { transform: rotate(-90deg); } + +.add-action-button { + border: none; + background-color: transparent; + height: 2rem; + width: 2rem; + padding: 0; + flex-shrink: 0; + justify-content: center; + color: rgba(255, 255, 255, 0.5); +} + +.add-action-button:hover { + background-color: rgba(255, 255, 255, 0.1); + color: var(--text-color); +} + +.add-action-button svg { + width: 1.25rem; + height: 1.25rem; +} hr { border: none; height: 0;