groundwork for helpdesk stuff
This commit is contained in:
@@ -5,7 +5,7 @@ import { randomStringBase62, getHumanReadableUserAgent } from "../liberals/misc.
|
|||||||
|
|
||||||
app.get("/api/auth/whoami", (rreq,rres) => {
|
app.get("/api/auth/whoami", (rreq,rres) => {
|
||||||
if (!rreq.cookies["APIToken"] && !rreq.get("Authorization")) {
|
if (!rreq.cookies["APIToken"] && !rreq.get("Authorization")) {
|
||||||
rres.status(400).send({ "loggedIn": false, "username": "", "scopes": "" })
|
rres.send({ "loggedIn": false, "username": "", "scopes": "" })
|
||||||
} else {
|
} else {
|
||||||
db`select s.scopes, u.username from sessions s join users u on s.owner = u.id where s.token = ${rreq.cookies["APIToken"] ?? rreq.get("Authorization")}`.then(dbRes => {
|
db`select s.scopes, u.username from sessions s join users u on s.owner = u.id where s.token = ${rreq.cookies["APIToken"] ?? rreq.get("Authorization")}`.then(dbRes => {
|
||||||
if (dbRes.length > 0 && dbRes.length < 2) {
|
if (dbRes.length > 0 && dbRes.length < 2) {
|
||||||
|
|||||||
11
routes/helpdesk.js
Normal file
11
routes/helpdesk.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { app } from "../index.js"
|
||||||
|
|
||||||
|
app.get("/helpdesk", (rreq, rres) => {
|
||||||
|
rres.sendFile(process.cwd()+"/website/helpdesk/templates/landing.html")
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get("/helpdesk/articles/*", (rreq, rres) => {
|
||||||
|
rres.sendFile(process.cwd()+"/website/helpdesk/kbas/"+rreq.url.replace("/helpdesk/articles/",""))
|
||||||
|
})
|
||||||
|
|
||||||
|
export { app }
|
||||||
14
website/helpdesk/forms/ecls_deleteaccount.json
Normal file
14
website/helpdesk/forms/ecls_deleteaccount.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"title": "ECLS: Delete Account",
|
||||||
|
"form": {
|
||||||
|
"description": {
|
||||||
|
"type": "span",
|
||||||
|
"content": ""
|
||||||
|
},
|
||||||
|
"confirmation": {
|
||||||
|
"type": "checkbox",
|
||||||
|
"content": "I have read all of the above and understand this action is irreverisble",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
website/helpdesk/kbas/example.html
Normal file
11
website/helpdesk/kbas/example.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>example article</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
96
website/helpdesk/templates/landing.html
Normal file
96
website/helpdesk/templates/landing.html
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Enstrayed Helpdesk</title>
|
||||||
|
<link rel="stylesheet" href="/static/helpdesk.css">
|
||||||
|
<script>
|
||||||
|
var globalLoggedIn = false
|
||||||
|
|
||||||
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
fetch(`/api/auth/whoami`).then(fetchRes => {
|
||||||
|
fetchRes.json().then(jsonRes => {
|
||||||
|
if (jsonRes.loggedIn) {
|
||||||
|
globalLoggedIn = true
|
||||||
|
document.getElementById("loginButton").innerText = `Logout ${jsonRes.username}`
|
||||||
|
} else {
|
||||||
|
globalLoggedIn = false
|
||||||
|
document.getElementById("loginButton").innerText = `Login`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
function loginFunction() {
|
||||||
|
if (globalLoggedIn === true) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="headerbar">
|
||||||
|
<h1>Enstrayed Helpdesk</h1>
|
||||||
|
<a href="/helpdesk/ticket/new">Open Ticket</a>
|
||||||
|
<a href="/helpdesk/articles">Knowledgebase</a>
|
||||||
|
|
||||||
|
<div class="headerbarright">
|
||||||
|
<button id="loginButton" onclick="loginFunction()">Login</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="maincontent">
|
||||||
|
<div class="cardrow">
|
||||||
|
<div>
|
||||||
|
<h1>How can I help you?</h1>
|
||||||
|
<div class="linkColumn">
|
||||||
|
<div>
|
||||||
|
<span>I'm filing a legal request, such as a DMCA takedown or other legal matter</span><br>
|
||||||
|
<a href=""><img src="/static/icons/arrow-right.svg" alt="">Click here to start a Legal Request</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>I'm responsibly disclosing a problem, such a security vulnerability</span><br>
|
||||||
|
<a href=""><img src="/static/icons/arrow-right.svg" alt="">Click here to start a Responsible Disclosure</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>I need help logging into my ECLS account</span><br>
|
||||||
|
<a href=""><img src="/static/icons/external.svg" alt="">Click here to reset your ECLS password</a><br>
|
||||||
|
<a href=""><img src="/static/icons/arrow-right.svg" alt="">Click here to start ECLS account recovery</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>I have another question or need to get in contact</span><br>
|
||||||
|
<a href=""><img src="/static/icons/arrow-right.svg" alt="">Click here to start a General Inquiry</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h1>Popular Articles</h1>
|
||||||
|
<div class="linkColumn">
|
||||||
|
<div>
|
||||||
|
<span>How do I use Security Keys in ECLS?</span><br>
|
||||||
|
<a href=""><img src="/static/icons/post.svg" alt="">Important ECLS FIDO2/Webauthn/Passkey Information</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>How do I login to Jellyfin?</span><br>
|
||||||
|
<a href=""><img src="/static/icons/post.svg" alt="">Logging into Jellyfin</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>How do I change my ECLS password?</span><br>
|
||||||
|
<a href=""><img src="/static/icons/post.svg" alt="">Change ECLS Password</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>How do I use federation features in Enstrayed Cloud?</span><br>
|
||||||
|
<a href=""><img src="/static/icons/post.svg" alt="">Enstrayed Cloud Federation Features</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<dialog id="globalDialog">
|
||||||
|
<h2>Warning</h2>
|
||||||
|
<p>This is a warning</p>
|
||||||
|
<button>woag</button>
|
||||||
|
</dialog>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
78
website/static/helpdesk.css
Normal file
78
website/static/helpdesk.css
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
html {
|
||||||
|
font-family: 'Segoe UI Variable', sans-serif;
|
||||||
|
|
||||||
|
background-color: #282828;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
display: grid;
|
||||||
|
grid-template-rows: auto 1fr;
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.headerbar {
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 0 2em 0 2em;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 2em;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.headerbarright {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.maincontent {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cardrow {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cardrow > div {
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cardrow > div > h1 {
|
||||||
|
margin: 0 0 0.5em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.linkColumn {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
a, a:link {
|
||||||
|
color: #366FFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
a > img {
|
||||||
|
margin-right: 0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog {
|
||||||
|
padding: 2em;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog > h2 {
|
||||||
|
margin: 0 0 0.5em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog > button {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog::backdrop {
|
||||||
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
3
website/static/icons/arrow-right.svg
Normal file
3
website/static/icons/arrow-right.svg
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#366FFF" viewBox="0 0 16 16">
|
||||||
|
<path fill-rule="evenodd" d="M15 2a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1zM0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm4.5 5.5a.5.5 0 0 0 0 1h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 400 B |
Reference in New Issue
Block a user