Merge branch 'master' into feat/game-works-management
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 5m44s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 2m31s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 4m2s
Project CI / Frontend tests (pull_request) Successful in 2m21s
Project CI / Backend tests (pull_request) Successful in 6m47s
Project CI / AI game creator shell web tests (pull_request) Successful in 2m51s
Project CI / Native shell tests (pull_request) Successful in 6m18s
Project CI / Repository checks (pull_request) Successful in 5m5s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 5m44s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 2m31s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 4m2s
Project CI / Frontend tests (pull_request) Successful in 2m21s
Project CI / Backend tests (pull_request) Successful in 6m47s
Project CI / AI game creator shell web tests (pull_request) Successful in 2m51s
Project CI / Native shell tests (pull_request) Successful in 6m18s
Project CI / Repository checks (pull_request) Successful in 5m5s
This commit is contained in:
@@ -18,6 +18,16 @@ const STAGE_ROUTE_ENTRIES = [
|
||||
['game-publish', '/games/publish'],
|
||||
] as const satisfies readonly (readonly [SelectionStage, string])[];
|
||||
|
||||
/**
|
||||
* 带动态段、需要整体回退 index.html 的对外路由前缀 → 归属 stage。
|
||||
* 例如收银台深链 `/pay/<checkoutToken>`(后端 `payment.rs` 用 `format!("/pay/{}", token)` 生成,
|
||||
* 前端从最后一个路径段读 token)。Nginx 必须按「前缀 + 恰好一个路径段」的锚定形状放行:
|
||||
* 只放行裸前缀会让真实收银台链接落到默认 location 变成 404,放行过宽又会把未知路径吞掉。
|
||||
*/
|
||||
export const APP_PREFIX_ROUTE_ENTRIES = [
|
||||
['/pay', 'payment-checkout'],
|
||||
] as const satisfies readonly (readonly [string, SelectionStage])[];
|
||||
|
||||
export const APP_STAGE_ROUTES: Record<SelectionStage, string> =
|
||||
Object.fromEntries(STAGE_ROUTE_ENTRIES) as Record<SelectionStage, string>;
|
||||
|
||||
@@ -41,10 +51,13 @@ export function normalizeAppPath(pathname: string) {
|
||||
export function resolveSelectionStageFromPath(
|
||||
pathname: string,
|
||||
): SelectionStage {
|
||||
if (normalizeAppPath(pathname).startsWith('/pay/')) {
|
||||
return 'payment-checkout';
|
||||
const normalizedPath = normalizeAppPath(pathname);
|
||||
for (const [prefix, stage] of APP_PREFIX_ROUTE_ENTRIES) {
|
||||
if (normalizedPath.startsWith(`${prefix}/`)) {
|
||||
return stage;
|
||||
}
|
||||
}
|
||||
return ROUTE_STAGE_BY_PATH.get(normalizeAppPath(pathname)) ?? 'platform';
|
||||
return ROUTE_STAGE_BY_PATH.get(normalizedPath) ?? 'platform';
|
||||
}
|
||||
|
||||
export function resolveInitialSelectionStageFromPath(
|
||||
|
||||
Reference in New Issue
Block a user