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) ? ""