fix(tabs): lock automation to selected window

This commit is contained in:
朴圣佑
2026-05-12 11:06:56 +08:00
parent ec3c3808e6
commit 2bb34f9064
13 changed files with 682 additions and 36 deletions
+4 -1
View File
@@ -6,6 +6,7 @@
chrome,
addLog,
closeConflictingTabsForSource,
createAutomationTab = null,
ensureContentScriptReadyOnTab,
getPanelMode,
normalizeCodex2ApiUrl,
@@ -266,7 +267,9 @@
const injectFiles = ['content/utils.js', 'content/sub2api-panel.js'];
await closeConflictingTabsForSource('sub2api-panel', sub2apiUrl);
const tab = await chrome.tabs.create({ url: sub2apiUrl, active: true });
const tab = typeof createAutomationTab === 'function'
? await createAutomationTab({ url: sub2apiUrl, active: true })
: await chrome.tabs.create({ url: sub2apiUrl, active: true });
const tabId = tab.id;
await rememberSourceLastUrl('sub2api-panel', sub2apiUrl);