🚑 Fix server crash on /info call if auth disabled
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user