🚑 Fix server crash on /info call if auth disabled

This commit is contained in:
2023-06-30 17:31:37 +02:00
parent 9aab04d4d2
commit f286741557

View File

@ -11,6 +11,16 @@ import {
// Get info API endpoint (/api/info)
// Returns information about the requesting session
export async function getInfo(req, res) {
// If server has auth disabled
if (!req.locals.session) {
res.send({
authenticated: true,
appliedKeys: [],
permissions: [],
});
return;
}
const session = await prisma.session.findUnique({
where: {
token: req.locals.session,