🚑 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)
|
// Get info API endpoint (/api/info)
|
||||||
// Returns information about the requesting session
|
// Returns information about the requesting session
|
||||||
export async function getInfo(req, res) {
|
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({
|
const session = await prisma.session.findUnique({
|
||||||
where: {
|
where: {
|
||||||
token: req.locals.session,
|
token: req.locals.session,
|
||||||
|
Reference in New Issue
Block a user