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) => {
|
||||
if (!rreq.cookies["APIToken"] && !rreq.get("Authorization")) {
|
||||
rres.status(400).send({ "loggedIn": false, "username": "", "scopes": "" })
|
||||
rres.send({ "loggedIn": false, "username": "", "scopes": "" })
|
||||
} 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 => {
|
||||
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 }
|
||||
Reference in New Issue
Block a user