dsh-site-bridge 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extension/manifest.json +1 -1
- package/extension/popup.js +25 -12
- package/extension/sw.js +10 -2
- package/package.json +1 -1
package/extension/manifest.json
CHANGED
package/extension/popup.js
CHANGED
|
@@ -239,16 +239,33 @@ $('import-file').addEventListener('change', async (event) => {
|
|
|
239
239
|
}
|
|
240
240
|
})
|
|
241
241
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
242
|
+
async function attachCurrentTab() {
|
|
243
|
+
let tabId = null
|
|
244
|
+
try {
|
|
245
|
+
const [tab] = await chrome.tabs.query({ active: true, currentWindow: true })
|
|
246
|
+
tabId = tab?.id ?? null
|
|
247
|
+
} catch {
|
|
248
|
+
tabId = null
|
|
249
|
+
}
|
|
250
|
+
if (tabId == null) {
|
|
251
|
+
setNote(t('claimFailed', [t('claimFailedUnknown')]), true)
|
|
252
|
+
return
|
|
253
|
+
}
|
|
254
|
+
try {
|
|
255
|
+
const result = await send({ type: 'claim', tabId })
|
|
256
|
+
if (!result?.ok) {
|
|
257
|
+
setNote(t('claimFailed', [String(result?.error ?? t('claimFailedUnknown'))]), true)
|
|
258
|
+
return
|
|
259
|
+
}
|
|
260
|
+
setNote('')
|
|
261
|
+
} catch (error) {
|
|
262
|
+
setNote(t('claimFailed', [String(error?.message ?? error)]), true)
|
|
248
263
|
return
|
|
249
264
|
}
|
|
250
265
|
await refresh()
|
|
251
|
-
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
$('claim').addEventListener('click', attachCurrentTab)
|
|
252
269
|
|
|
253
270
|
$('capture').addEventListener('click', async () => {
|
|
254
271
|
const status = await send({ type: 'status' })
|
|
@@ -277,11 +294,7 @@ $('pick').addEventListener('click', async () => {
|
|
|
277
294
|
await refresh()
|
|
278
295
|
})
|
|
279
296
|
|
|
280
|
-
$('claim-more').addEventListener('click',
|
|
281
|
-
const result = await send({ type: 'claim' })
|
|
282
|
-
if (!result?.ok && result?.error) setNote(String(result.error), true)
|
|
283
|
-
await refresh()
|
|
284
|
-
})
|
|
297
|
+
$('claim-more').addEventListener('click', attachCurrentTab)
|
|
285
298
|
|
|
286
299
|
$('tabs-select').addEventListener('change', async (event) => {
|
|
287
300
|
const tabId = Number(event.target.value)
|
package/extension/sw.js
CHANGED
|
@@ -272,11 +272,19 @@ async function attach(tabId) {
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
async function claimTab(tabId) {
|
|
275
|
-
|
|
275
|
+
// Without an explicit id, claim whatever tab the user is looking at, so a
|
|
276
|
+
// caller that only knows "this tab" cannot silently pass NaN.
|
|
277
|
+
let id = Number(tabId)
|
|
278
|
+
if (!Number.isFinite(id)) {
|
|
279
|
+
const [active] = await chrome.tabs.query({ active: true, lastFocusedWindow: true })
|
|
280
|
+
id = active?.id
|
|
281
|
+
}
|
|
282
|
+
if (!Number.isFinite(id)) throw new Error('no tab to claim: pass tabId or open a page first')
|
|
283
|
+
const tab = await chrome.tabs.get(id)
|
|
276
284
|
if (!/^https?:|^file:/.test(tab.url ?? '')) {
|
|
277
285
|
throw new Error(`cannot drive ${tab.url || 'this tab'}: only http(s) and file:// pages are supported`)
|
|
278
286
|
}
|
|
279
|
-
return attach(
|
|
287
|
+
return attach(id)
|
|
280
288
|
}
|
|
281
289
|
|
|
282
290
|
chrome.debugger.onDetach.addListener((source, reason) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-site-bridge",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Chrome/Edge MV3 bridge for DeepSeek Harness: capture page markup (DOM, styles, selectors) and BFF traffic (xhr/fetch with headers and bodies) into a workspace snapshot bundle, drive the page with trusted CDP input, and verify injected scripts. Authorization never leaves the browser and is never written to disk.",
|
|
5
5
|
"icon": "./icon.svg",
|
|
6
6
|
"type": "module",
|