documentation updates

This commit is contained in:
Enstrayed
2025-05-04 22:59:46 -07:00
parent 080f58baa0
commit 4be52c7f26
2 changed files with 37 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
import { app, db, globalConfig } from "../index.js" // Get globals from index
// import { app, db, globalConfig } from "../index.js" // Get globals from index
import { checkTokenNew } from "../liberals/auth.js"
import { logRequest } from "../liberals/logging.js"
import { randomStringBase62, getHumanReadableUserAgent } from "../liberals/misc.js"
@@ -80,6 +80,7 @@ app.get("/api/auth/callback", (rreq,rres) => {
let newDestination = atob(rreq.query.state.split("_")[1].replace("-","/"))
rres.setHeader("Set-Cookie", `APIToken=${newToken}; Domain=${rreq.hostname}; Expires=${new Date(newExpiration).toUTCString()}; Path=/`).redirect(newDestination)
} else if (rreq.query.state === "display") {
// Change this to not write the token to a cookie
rres.setHeader("Set-Cookie", `APIToken=${newToken}; Domain=${rreq.hostname}; Expires=${new Date(newExpiration).toUTCString()}; Path=/`).send(`Success! Your token is <code>${newToken}</code>`)
} else if (rreq.query.state === "close") {
rres.setHeader("Set-Cookie", `APIToken=${newToken}; Domain=${rreq.hostname}; Expires=${new Date(newExpiration).toUTCString()}; Path=/`).send(`<script>document.addEventListener("DOMContentLoaded", () => {window.close();});</script> Success! You may now close this window.`)