移除AGC发布入口前端灰度
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m33s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m3s
Project CI / Backend tests (pull_request) Failing after 18s
Project CI / Frontend tests (pull_request) Successful in 2m18s
Project CI / Repository checks (pull_request) Failing after 16s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m42s
Project CI / Native shell tests (pull_request) Successful in 6m13s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Failing after 8m59s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 11m8s

让DirectProject工作台始终展示发布按钮,保留Tauri、项目原型和服务端校验

删除原生发布灰度查询命令及配置白名单

更新发布入口与Rust facade定向测试
This commit is contained in:
2026-10-01 20:10:46 +08:00
parent e471d4505f
commit 618c69e766
7 changed files with 2 additions and 84 deletions
@@ -133,7 +133,6 @@ const allowedUncalledTauriCommands = [
'generate_game_distribution_cover',
'prepare_local_project_game_package',
'read_game_cover_generation_price',
'read_game_publish_availability',
'suggest_game_distribution_publish_metadata',
'upload_local_project_game_package',
// 账户与钱包由 Rust typed command 持有 origin/Bearer/envelope;命令名在 `accountHost.ts`
@@ -647,7 +647,6 @@ pub(super) fn run() {
login_client_with_password,
login_client_with_phone_code,
logout_client_session,
read_game_publish_availability,
suggest_game_distribution_publish_metadata,
read_game_cover_generation_price,
generate_game_distribution_cover,
@@ -360,26 +360,6 @@ async fn resolve_cover_queue(
Err("生成游戏封面超时,请稍后重试".to_string())
}
#[tauri::command]
pub(crate) async fn read_game_publish_availability() -> Result<bool, String> {
let snapshot = require_platform_session()?;
let client = build_client()?;
let value = request_json(
&client,
&snapshot,
Method::GET,
&["api", "runtime", "frontend-config"],
None,
None,
"读取发布灰度配置失败",
)
.await?;
Ok(value
.get("gameDistributionPublishEnabled")
.and_then(Value::as_bool)
.unwrap_or(false))
}
#[tauri::command]
pub(crate) async fn suggest_game_distribution_publish_metadata(
name: String,
+1 -20
View File
@@ -90,7 +90,6 @@ import {
type ResourceReferenceInsertEventDetail,
} from './features/project-workspace/resourceReferences';
import { RuntimeConfigDialog } from './features/runtime-config/RuntimeConfigDialog';
import { readGamePublishAvailability } from './services/gameDistributionPublish';
import {
setAgcPluginProjectPath,
startAvailableAgcEditorPlugins,
@@ -343,8 +342,6 @@ export function App({
const [publishBlockedMessage, setPublishBlockedMessage] = useState<
string | null
>(null);
// 发布灰度:只有命中的账号才把「发布到游戏广场」入口交给聊天头;读取失败按不开放处理。
const [gamePublishAllowed, setGamePublishAllowed] = useState(false);
const [projectChatError, setProjectChatError] = useState('');
const designReplyAnimation = useDesignReplyAnimation();
const [designAgentStatus, setDesignAgentStatus] = useState('');
@@ -888,20 +885,6 @@ export function App({
}
}
useEffect(() => {
let cancelled = false;
void readGamePublishAvailability()
.then((allowed) => {
if (!cancelled) setGamePublishAllowed(allowed);
})
.catch(() => {
if (!cancelled) setGamePublishAllowed(false);
});
return () => {
cancelled = true;
};
}, [localProject?.projectPath]);
/**
* 导出试玩包并打开发布面板。
*
@@ -1973,9 +1956,7 @@ export function App({
ensureConversationReadAllowed={ensureDirectHistoryReadAllowed}
ensureConversationWriteAllowed={ensureDirectTurnWriteAllowed}
initialTurn={initialDirectTurn}
onRequestGamePublish={
gamePublishAllowed ? requestGamePublish : undefined
}
onRequestGamePublish={requestGamePublish}
onCancelConfirmation={cancelUiCommandConfirmation}
onConfirmConfirmation={confirmUiCommand}
pendingConfirmation={pendingUiConfirmation}
@@ -38,19 +38,6 @@ function requireNativeInvoke(invoke?: TauriInvoke) {
return resolved;
}
/**
* 读取当前账号的游戏发布灰度。
*
* 与网页端共用 `/api/runtime/frontend-config`:后端未配置 `game-distribution:publish`
* 时对已登录作者默认开放,运营收紧后只有白名单/灰度命中的作者返回 `true`。读取失败按
* “不开放入口”处理——写入口本身还会再拦一次,AGC 面板不作为唯一把关点。
*/
export async function readGamePublishAvailability(
invoke?: TauriInvoke,
): Promise<boolean> {
return requireNativeInvoke(invoke)('read_game_publish_availability');
}
export type GameDistributionPublishResult = {
gameId: string;
versionId: string;
@@ -7,10 +7,8 @@ import {
generateGameDistributionCover,
publishLocalProjectGame,
readGameCoverGenerationPrice,
readGamePublishAvailability,
suggestGameDistributionPublishMetadata,
} from '../src/services/gameDistributionPublish';
const MANIFEST = {
projectId: 'local-proj-1',
name: '星轨防线',
@@ -164,9 +162,8 @@ describe('Rust 发布 facade', () => {
expect(invoke).not.toHaveBeenCalled();
});
test('发布灰度、资料建议和价格均通过 native command', async () => {
test('资料建议和价格均通过 native command', async () => {
const { invoke, calls } = installNativeInvoke((command) => {
if (command === 'read_game_publish_availability') return true;
if (command === 'suggest_game_distribution_publish_metadata') {
return { summary: '驾驶炮台守住轨道城', category: '策略' };
}
@@ -174,7 +171,6 @@ describe('Rust 发布 facade', () => {
throw new Error(`未预期的命令:${command}`);
});
await expect(readGamePublishAvailability(invoke)).resolves.toBe(true);
await expect(
suggestGameDistributionPublishMetadata(
{
@@ -194,7 +190,6 @@ describe('Rust 发布 facade', () => {
).resolves.toBe(5);
expect(calls).toEqual([
{ command: 'read_game_publish_availability', args: undefined },
{
command: 'suggest_game_distribution_publish_metadata',
args: {
@@ -253,10 +248,4 @@ describe('Rust 发布 facade', () => {
},
]);
});
test('缺少 native 宿主时发布网络 facade 失败关闭', async () => {
await expect(readGamePublishAvailability()).rejects.toThrow(
'需要在 Tauri App 内执行发布操作',
);
});
});
@@ -29,21 +29,6 @@ import {
resolveDeclarations,
} from './styleCascade';
const readGamePublishAvailabilityMock = vi.hoisted(() =>
vi.fn(async () => true),
);
vi.mock('../src/services/gameDistributionPublish', async (importOriginal) => {
const actual =
await importOriginal<
typeof import('../src/services/gameDistributionPublish')
>();
return {
...actual,
readGamePublishAvailability: readGamePublishAvailabilityMock,
};
});
const PROJECT_PATH = '/tmp/game-publish-feedback-project';
const PROJECT_ID = 'game-publish-feedback-project';
@@ -131,8 +116,6 @@ async function clickPublish() {
beforeEach(() => {
window.history.pushState({}, '', '/');
readGamePublishAvailabilityMock.mockReset();
readGamePublishAvailabilityMock.mockResolvedValue(true);
});
function createExportPackageResult() {