feat: add multi-strategy version fetchers, disable auto-fetch by default

- Add 4 version-fetch strategies (UpToDateCheck API, Store Page Scrape,
  Community Hub Scrape, Store API Heuristic) — no Steam API key needed
- Create orchestrator that tries all strategies, prefers named version
  over build ID
- Add test page at /test-version-fetchers for comparing strategies
- Add standalone /api/version-test endpoint (direct Steam App ID, no DB)
- Update /api/games/:id/steamdb-version to use new strategies
- Disable auto-fetch on submit page by default (NEXT_PUBLIC_VERSION_AUTO_FETCH=true to enable)
- SteamDB scraping blocked by Cloudflare; strategies preserved for later enablement
This commit is contained in:
2026-05-16 20:13:23 +08:00
parent 88a098f387
commit e5f671a992
13 changed files with 1356 additions and 37 deletions
+18
View File
@@ -0,0 +1,18 @@
/** Result from a single version-fetch strategy */
export interface VersionFetchResult {
/** Human-readable version string like "1.2.3" or "Patch 4.0" */
versionString: string | null
/** Numeric build ID from Steam */
buildId: string | null
/** Which strategy produced this result */
source: string
/** Whether the strategy succeeded (even if partial — e.g. buildId only) */
success: boolean
/** Error message if strategy failed completely */
error?: string
}
/** A version-fetch strategy function */
export type VersionFetchStrategy = (
steamAppId: number,
) => Promise<VersionFetchResult>