Skip to content

Commit b3eea1e

Browse files
committed
fix: 增强身份验证会话和 JWT 处理,以包含提供商信息;更新 Header 和 UserMenu 组件,以利用提供商数据来提升用户体验。此外,调整 Markdown 文件中的图片路径以确保一致性。
1 parent 10b0b8b commit b3eea1e

39 files changed

+448
-435
lines changed

app/components/Header.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ import { UserMenu } from "./UserMenu";
99
export async function Header() {
1010
const session = await auth();
1111
const user = session?.user;
12+
const provider =
13+
session && "provider" in session
14+
? (session.provider as string | undefined)
15+
: undefined;
16+
console.log("session", session);
1217
return (
1318
<header className="fixed top-0 w-full z-50 bg-background/80 backdrop-blur-lg border-b border-border">
1419
<div className="container mx-auto px-6 h-16 flex items-center justify-between">
@@ -67,7 +72,11 @@ export async function Header() {
6772
</a>
6873
</Button>
6974
<ThemeToggle />
70-
{user ? <UserMenu user={user} /> : <SignInButton />}
75+
{user ? (
76+
<UserMenu user={user} provider={provider} />
77+
) : (
78+
<SignInButton />
79+
)}
7180
</div>
7281
</div>
7382
</header>

app/components/UserMenu.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ interface UserMenuProps {
1111
email?: string | null;
1212
image?: string | null;
1313
};
14+
provider?: string;
1415
}
1516

16-
export function UserMenu({ user }: UserMenuProps) {
17+
export function UserMenu({ user, provider }: UserMenuProps) {
1718
const initials = user.name?.[0] ?? user.email?.[0] ?? "?";
1819

1920
return (
@@ -43,6 +44,17 @@ export function UserMenu({ user }: UserMenuProps) {
4344
) : null}
4445
</div>
4546

47+
{provider === "github" ? (
48+
<a
49+
href="https://github.com/logout"
50+
target="_blank"
51+
rel="noreferrer"
52+
className="block px-4 py-2 text-sm text-foreground transition hover:bg-muted"
53+
>
54+
切换 GitHub 账号(将在新标签页登出 GitHub)
55+
</a>
56+
) : null}
57+
4658
<form
4759
action={async () => {
4860
"use server";

app/docs/ai/recommender-systems/wangshusen_recommend_note/images/2-10-1.png renamed to app/docs/ai/recommender-systems/wangshusen_recommend_note/wangshusen_recommend_note_retrieval.assets/2-10-1.png

File renamed without changes.

app/docs/ai/recommender-systems/wangshusen_recommend_note/images/2-10-2.png renamed to app/docs/ai/recommender-systems/wangshusen_recommend_note/wangshusen_recommend_note_retrieval.assets/2-10-2.png

File renamed without changes.

app/docs/ai/recommender-systems/wangshusen_recommend_note/images/2-10-3.png renamed to app/docs/ai/recommender-systems/wangshusen_recommend_note/wangshusen_recommend_note_retrieval.assets/2-10-3.png

File renamed without changes.

app/docs/ai/recommender-systems/wangshusen_recommend_note/images/2-10-4.png renamed to app/docs/ai/recommender-systems/wangshusen_recommend_note/wangshusen_recommend_note_retrieval.assets/2-10-4.png

File renamed without changes.

app/docs/ai/recommender-systems/wangshusen_recommend_note/images/2-10-5.png renamed to app/docs/ai/recommender-systems/wangshusen_recommend_note/wangshusen_recommend_note_retrieval.assets/2-10-5.png

File renamed without changes.

app/docs/ai/recommender-systems/wangshusen_recommend_note/images/2-10-6.png renamed to app/docs/ai/recommender-systems/wangshusen_recommend_note/wangshusen_recommend_note_retrieval.assets/2-10-6.png

File renamed without changes.

app/docs/ai/recommender-systems/wangshusen_recommend_note/images/2-10-7.png renamed to app/docs/ai/recommender-systems/wangshusen_recommend_note/wangshusen_recommend_note_retrieval.assets/2-10-7.png

File renamed without changes.

app/docs/ai/recommender-systems/wangshusen_recommend_note/images/2-10-8.png renamed to app/docs/ai/recommender-systems/wangshusen_recommend_note/wangshusen_recommend_note_retrieval.assets/2-10-8.png

File renamed without changes.

0 commit comments

Comments
 (0)