From f2867415570078150df477bc4a290c41e3566e00 Mon Sep 17 00:00:00 2001 From: minie4 Date: Fri, 30 Jun 2023 17:31:37 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=20Fix=20server=20crash=20on=20/inf?= =?UTF-8?q?o=20call=20if=20auth=20disabled?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/api/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/api/index.js b/server/api/index.js index 8276aaf..71f9a28 100644 --- a/server/api/index.js +++ b/server/api/index.js @@ -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,