From 8260890f336fa8175cb0d1a8bd43d4390e91087d Mon Sep 17 00:00:00 2001 From: Developer27149 <564151947@qq.com> Date: Sat, 20 Jul 2024 17:01:20 +0800 Subject: [PATCH] fix(v-next): auth trust host --- apps/v-next/auth.ts | 3 ++- apps/v-next/components/SocialMediaShare.tsx | 10 +++------- apps/v-next/src/app/page.tsx | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/apps/v-next/auth.ts b/apps/v-next/auth.ts index 530a911..c31274f 100644 --- a/apps/v-next/auth.ts +++ b/apps/v-next/auth.ts @@ -30,7 +30,8 @@ const authInstance = NextAuth({ return session; } }, - trustHost: true + trustHost: true, + secret: process.env.AUTH_SECRET }); export const { handlers, signIn, signOut, auth } = authInstance; diff --git a/apps/v-next/components/SocialMediaShare.tsx b/apps/v-next/components/SocialMediaShare.tsx index 2c8bdb9..f08066a 100644 --- a/apps/v-next/components/SocialMediaShare.tsx +++ b/apps/v-next/components/SocialMediaShare.tsx @@ -15,10 +15,11 @@ import { } from 'next-share'; import { WeiboIcon, WeiboShareButton } from 'next-share'; +import { useState } from 'react'; export default function SocialMediaShare() { const title = `${PROJECT.name} - ${PROJECT.description}`; - const url = `https://${location.hostname}`; + const [url] = useState(`https://${globalThis?.location?.hostname}`); return (