Files
Genarrative/src/services/frontendRuntimeConfigService.ts
T
suzmii 772e9f0d42
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m53s
Project CI / Backend tests (pull_request) Failing after 15s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m41s
Project CI / Frontend tests (pull_request) Failing after 1m5s
Project CI / Repository checks (pull_request) Failing after 23s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m48s
Project CI / Native shell tests (pull_request) Successful in 5m43s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 10m6s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 10m9s
修复游戏封面预览并统一发布灰度说明
封面生成结果经鉴权 read-url 转为安全 data URL 预览,失败时不阻断已登记素材发布。

统一后台、前端与后端对 game-distribution:publish 未配置和关闭状态的说明。
2026-10-02 16:03:28 +08:00

30 lines
1.0 KiB
TypeScript

import { requestJson } from './apiClient';
const FRONTEND_RUNTIME_CONFIG_API = '/api/runtime/frontend-config';
export type FrontendRuntimeConfig = {
imageEditorAgentSidebarEnabled: boolean;
agcTemplateLibraryEnabled: boolean;
/**
* 游戏发布灰度:未配置 `game-distribution:publish` 或 `enabled=false` 时不开放;
* 显式配置后只有白名单/灰度命中的作者为 `true`,匿名恒为 `false`。
*/
gameDistributionPublishEnabled: boolean;
};
export async function loadFrontendRuntimeConfig() {
return requestJson<FrontendRuntimeConfig>(
FRONTEND_RUNTIME_CONFIG_API,
{ method: 'GET' },
'读取前端运行时配置失败',
{
authImpact: 'local',
// 必须带上登录态:发布灰度按作者判定,匿名请求恒为 false,
// 否则一旦显式配置过 `game-distribution:publish`,网页端就再也拿不到发布入口。
skipRefresh: true,
notifyAuthStateChange: false,
clearAuthOnUnauthorized: false,
},
);
}