Merge pull request '修复运行页刷新按钮不真正重载' (#640) from fix/run-preview-refresh-reload into master
Project CI / AI game creator shell Rust lane 1/2 (push) Successful in 7m7s
Project CI / AI game creator shell Rust lane 2/2 (push) Successful in 6m4s
Project CI / AI game creator shell Rust crates (push) Successful in 5m19s
Project CI / Frontend tests (push) Successful in 4m25s
Project CI / Backend tests (push) Successful in 9m6s
Project CI / AI game creator shell web tests (push) Successful in 2m42s
Project CI / Repository checks (push) Successful in 6m59s
Project CI / Native shell tests (push) Successful in 11m3s

Reviewed-on: http://git.genarrative.world/git/GenarrativeAI/Genarrative/pulls/640
This commit was merged in pull request #640.
This commit is contained in:
2026-10-06 10:59:23 +08:00
4 changed files with 106 additions and 6 deletions
+23 -1
View File
@@ -2642,7 +2642,6 @@ function assertAiGameCreatorShellUserDevBoundary() {
'function resolveEmbeddedPreviewUrl(',
"url.protocol !== 'http:' || url.hostname !== '127.0.0.1'",
'sandbox="allow-scripts allow-same-origin allow-forms allow-pointer-lock"',
'src={embeddedUrl}',
]) {
if (
!sourceIncludesSnippet(aiGameCreatorLocalGamePreviewFrameSource, snippet)
@@ -2652,6 +2651,29 @@ function assertAiGameCreatorShellUserDevBoundary() {
);
}
}
// 预览框的 `src` 允许经一个短变量中转(刷新时要在地址上叠加 `__agc_reload` 这类非业务参数),
// 但这个变量必须由被校验过的 `embeddedUrl` 派生:只换名字、丢掉派生关系仍按漂移处理。
const iframeUrlDerivation = aiGameCreatorLocalGamePreviewFrameSource.match(
/const\s+iframeUrl\s*=\s*useMemo\(\s*\(\s*\)\s*=>\s*\{[\s\S]*?\}\s*,\s*\[/,
);
if (
!sourceIncludesSnippet(
aiGameCreatorLocalGamePreviewFrameSource,
'src={embeddedUrl}',
) &&
!(
sourceIncludesSnippet(
aiGameCreatorLocalGamePreviewFrameSource,
'src={iframeUrl ?? undefined}',
) &&
iframeUrlDerivation !== null &&
iframeUrlDerivation[0].includes('embeddedUrl')
)
) {
throw new Error(
'AI game creator embedded preview boundary drifted: iframe src must derive from the validated embeddedUrl',
);
}
for (const snippet of [
"await invoke<LocalPreviewStatus>(\n 'activate_local_game_preview'",
'已载入客户端运行视图',