dsh-qwenwork-connect 0.1.9 → 0.2.1

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/loopback.js CHANGED
@@ -9,6 +9,31 @@
9
9
  */
10
10
 
11
11
  /** 本地插件面可被寻址的环回主机名。 */
12
+ /**
13
+ * 额外信任的 Host(逗号分隔)。DSH 常通过 dsh.lan 之类的反代域名访问,
14
+ * 那时 Host 不是环回但请求仍来自本机代理;部署时用这个环境变量补齐。
15
+ */
16
+ function extraTrustedHosts() {
17
+ const parts = [];
18
+ const fromEnv = process.env.QWENWORK_TRUSTED_HOSTS;
19
+ if (typeof fromEnv === 'string' && fromEnv.length > 0) parts.push(fromEnv);
20
+ // DSH 往往由 systemd 托管,进程环境改不了;用文件更实际:
21
+ // ~/.dsh/qwenwork-trusted-hosts,一行一个域名(也接受逗号分隔)。
22
+ try {
23
+ const file = path.join(os.homedir(), '.dsh', 'qwenwork-trusted-hosts');
24
+ parts.push(fs.readFileSync(file, 'utf8'));
25
+ } catch {
26
+ // 没有这个文件就是不需要额外放行
27
+ }
28
+ return new Set(
29
+ parts
30
+ .join(',')
31
+ .split(/[s,]+/)
32
+ .map((item) => item.trim().toLowerCase())
33
+ .filter((item) => item.length > 0),
34
+ );
35
+ }
36
+
12
37
  const LOOPBACK_HOSTS = new Set(['127.0.0.1', 'localhost', '[::1]']);
13
38
 
14
39
  /**
@@ -46,7 +71,8 @@ function hostnameOfHost(host) {
46
71
  */
47
72
  export function hostIsLoopback(host) {
48
73
  if (host === undefined || host.trim() === '') return false;
49
- return LOOPBACK_HOSTS.has(hostnameOfHost(host));
74
+ const hostname = hostnameOfHost(host);
75
+ return LOOPBACK_HOSTS.has(hostname) || extraTrustedHosts().has(hostname);
50
76
  }
51
77
 
52
78
  /**
@@ -60,7 +86,7 @@ export function originIsLoopback(origin) {
60
86
  if (origin === undefined || origin.trim() === '') return true;
61
87
  try {
62
88
  const { hostname } = new URL(origin);
63
- return LOOPBACK_HOSTS.has(hostname) || hostname === '::1';
89
+ return LOOPBACK_HOSTS.has(hostname) || hostname === '::1' || extraTrustedHosts().has(hostname);
64
90
  } catch {
65
91
  return false;
66
92
  }
package/lib/models.js CHANGED
@@ -100,6 +100,16 @@ export const FALLBACK_QWENWORK_MODELS = [
100
100
  maxTokens: MAX_OUTPUT_TOKENS,
101
101
  isRecommended: true,
102
102
  },
103
+ {
104
+ id: 'frontier-1',
105
+ shortName: 'Qwen4-Max 预览',
106
+ billingRate: 0.4,
107
+ supportsImages: true,
108
+ contextWindow: MAX_INPUT_TOKENS,
109
+ availableContextWindows: [MAX_INPUT_TOKENS],
110
+ maxTokens: MAX_OUTPUT_TOKENS,
111
+ isNew: true,
112
+ },
103
113
  {
104
114
  id: 'qwen3.8-max-preview',
105
115
  shortName: 'Qwen3.8-Max',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-qwenwork-connect",
3
- "version": "0.1.9",
3
+ "version": "0.2.1",
4
4
  "description": "千问办公(QwenWork)的 DSH 模型提供方:device flow 登录、官方网关、支持工具调用",
5
5
  "license": "MIT",
6
6
  "author": "AaIchhe",