Add groups section, actions-notifier and auth
This commit is contained in:
parent
862642fd04
commit
8fe2b5cf28
3 changed files with 124 additions and 10 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue