perf: add prefetch all api when build container and incrase light house score

This commit is contained in:
2026-07-07 20:39:46 +07:00 Unverified
parent 0c806410eb
commit 8af12db64b
4 changed files with 19 additions and 0 deletions
+1
View File
@@ -63,6 +63,7 @@ export default async function Home() {
src={profileAvatar}
alt={`${profileName} avatar`}
fill
sizes="96px"
priority
className="object-cover"
/>
+2
View File
@@ -68,6 +68,7 @@ export function LinkCard({ counts, links1, links2 }: { counts: FollowerCounts, l
onClick={() => setIsPage2(false)}
disabled={!isPage2}
className="text-zinc-400 hover:text-white disabled:opacity-50"
aria-label="หน้าก่อนหน้า"
>
<ArrowLeft />
</Button>
@@ -76,6 +77,7 @@ export function LinkCard({ counts, links1, links2 }: { counts: FollowerCounts, l
onClick={() => setIsPage2(true)}
disabled={isPage2}
className="text-zinc-400 hover:text-white disabled:opacity-50"
aria-label="หน้าถัดไป"
>
<ArrowRight />
</Button>
+10
View File
@@ -0,0 +1,10 @@
export async function register() {
if (process.env.NEXT_RUNTIME === "nodejs") {
try {
const { getFollowerCounts } = await import("./lib/followers");
await getFollowerCounts();
} catch (error) {
console.error("[Instrumentation] Failed to warm up cache:", error);
}
}
}
+6
View File
@@ -33,6 +33,12 @@ http {
listen 80;
server_name localhost;
# Security headers for Lighthouse Best Practices
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always;
# Use Docker's internal DNS resolver with a short TTL
# This prevents caching stale IPs when containers are rebuilt
resolver 127.0.0.11 valid=10s;