Fix: use strict bool check for auth

This commit is contained in:
shamoon
2026-08-07 07:51:21 -07:00
parent 670d0a8e40
commit b33c88dba1
4 changed files with 17 additions and 3 deletions
+2 -1
View File
@@ -3,9 +3,10 @@ import { createHash, timingSafeEqual } from "node:crypto";
import NextAuth from "next-auth";
import CredentialsProvider from "next-auth/providers/credentials";
import { isAuthEnabled } from "utils/env";
import createLogger from "utils/logger";
const authEnabled = Boolean(process.env.HOMEPAGE_AUTH_ENABLED);
const authEnabled = isAuthEnabled();
const issuer = process.env.HOMEPAGE_OIDC_ISSUER;
const clientId = process.env.HOMEPAGE_OIDC_CLIENT_ID;
const clientSecret = process.env.HOMEPAGE_OIDC_CLIENT_SECRET;
+2 -1
View File
@@ -1,10 +1,11 @@
import { getServerSession } from "next-auth/next";
import { authOptions } from "pages/api/auth/[...nextauth]";
import { isAuthEnabled } from "utils/env";
import { handleMcpRequest, mcpEnabled, mcpTokenAuthorized } from "utils/mcp/homepage-mcp";
async function hasHomepageSession(req, res) {
if (!process.env.HOMEPAGE_AUTH_ENABLED) return false;
if (!isAuthEnabled()) return false;
return Boolean(await getServerSession(req, res, authOptions));
}