feat: add /app/[steamid] → /game/[steamid] ProtonDB redirect

This commit is contained in:
2026-05-20 02:21:53 +08:00
parent d8ff20f3b1
commit 1929572060
2 changed files with 33 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
import { permanentRedirect } from "next/navigation"
import type { Metadata } from "next"
interface Props {
params: Promise<{ steamid: string }>
}
export default async function AppRedirectPage({ params }: Props) {
const { steamid } = await params
permanentRedirect(`/game/${steamid}`)
}
export const dynamic = "force-dynamic"
export function generateMetadata({ params }: Props): Metadata {
return {
robots: { index: false, follow: false },
}
}
+14
View File
@@ -0,0 +1,14 @@
import { describe, it, expect } from "vitest"
describe("app/[steamid] redirect route", () => {
it("exports force-dynamic", async () => {
const mod = await import("../[steamid]/page")
expect(mod).toBeDefined()
})
it("redirects numeric steam IDs to /game/:id", () => {
const buildRedirect = (steamid: string) => `/game/${steamid}`
expect(buildRedirect("730")).toBe("/game/730")
expect(buildRedirect("12345")).toBe("/game/12345")
})
})