+
@@ -94,28 +94,6 @@ export function SoftwareVersionForm({ softwareId }: { softwareId: string }) {
-
-
-
- {(["1.18", "1.17"] as const).map((v) => (
-
- ))}
-
-
- 同一启动器的两个 WoW 客户端发行渠道独立维护
-
-
diff --git a/src/components/admin/SoftwareVersionTable.tsx b/src/components/admin/SoftwareVersionTable.tsx
index e168a95..5568f98 100644
--- a/src/components/admin/SoftwareVersionTable.tsx
+++ b/src/components/admin/SoftwareVersionTable.tsx
@@ -25,6 +25,7 @@ import {
Upload,
Star,
} from "lucide-react";
+import { DEFAULT_WOW_VERSION } from "@/lib/wow-versions";
interface Version {
id: string;
@@ -86,7 +87,6 @@ export function SoftwareVersionTable({
版本
- WoW
版本代码
下载方式
直接下载
@@ -100,7 +100,7 @@ export function SoftwareVersionTable({
暂无版本,点击上方按钮发布第一个版本
@@ -117,7 +117,6 @@ export function SoftwareVersionTable({
版本
- WoW
版本代码
下载方式
直接下载
@@ -132,11 +131,6 @@ export function SoftwareVersionTable({
{initialVersions.map((v) => (
v{v.version}
-
-
- {v.wowVersion}
-
-
{v.versionCode}
@@ -234,9 +228,6 @@ function VersionEditPanel({
const [versionCode, setVersionCode] = useState(v.versionCode.toString());
const [changelog, setChangelog] = useState(v.changelog);
const [changelogEn, setChangelogEn] = useState(v.changelogEn || "");
- const [wowVersion, setWowVersion] = useState<"1.18" | "1.17">(
- (v.wowVersion as "1.18" | "1.17") || "1.18"
- );
const [downloadType, setDownloadType] = useState(v.downloadType);
const [externalUrl, setExternalUrl] = useState(v.externalUrl || "");
const [forceUpdate, setForceUpdate] = useState(v.forceUpdate);
@@ -284,7 +275,7 @@ function VersionEditPanel({
versionCode: Number(versionCode),
changelog,
changelogEn,
- wowVersion,
+ wowVersion: DEFAULT_WOW_VERSION,
downloadType,
filePath: downloadType === "local" ? filePath : null,
externalUrl: downloadType === "url" ? externalUrl : null,
@@ -339,25 +330,6 @@ function VersionEditPanel({
placeholder="可选"
/>
-
-
-
- {(["1.18", "1.17"] as const).map((wv) => (
-
- ))}
-
-
diff --git a/src/components/public/Footer.tsx b/src/components/public/Footer.tsx
index a52b882..b44b05b 100644
--- a/src/components/public/Footer.tsx
+++ b/src/components/public/Footer.tsx
@@ -3,11 +3,11 @@
import Link from "next/link";
import { Package, Download, FileText, Clock } from "lucide-react";
import { useLocale } from "@/i18n/LocaleProvider";
-import { useWowVersion } from "@/i18n/WowVersionProvider";
+import { DEFAULT_WOW_VERSION } from "@/lib/wow-versions";
export function Footer() {
const { t } = useLocale();
- const { wowVersion } = useWowVersion();
+ const wowVersion = DEFAULT_WOW_VERSION;
const quickLinks = [
{ href: "/addons", label: t("footer", "addons"), icon: Package },
diff --git a/src/components/public/HeroBanner.tsx b/src/components/public/HeroBanner.tsx
index 38fce96..b79f611 100644
--- a/src/components/public/HeroBanner.tsx
+++ b/src/components/public/HeroBanner.tsx
@@ -3,7 +3,7 @@
import { useEffect, useRef, useState, useCallback } from "react";
import { Download, ChevronRight } from "lucide-react";
import { useLocale } from "@/i18n/LocaleProvider";
-import { useWowVersion } from "@/i18n/WowVersionProvider";
+import { DEFAULT_WOW_VERSION } from "@/lib/wow-versions";
interface Particle {
x: number;
@@ -48,7 +48,7 @@ export function HeroBanner({
banners?: { imageUrl: string }[];
}) {
const { t } = useLocale();
- const { wowVersion } = useWowVersion();
+ const wowVersion = DEFAULT_WOW_VERSION;
const slides =
banners && banners.length > 0
? banners.map((b) => ({ image: b.imageUrl }))
diff --git a/src/components/public/Navbar.tsx b/src/components/public/Navbar.tsx
index f164dbf..a144a11 100644
--- a/src/components/public/Navbar.tsx
+++ b/src/components/public/Navbar.tsx
@@ -6,7 +6,6 @@ import { usePathname } from "next/navigation";
import { Package, Menu, X } from "lucide-react";
import { useLocale } from "@/i18n/LocaleProvider";
import { LanguageSwitcher } from "./LanguageSwitcher";
-import { WowVersionSwitcher } from "./WowVersionSwitcher";
export function Navbar() {
const [open, setOpen] = useState(false);
@@ -51,7 +50,6 @@ export function Navbar() {
);
})}
-
@@ -86,7 +84,6 @@ export function Navbar() {
);
})}
-
diff --git a/src/components/public/WowVersionSwitcher.tsx b/src/components/public/WowVersionSwitcher.tsx
deleted file mode 100644
index e26f6aa..0000000
--- a/src/components/public/WowVersionSwitcher.tsx
+++ /dev/null
@@ -1,62 +0,0 @@
-"use client";
-
-import { Gamepad2 } from "lucide-react";
-import { useWowVersion } from "@/i18n/WowVersionProvider";
-
-export function WowVersionSwitcher({
- variant = "navbar",
-}: {
- variant?: "navbar" | "mobile";
-}) {
- const { wowVersion, setWowVersion, versions } = useWowVersion();
-
- if (variant === "mobile") {
- return (
-
-
-
WoW
-
- {versions.map((v) => (
-
- ))}
-
-
- );
- }
-
- return (
-
-
- {versions.map((v) => (
-
- ))}
-
- );
-}
diff --git a/src/i18n/WowVersionProvider.tsx b/src/i18n/WowVersionProvider.tsx
deleted file mode 100644
index 810614c..0000000
--- a/src/i18n/WowVersionProvider.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-"use client";
-
-import {
- createContext,
- useCallback,
- useContext,
- useMemo,
- useState,
- type ReactNode,
-} from "react";
-import {
- WOW_COOKIE,
- WOW_VERSIONS,
- type WowVersion,
-} from "@/lib/wow-versions";
-
-interface WowVersionContextValue {
- wowVersion: WowVersion;
- setWowVersion: (next: WowVersion) => void;
- versions: readonly WowVersion[];
-}
-
-const WowVersionContext = createContext
(null);
-
-export function WowVersionProvider({
- initial,
- children,
-}: {
- initial: WowVersion;
- children: ReactNode;
-}) {
- const [wowVersion, setLocal] = useState(initial);
-
- const setWowVersion = useCallback((next: WowVersion) => {
- setLocal(next);
- if (typeof document !== "undefined") {
- document.cookie = `${WOW_COOKIE}=${next}; path=/; max-age=${
- 60 * 60 * 24 * 365
- }; samesite=lax`;
- // Server components rely on the cookie — reload so the SSR'd lists refresh.
- // Use a microtask so React state has a chance to commit first.
- setTimeout(() => {
- if (typeof window !== "undefined") {
- window.location.reload();
- }
- }, 0);
- }
- }, []);
-
- const value = useMemo(
- () => ({ wowVersion, setWowVersion, versions: WOW_VERSIONS }),
- [wowVersion, setWowVersion]
- );
-
- return (
-
- {children}
-
- );
-}
-
-export function useWowVersion() {
- const ctx = useContext(WowVersionContext);
- if (!ctx) {
- throw new Error("useWowVersion must be used inside ");
- }
- return ctx;
-}
diff --git a/src/lib/get-server-wow.ts b/src/lib/get-server-wow.ts
deleted file mode 100644
index 5f14520..0000000
--- a/src/lib/get-server-wow.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { cookies } from "next/headers";
-import {
- DEFAULT_WOW_VERSION,
- WOW_COOKIE,
- isWowVersion,
- type WowVersion,
-} from "./wow-versions";
-
-/**
- * Resolve the wow version from the request cookie on the server.
- * Used by server components to filter DB queries before render.
- */
-export async function getServerWowVersion(): Promise {
- const store = await cookies();
- const v = store.get(WOW_COOKIE)?.value;
- if (isWowVersion(v)) return v;
- return DEFAULT_WOW_VERSION;
-}
diff --git a/src/lib/wow-versions.ts b/src/lib/wow-versions.ts
index b242cb6..f96fd52 100644
--- a/src/lib/wow-versions.ts
+++ b/src/lib/wow-versions.ts
@@ -1,70 +1,37 @@
/**
* Turtle WoW client major-version constants and request resolvers.
*
- * The platform tracks separate addon / launcher builds for each supported
- * client version. Each Release / SoftwareVersion is tagged with one of
- * these strings, and APIs accept `?wow=` to filter.
+ * The public site, admin console, and download APIs currently expose only the
+ * 1.18 channel. Historical rows may still carry a wowVersion tag in the
+ * database, but request resolvers intentionally collapse every request to 1.18.
*/
import type { NextRequest } from "next/server";
-export const WOW_VERSIONS = ["1.18", "1.17"] as const;
+export const WOW_VERSIONS = ["1.18"] as const;
export type WowVersion = (typeof WOW_VERSIONS)[number];
export const DEFAULT_WOW_VERSION: WowVersion = "1.18";
-export const WOW_COOKIE = "wow";
export function isWowVersion(v: unknown): v is WowVersion {
return typeof v === "string" && (WOW_VERSIONS as readonly string[]).includes(v);
}
/**
- * Resolve the requested wow version on a public listing/browsing API.
- *
- * 1. ?wow=1.18|1.17
- * 2. ?wowVersion=1.18|1.17 (alias)
- * 3. cookie `wow`
- * 4. Default DEFAULT_WOW_VERSION
- *
- * Used for endpoints whose response shape depends on the user's currently
- * selected wow channel (addons list, releases list, etc.). The cookie lets a
- * browser session display the right list across navigations.
+ * Resolve the requested wow version on a public listing/browsing API. Only
+ * the canonical 1.18 channel is supported, so explicit legacy values are
+ * ignored instead of changing the query scope.
*/
-export function getApiWowVersion(request: NextRequest | URL): WowVersion {
- const url = request instanceof URL ? request : new URL(request.url);
- const explicit =
- url.searchParams.get("wow") || url.searchParams.get("wowVersion");
- if (isWowVersion(explicit)) return explicit;
-
- if (!(request instanceof URL)) {
- const cookieHeader = request.headers.get("cookie") || "";
- const m = cookieHeader.match(/(?:^|;\s*)wow=([^;]+)/);
- if (m && isWowVersion(m[1])) return m[1] as WowVersion;
- }
-
+export function getApiWowVersion(_request: NextRequest | URL): WowVersion {
return DEFAULT_WOW_VERSION;
}
/**
- * Resolve the wow version for **download endpoints**.
- *
- * 1. ?wow=1.18|1.17 (explicit only)
- * 2. ?wowVersion=1.18|1.17 (alias)
- * 3. Default DEFAULT_WOW_VERSION
- *
- * Cookies are deliberately **NOT** consulted — download URLs must be fully
- * determined by the URL itself so that:
- *
- * - third-party links (`/download/launcher`) always serve the canonical 1.18
- * build regardless of the visitor's previous browsing state, and
- * - which binary you get is never tied to language or any other cookie state.
+ * Resolve the wow version for download endpoints. Download URLs are now pinned
+ * to 1.18 regardless of query params, cookies, or historical client channels.
*/
export function getDownloadWowVersion(
- request: NextRequest | URL
+ _request: NextRequest | URL
): WowVersion {
- const url = request instanceof URL ? request : new URL(request.url);
- const explicit =
- url.searchParams.get("wow") || url.searchParams.get("wowVersion");
- if (isWowVersion(explicit)) return explicit;
return DEFAULT_WOW_VERSION;
}