sync changes

This commit is contained in:
Enstrayed
2025-10-01 09:50:32 -07:00
parent 4de76c34c2
commit b1ac3d6f58
16 changed files with 114 additions and 60 deletions

View File

@@ -57,23 +57,8 @@ body {
margin: 0 0 0.5em 0;
}
.articlecontent {
background-color: #fff;
padding: 2em;
margin: 2em 0 2em;
max-width: 100ch;
}
.articlecontent > h1 {
margin: 0 0 0.5em;
}
.articlecontent > ol > li {
margin: 0 0 0.2em;
}
.articlecontent img {
max-width: 100%;
.helpdeskScopeOnly {
display: none;
}
.linkColumn {
@@ -107,3 +92,30 @@ dialog::backdrop {
background-color: rgba(0, 0, 0, 0.5);
}
#formarea > div > input {
width: 50%;
}
#formarea > div > textarea {
width: 100%;
}
/* Article Specific */
.articlecontent {
background-color: #fff;
padding: 2em;
margin: 2em 0 2em;
max-width: 100ch;
}
.articlecontent > h1 {
margin: 0 0 0.5em;
}
.articlecontent > ol > li {
margin: 0 0 0.2em;
}
.articlecontent img {
max-width: 100%;
}

View File

@@ -12,6 +12,14 @@ document.addEventListener("DOMContentLoaded", function () {
if (jsonRes.loggedIn) {
globalLoggedIn = true
document.getElementById("loginButton").innerText = `Logout ${jsonRes.username}`
if (jsonRes.scopes.includes("helpdesk")) {
let targetElements = document.getElementsByClassName("helpdeskScopeOnly")
// cant do a for loop since targetElements dynamically updates, this is easier but stupid
while (targetElements.length > 0) {
targetElements[0].classList.toggle("helpdeskScopeOnly")
}
}
} else {
globalLoggedIn = false
document.getElementById("loginButton").innerText = `Login`
@@ -24,8 +32,7 @@ function loginFunction() {
if (globalLoggedIn === true) {
fetch(`/api/auth/logout`).then(fetchRes => {
if (fetchRes.status === 200) {
globalLoggedIn = false
document.getElementById("loginButton").innerText = `Login`
location.reload()
} else {
fetchRes.text().then(textRes => {
useGlobalDialog("Error", `An error occurred during logout: ${textRes}`)
@@ -41,6 +48,13 @@ function loginFunction() {
if (jsonRes.loggedIn) {
globalLoggedIn = true
document.getElementById("loginButton").innerText = `Logout ${jsonRes.username}`
if (jsonRes.scopes.includes("helpdesk")) {
let targetElements = document.getElementsByClassName("helpdeskScopeOnly")
while (targetElements.length > 0) {
targetElements[0].classList.toggle("helpdeskScopeOnly")
}
}
} else {
useGlobalDialog("Error", `You are not logged in. Please try logging in again.`)
}