From 7759bb3ff546f5f4b92b56a180d2be6b3513770f Mon Sep 17 00:00:00 2001 From: npmrun <1549469775@qq.com> Date: Tue, 26 May 2026 16:23:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B8=85=E7=90=86=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=92=8C=E8=AE=A4=E8=AF=81=E4=B8=AD=E4=B8=8D?= =?UTF-8?q?=E5=BF=85=E8=A6=81=E7=9A=84=E4=BB=A3=E7=A0=81=EF=BC=8C=E7=AE=80?= =?UTF-8?q?=E5=8C=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/composables/useGlobalConfig.ts | 17 ----------------- app/middleware/auth.global.ts | 6 +----- app/plugins/auth-session.server.ts | 2 -- app/utils/auth-routes.ts | 3 +-- server/api/config/global.get.ts | 2 +- 5 files changed, 3 insertions(+), 27 deletions(-) diff --git a/app/composables/useGlobalConfig.ts b/app/composables/useGlobalConfig.ts index f39dd33..f0594f3 100644 --- a/app/composables/useGlobalConfig.ts +++ b/app/composables/useGlobalConfig.ts @@ -3,14 +3,6 @@ import { request, unwrapApiBody, type ApiResponse } from '../utils/http/factory' export type GlobalConfig = { siteName: string allowRegister: boolean - showDiscoverInHeaderForGuest: boolean - commentEmailNotifyEnabled: boolean - commentMailFromEmail: string - commentSmtpHost: string - commentSmtpPort: number - commentSmtpSecure: boolean - commentSmtpUser: string - commentSmtpPass: string } type GlobalConfigResult = { @@ -20,14 +12,6 @@ type GlobalConfigResult = { const DEFAULT_GLOBAL_CONFIG: GlobalConfig = { siteName: 'Person Panel', allowRegister: true, - showDiscoverInHeaderForGuest: true, - commentEmailNotifyEnabled: false, - commentMailFromEmail: '', - commentSmtpHost: '', - commentSmtpPort: 465, - commentSmtpSecure: true, - commentSmtpUser: '', - commentSmtpPass: '', } export function useGlobalConfig() { @@ -55,7 +39,6 @@ export function useGlobalConfig() { return n && n.length > 0 ? n : DEFAULT_GLOBAL_CONFIG.siteName }), allowRegister: computed(() => config.value.allowRegister), - showDiscoverInHeaderForGuest: computed(() => config.value.showDiscoverInHeaderForGuest), pending, error, refresh, diff --git a/app/middleware/auth.global.ts b/app/middleware/auth.global.ts index b4059f9..1af5d8f 100644 --- a/app/middleware/auth.global.ts +++ b/app/middleware/auth.global.ts @@ -5,7 +5,6 @@ import { normalizeSafeRedirect, } from "@/utils/auth-routes"; import { useAuthSession } from "../composables/useAuthSession"; -import { useGlobalConfig } from "../composables/useGlobalConfig"; export default defineNuxtRouteMiddleware(async (to) => { if(to.path.startsWith("/__nuxt_error")) { @@ -25,11 +24,8 @@ export default defineNuxtRouteMiddleware(async (to) => { const currentPath = to.path; const currentFullPath = to.fullPath; const isLoggedIn = loggedIn.value; - const { showDiscoverInHeaderForGuest } = useGlobalConfig(); - const isDiscoverRoute = currentPath === "/discover" || currentPath.startsWith("/discover/"); - const canGuestAccessDiscover = isDiscoverRoute && showDiscoverInHeaderForGuest.value; - if (!isLoggedIn && !isPublicRoute(currentPath) && !canGuestAccessDiscover) { + if (!isLoggedIn && !isPublicRoute(currentPath)) { return navigateTo({ path: "/auth", query: { redirect: currentFullPath }, diff --git a/app/plugins/auth-session.server.ts b/app/plugins/auth-session.server.ts index f8c7504..315104b 100644 --- a/app/plugins/auth-session.server.ts +++ b/app/plugins/auth-session.server.ts @@ -18,8 +18,6 @@ export default defineNuxtPlugin(async () => { if (state.value.initialized) { return; } - console.log(useCookie); - const user = await getCurrentUser(event); state.value = { initialized: true, diff --git a/app/utils/auth-routes.ts b/app/utils/auth-routes.ts index 8924aa4..7d14bc7 100644 --- a/app/utils/auth-routes.ts +++ b/app/utils/auth-routes.ts @@ -1,7 +1,6 @@ const PUBLIC_ROUTE_EXACT = new Set(["/", "/auth/login", "/auth/register"]); const GUEST_ONLY_ROUTE_EXACT = new Set(["/auth/login", "/auth/register"]); -/** 公开主页 /@slug 与仅链接分享 /p/slug/t/token */ -const PUBLIC_ROUTE_PREFIXES: string[] = ["/@", "/p/"]; +const PUBLIC_ROUTE_PREFIXES: string[] = []; export const DEFAULT_AUTHENTICATED_LANDING_PATH = "/"; diff --git a/server/api/config/global.get.ts b/server/api/config/global.get.ts index e8ab28c..cb435f7 100644 --- a/server/api/config/global.get.ts +++ b/server/api/config/global.get.ts @@ -20,7 +20,7 @@ export default defineWrappedResponseHandler(async (event) => { const entries = await Promise.all( keys.map(async (key) => { - const value = await getConfigGlobal(event, key); + const value = await getConfigGlobal(key); const safeValue = SECRET_MASKED_GLOBAL_CONFIG_KEYS.has(key) ? ""