From c4bb0ed0923a02255e42a5440772ef2a62250a10 Mon Sep 17 00:00:00 2001 From: xintaofei Date: Wed, 25 Mar 2026 23:21:56 +0800 Subject: [PATCH] =?UTF-8?q?web=E6=B5=8F=E8=A7=88=E5=99=A8=E4=B8=8B?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=83=BD=E6=96=B0=E7=AA=97=E5=8F=A3=E6=89=93?= =?UTF-8?q?=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/api.ts | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/src/lib/api.ts b/src/lib/api.ts index a4301f7..d083aac 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -660,19 +660,44 @@ export async function openMergeWindow( operation: string, upstreamCommit?: string | null ): Promise { - return getTransport().call("open_merge_window", { - folderId, - operation, - upstreamCommit: upstreamCommit ?? null, - }) + if (getTransport().isDesktop()) { + return getTransport().call("open_merge_window", { + folderId, + operation, + upstreamCommit: upstreamCommit ?? null, + }) + } + const result = await getTransport().call<{ path: string }>( + "open_merge_window", + { + folderId, + operation, + upstreamCommit: upstreamCommit ?? null, + }, + ) + window.open(result.path, `merge-${folderId}`) } export async function openStashWindow(folderId: number): Promise { - return getTransport().call("open_stash_window", { folderId }) + if (getTransport().isDesktop()) { + return getTransport().call("open_stash_window", { folderId }) + } + const result = await getTransport().call<{ path: string }>( + "open_stash_window", + { folderId }, + ) + window.open(result.path, `stash-${folderId}`) } export async function openPushWindow(folderId: number): Promise { - return getTransport().call("open_push_window", { folderId }) + if (getTransport().isDesktop()) { + return getTransport().call("open_push_window", { folderId }) + } + const result = await getTransport().call<{ path: string }>( + "open_push_window", + { folderId }, + ) + window.open(result.path, `push-${folderId}`) } export async function gitStashPush( @@ -866,7 +891,7 @@ export async function openCommitWindow(folderId: number): Promise { "open_commit_window", { folderId }, ) - window.location.href = result.path + window.open(result.path, `commit-${folderId}`) } export type SettingsSection = @@ -891,7 +916,7 @@ export async function openSettingsWindow( agentType: options?.agentType ?? null, }) } - // Web mode: get navigation path from backend and navigate + // Web mode: open in new window const result = await getTransport().call<{ path: string }>( "open_settings_window", { @@ -899,7 +924,7 @@ export async function openSettingsWindow( agentType: options?.agentType ?? null, }, ) - window.location.href = result.path + window.open(result.path, `settings-${section ?? "general"}`) } export async function listOpenFolders(): Promise {