feat: implement TikTok OAuth flow and integrate profile data into home page
This commit is contained in:
+11
-7
@@ -9,7 +9,7 @@ import { Users } from "lucide-react";
|
||||
import { Kbd } from "@/components/ui/kbd";
|
||||
|
||||
export default async function Home() {
|
||||
const counts = await getFollowerCounts();
|
||||
const { counts, tiktokProfile } = await getFollowerCounts();
|
||||
const headersList = await headers();
|
||||
const ip = headersList.get("x-forwarded-for") || headersList.get("x-real-ip") || "unknown";
|
||||
|
||||
@@ -24,16 +24,20 @@ export default async function Home() {
|
||||
console.error("Failed to track visitor:", e);
|
||||
}
|
||||
|
||||
// Use TikTok profile data with config fallbacks
|
||||
const profileName = tiktokProfile.displayName || config.profile.name;
|
||||
const profileAvatar = tiktokProfile.avatarUrl || config.profile.avatar;
|
||||
|
||||
const jsonLd = {
|
||||
"@context": "https://schema.org",
|
||||
"@type": "ProfilePage",
|
||||
name: config.profile.name,
|
||||
name: profileName,
|
||||
description: config.profile.desc,
|
||||
url: "https://erika.sudloh.com",
|
||||
mainEntity: {
|
||||
"@type": "Person",
|
||||
name: config.profile.name,
|
||||
image: "https://erika.sudloh.com/avatar.webp",
|
||||
name: profileName,
|
||||
image: profileAvatar.startsWith("/") ? `https://erika.sudloh.com${profileAvatar}` : profileAvatar,
|
||||
sameAs: config.links.map((l) => l.link),
|
||||
},
|
||||
};
|
||||
@@ -53,8 +57,8 @@ export default async function Home() {
|
||||
<CardHeader className="flex flex-col items-center gap-4 text-center">
|
||||
<div className="relative w-24 h-24 overflow-hidden rounded-full">
|
||||
<Image
|
||||
src={config.profile.avatar}
|
||||
alt={`${config.profile.name} avatar`}
|
||||
src={profileAvatar}
|
||||
alt={`${profileName} avatar`}
|
||||
fill
|
||||
priority
|
||||
className="object-cover"
|
||||
@@ -62,7 +66,7 @@ export default async function Home() {
|
||||
</div>
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold bg-linear-to-r from-pink-500 to-yellow-200 bg-clip-text text-transparent">
|
||||
{config.profile.name}
|
||||
{profileName}
|
||||
</h1>
|
||||
<p className="text-sm text-zinc-400 mt-1">
|
||||
{config.profile.desc}
|
||||
|
||||
Reference in New Issue
Block a user