dsh-web-fetch-enhanced 0.0.1 → 0.0.2
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/README.en.md +1 -1
- package/README.md +1 -1
- package/lib/client.js +2 -2
- package/lib/index.js +33 -10
- package/lib/types/client/locales.d.ts +1 -1
- package/lib/types/index.d.ts +2 -1
- package/package.json +12 -12
package/README.en.md
CHANGED
|
@@ -53,7 +53,7 @@ dsh plugin --profile web add link:/absolute/path/to/dsh-web-fetch-enhanced
|
|
|
53
53
|
|
|
54
54
|
Open DSH Web and go to:
|
|
55
55
|
|
|
56
|
-
**Settings → Plugins → Configurable plugins →
|
|
56
|
+
**Settings → Plugins → Configurable plugins → Web Fetch Enhanced**
|
|
57
57
|
|
|
58
58
|
Expand the card and enter one network per line under **Allowed CIDRs**. For a typical Clash / Mihomo fake-IP setup:
|
|
59
59
|
|
package/README.md
CHANGED
package/lib/client.js
CHANGED
|
@@ -256,7 +256,7 @@ window.__ModuleLoader__.load({
|
|
|
256
256
|
//#endregion
|
|
257
257
|
//#region lib/types/client/locales.js
|
|
258
258
|
const en = {
|
|
259
|
-
title: "
|
|
259
|
+
title: "Web Fetch Enhanced",
|
|
260
260
|
description: "Allow selected non-public destinations for web_fetch. Public addresses remain available by default.",
|
|
261
261
|
expand: "Expand",
|
|
262
262
|
collapse: "Collapse",
|
|
@@ -279,7 +279,7 @@ window.__ModuleLoader__.load({
|
|
|
279
279
|
blank: "Blank entries are ignored."
|
|
280
280
|
};
|
|
281
281
|
const zh = {
|
|
282
|
-
title: "
|
|
282
|
+
title: "Web Fetch Enhanced",
|
|
283
283
|
description: "允许 web_fetch 访问指定的非公网目标;公网地址默认仍可正常访问。",
|
|
284
284
|
expand: "展开",
|
|
285
285
|
collapse: "折叠",
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
|
-
import { installSettingsSection, settingsNamespace } from "@deepseek-ai/dsh-settings";
|
|
3
2
|
import { isIP } from "node:net";
|
|
4
3
|
import ipaddr from "ipaddr.js";
|
|
5
4
|
import { WebError } from "@deepseek-ai/dsh-web";
|
|
@@ -552,12 +551,14 @@ function translateAbortOrNetwork(error, signal) {
|
|
|
552
551
|
* @module dsh-web-fetch-enhanced
|
|
553
552
|
*/
|
|
554
553
|
const MAX_NODE_TIMER_DELAY_MS = 2147483647;
|
|
554
|
+
const FIBER_DISPOSED = 4;
|
|
555
|
+
const FIBER_UNLOADING = 5;
|
|
555
556
|
/** Explicit product User-Agent used by default. */
|
|
556
557
|
const DEFAULT_USER_AGENT = "dsh-web-fetch-enhanced/0.1.0";
|
|
557
558
|
/** Default provider id; select it in the dsh-web row with fetchProvider. */
|
|
558
559
|
const DEFAULT_PROVIDER_ID = "http-enhanced";
|
|
559
560
|
/** Settings namespace paired with the Web Profile configuration card. */
|
|
560
|
-
const SETTINGS_NAMESPACE =
|
|
561
|
+
const SETTINGS_NAMESPACE = "web-fetch-enhanced";
|
|
561
562
|
/** Cordis plugin name used by loader diagnostics. */
|
|
562
563
|
const name = "web-fetch-enhanced";
|
|
563
564
|
/** The web seam this provider contributes to. */
|
|
@@ -593,19 +594,41 @@ function createProvider(config = {}) {
|
|
|
593
594
|
};
|
|
594
595
|
return new EnhancedHttpFetchProvider(resolved.providerId, limits, createAllowlistResolver(policy));
|
|
595
596
|
}
|
|
597
|
+
function isUnloading(ctx) {
|
|
598
|
+
const state = ctx.fiber?.state;
|
|
599
|
+
return state === FIBER_UNLOADING || state === FIBER_DISPOSED;
|
|
600
|
+
}
|
|
596
601
|
/** Register the enhanced fetch provider and its live Web Profile settings section. */
|
|
597
602
|
function apply(ctx, config) {
|
|
598
603
|
const providerId = resolveConfig(config).providerId;
|
|
599
604
|
let current = () => config;
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
605
|
+
ctx.inject(["settings"], (settingsCtx) => {
|
|
606
|
+
const settings = settingsCtx.settings;
|
|
607
|
+
if (typeof settings.installSection === "function") {
|
|
608
|
+
settings.installSection(ctx, SETTINGS_NAMESPACE, Config, config, {
|
|
609
|
+
setSource: (source) => {
|
|
610
|
+
current = source;
|
|
611
|
+
},
|
|
612
|
+
onChange: () => {},
|
|
613
|
+
validate: (value) => {
|
|
614
|
+
if (resolveConfig(value).providerId !== providerId) throw new Error("web-fetch-enhanced: providerId cannot be changed through live settings");
|
|
615
|
+
createProvider(value);
|
|
616
|
+
}
|
|
617
|
+
});
|
|
618
|
+
return;
|
|
608
619
|
}
|
|
620
|
+
const scope = settings.register(SETTINGS_NAMESPACE, Config, {
|
|
621
|
+
base: config,
|
|
622
|
+
validate: (value) => {
|
|
623
|
+
if (resolveConfig(value).providerId !== providerId) throw new Error("web-fetch-enhanced: providerId cannot be changed through live settings");
|
|
624
|
+
createProvider(value);
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
current = () => scope.get();
|
|
628
|
+
settingsCtx.effect(() => () => {
|
|
629
|
+
if (isUnloading(ctx)) return;
|
|
630
|
+
current = () => config;
|
|
631
|
+
});
|
|
609
632
|
});
|
|
610
633
|
const dynamicProvider = {
|
|
611
634
|
id: providerId,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const en: {
|
|
2
|
-
readonly title: "
|
|
2
|
+
readonly title: "Web Fetch Enhanced";
|
|
3
3
|
readonly description: "Allow selected non-public destinations for web_fetch. Public addresses remain available by default.";
|
|
4
4
|
readonly expand: "Expand";
|
|
5
5
|
readonly collapse: "Collapse";
|
package/lib/types/index.d.ts
CHANGED
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { Context } from '@deepseek-ai/cordis';
|
|
8
8
|
import z from '@deepseek-ai/schemastery';
|
|
9
|
+
import type { SettingsNamespace } from '@deepseek-ai/dsh-settings';
|
|
9
10
|
import { EnhancedHttpFetchProvider } from './provider.ts';
|
|
10
11
|
/** Explicit product User-Agent used by default. */
|
|
11
12
|
export declare const DEFAULT_USER_AGENT = "dsh-web-fetch-enhanced/0.1.0";
|
|
12
13
|
/** Default provider id; select it in the dsh-web row with fetchProvider. */
|
|
13
14
|
export declare const DEFAULT_PROVIDER_ID = "http-enhanced";
|
|
14
15
|
/** Settings namespace paired with the Web Profile configuration card. */
|
|
15
|
-
export declare const SETTINGS_NAMESPACE:
|
|
16
|
+
export declare const SETTINGS_NAMESPACE: SettingsNamespace;
|
|
16
17
|
/** Cordis plugin name used by loader diagnostics. */
|
|
17
18
|
export declare const name = "web-fetch-enhanced";
|
|
18
19
|
/** The web seam this provider contributes to. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-web-fetch-enhanced",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Configurable non-public address allowlists for DeepSeek Harness web_fetch",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -68,19 +68,19 @@
|
|
|
68
68
|
"node": "^22.19.0 || >=24.0.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@deepseek-ai/cordis": "^4.0.1",
|
|
72
|
-
"@deepseek-ai/dsh-timeout": "^0.1.1-rc.2 || ^0.1.2-alpha.1",
|
|
73
|
-
"@deepseek-ai/dsh-settings": "^0.1.1-rc.2 || ^0.1.2-alpha.1",
|
|
74
|
-
"@deepseek-ai/dsh-client-runtime": "^0.1.1-rc.2 || ^0.1.2-alpha.1",
|
|
75
|
-
"@deepseek-ai/dsh-client-locale": "^0.1.1-rc.2 || ^0.1.2-alpha.1",
|
|
76
|
-
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.1-rc.2 || ^0.1.2-alpha.1",
|
|
77
|
-
"@deepseek-ai/dsh-client-ui-settings": "^0.1.1-rc.2 || ^0.1.2-alpha.1",
|
|
78
|
-
"@deepseek-ai/dsh-client-ui-settings-plugins": "^0.1.1-rc.2 || ^0.1.2-alpha.1",
|
|
79
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.1.1-rc.2 || ^0.1.2-alpha.1",
|
|
80
|
-
"@deepseek-ai/dsh-web": "^0.1.1-rc.2 || ^0.1.2-alpha.1"
|
|
71
|
+
"@deepseek-ai/cordis": "^4.0.1 || ^4.0.2",
|
|
72
|
+
"@deepseek-ai/dsh-timeout": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2",
|
|
73
|
+
"@deepseek-ai/dsh-settings": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2",
|
|
74
|
+
"@deepseek-ai/dsh-client-runtime": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2",
|
|
75
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2",
|
|
76
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2",
|
|
77
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2",
|
|
78
|
+
"@deepseek-ai/dsh-client-ui-settings-plugins": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2",
|
|
79
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2",
|
|
80
|
+
"@deepseek-ai/dsh-web": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"@deepseek-ai/schemastery": "^3.18.1",
|
|
83
|
+
"@deepseek-ai/schemastery": "^3.18.1 || ^3.18.2",
|
|
84
84
|
"ipaddr.js": "^2.5.0",
|
|
85
85
|
"undici": "^8.10.0"
|
|
86
86
|
},
|