mirror of
https://github.com/aiclientproxy/proxycast.git
synced 2026-09-24 23:10:56 +08:00
chore: release v0.97.0
This commit is contained in:
@@ -242,7 +242,7 @@ async function executeRemoteCommand(commandData) {
|
||||
return;
|
||||
}
|
||||
|
||||
const tabId = await resolveTargetTabId();
|
||||
const tabId = await resolveCommandTargetTabId(commandData.target);
|
||||
if (!tabId) {
|
||||
sendCommandResult({
|
||||
requestId,
|
||||
@@ -290,6 +290,26 @@ async function executeRemoteCommand(commandData) {
|
||||
}
|
||||
}
|
||||
|
||||
async function resolveCommandTargetTabId(rawTarget) {
|
||||
const normalizedTarget = String(rawTarget || "").trim();
|
||||
if (!normalizedTarget) {
|
||||
return await resolveTargetTabId();
|
||||
}
|
||||
|
||||
const byId = Number(normalizedTarget);
|
||||
if (Number.isInteger(byId) && byId > 0) {
|
||||
try {
|
||||
const tab = await chrome.tabs.get(byId);
|
||||
if (tab?.id) {
|
||||
activeTabId = tab.id;
|
||||
return tab.id;
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
return await resolveTargetTabId();
|
||||
}
|
||||
|
||||
async function handleOpenUrl(commandData, waitForPageInfo) {
|
||||
const requestId = commandData.requestId;
|
||||
const sourceClientId = commandData.sourceClientId;
|
||||
|
||||
Reference in New Issue
Block a user