dsh-links-panel 0.80.1 → 0.81.0
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/lib/client.js +1 -1
- package/lib/index.js +24 -2
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -4153,7 +4153,7 @@ window.__ModuleLoader__.load({
|
|
|
4153
4153
|
const inject = ['slots', 'sidebarRightTabs', 'sidebarRight', 'sessions', 'locale']
|
|
4154
4154
|
|
|
4155
4155
|
/** Build stamp shown in the footer, so a stale bundle is visible at a glance. */
|
|
4156
|
-
const BUILD = 'v0.
|
|
4156
|
+
const BUILD = 'v0.81.0'
|
|
4157
4157
|
/**
|
|
4158
4158
|
* Translate one key and fill `{name}` placeholders.
|
|
4159
4159
|
* @param {string} key - dictionary key.
|
package/lib/index.js
CHANGED
|
@@ -37,7 +37,7 @@ function withOutboundLock(task) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/** Host build stamp, echoed to the panel so a stale bundle is detectable. */
|
|
40
|
-
export const BUILD = 'v0.
|
|
40
|
+
export const BUILD = 'v0.81.0'
|
|
41
41
|
/**
|
|
42
42
|
* The desktop browser reaches the network through the system proxy; the Host's own
|
|
43
43
|
* Node requests bypass it. Detect that proxy so probes can use the same route.
|
|
@@ -246,6 +246,24 @@ async function fetchFaviconDataUrl(url) {
|
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
+
/**
|
|
250
|
+
* Some sites answer 403/404 to non-browser clients (npmjs.com behind Cloudflare
|
|
251
|
+
* answers 403 for every icon path). Fall back to a public favicon service keyed by
|
|
252
|
+
* hostname, which keeps the built-in browser and the panel visually consistent.
|
|
253
|
+
* @param {string} target - the icon URL that failed.
|
|
254
|
+
* @returns {Promise<{dataUrl: string} | null>} data URL or null.
|
|
255
|
+
*/
|
|
256
|
+
async function fetchServiceFavicon(target) {
|
|
257
|
+
let host = ''
|
|
258
|
+
try {
|
|
259
|
+
host = new URL(target).hostname.toLowerCase().replace(/^www\./, '')
|
|
260
|
+
} catch (error) {
|
|
261
|
+
return null
|
|
262
|
+
}
|
|
263
|
+
if (host === '' || host === 'localhost' || /^\d+\.\d+\.\d+\.\d+$/.test(host)) return null
|
|
264
|
+
return fetchFaviconDataUrl(`https://icons.duckduckgo.com/ip3/${host}.ico`)
|
|
265
|
+
}
|
|
266
|
+
|
|
249
267
|
/**
|
|
250
268
|
* Answer `GET /dsh-links/favicon?url=…` with a data URL.
|
|
251
269
|
* @param {object} req - request.
|
|
@@ -266,7 +284,11 @@ async function handleFaviconRequest(req, res) {
|
|
|
266
284
|
res.end()
|
|
267
285
|
return
|
|
268
286
|
}
|
|
269
|
-
const icon = await withOutboundLock(() =>
|
|
287
|
+
const icon = await withOutboundLock(async () => {
|
|
288
|
+
const direct = await fetchFaviconDataUrl(target)
|
|
289
|
+
if (direct !== null) return direct
|
|
290
|
+
return fetchServiceFavicon(target)
|
|
291
|
+
})
|
|
270
292
|
if (!icon) {
|
|
271
293
|
res.writeHead(404)
|
|
272
294
|
res.end()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-links-panel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.81.0",
|
|
4
4
|
"description": "Reference links panel for DeepSeek Harness: collects every URL of a conversation into the right sidebar with pins, turn counts, metadata and favicon caching. DSH 右栏「应用链接」面板。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|