Files
PolyWeather/frontend/app/page.tsx
T
2569718930@qq.com 5b19a49ffb 首屏优化:scan terminal 加 s-maxage 缓存 + 落地页预加载 API
1. /api/scan/terminal 返回 Cache-Control: public, s-maxage=30, stale-while-revalidate=120
   → pre-warm 期间也能返回缓存,白屏 20s 变 1s
2. 落地页 2s 后静默 prefetch /api/cities,预热后端进程和连接池
3. metadata 加 preconnect api.polyweather.top
2026-05-26 08:23:33 +08:00

43 lines
1.3 KiB
TypeScript

import type { Metadata } from "next";
import { redirect } from "next/navigation";
import { PreloadTerminalData } from "@/components/landing/PreloadTerminalData";
import { InstitutionalLandingPage } from "@/components/landing/InstitutionalLandingPage";
export const metadata: Metadata = {
title: "PolyWeather | Institutional Weather Signal Intelligence",
description:
"PolyWeather is a paid professional weather-signal intelligence terminal with METAR evidence, DEB forecast blending, and AI decision cards.",
other: {
preconnect: "https://api.polyweather.top",
},
};
export default async function HomePage({
searchParams,
}: {
searchParams: Promise<Record<string, string | string[] | undefined>>;
}) {
const params = await searchParams;
const code = params.code;
if (typeof code === "string" && code.trim()) {
const usp = new URLSearchParams();
for (const [key, value] of Object.entries(params)) {
if (value != null) {
if (Array.isArray(value)) {
for (const v of value) usp.append(key, v);
} else {
usp.set(key, value);
}
}
}
const qs = usp.toString();
redirect(`/auth/callback${qs ? `?${qs}` : ""}`);
}
return (
<>
<PreloadTerminalData />
<InstitutionalLandingPage />
</>
);
}