dsh-mobile-access 1.1.4 → 1.1.5

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.
Files changed (3) hide show
  1. package/README.md +4 -3
  2. package/package.json +1 -1
  3. package/routes.js +22 -1
package/README.md CHANGED
@@ -79,7 +79,7 @@ iPhone 打开「设置 → 无线局域网」,确认和 Mac 连的是同一个
79
79
  ### 第 2 步:在 Mac 终端执行一条命令
80
80
 
81
81
  ```bash
82
- dsh plugin --profile web add dsh-mobile-access@1.1.4 --registry=https://registry.npmjs.org/
82
+ dsh plugin --profile web add dsh-mobile-access@1.1.5 --registry=https://registry.npmjs.org/
83
83
  ```
84
84
 
85
85
  这条命令做三件事:
@@ -370,7 +370,7 @@ iPhone 软键盘没有可用的 Shift 键,因此插件在 **iOS / iPadOS** 上
370
370
  ### 推荐:npm 官方命令
371
371
 
372
372
  ```bash
373
- dsh plugin --profile web add dsh-mobile-access@1.1.4 --registry=https://registry.npmjs.org/
373
+ dsh plugin --profile web add dsh-mobile-access@1.1.5 --registry=https://registry.npmjs.org/
374
374
  ```
375
375
 
376
376
  ### 使用 `@latest`
@@ -500,7 +500,8 @@ dsh plugin --profile web remove dsh-mobile-access
500
500
  - `1.1.0` — 回环监听自动局域网网关(macOS / Windows,HTTP + `/api/remote.mux` WebSocket)。
501
501
  - `1.1.1` — iPhone / iPad 上模型选择页 16px 缩放守卫。
502
502
  - `1.1.2` — 打开模型选择时不自动弹键盘、不整体上移。
503
- - `1.1.4` — iPhone / iPad 上第一次点击直接切换会话,并在切换后自动收起左侧栏;当前 npm `latest`。
503
+ - `1.1.5` — Tailscale Serve 经 HTTPS 访问时,允许带 Tailscale 身份头的 `*.ts.net` Host(仅限本机回环转发);当前 npm `latest`。
504
+ - `1.1.4` — iPhone / iPad 上第一次点击直接切换会话,并在切换后自动收起左侧栏。
504
505
  - `1.1.3` — 首次尝试临时移除会话行 `tabindex`。
505
506
 
506
507
  ## 许可证
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mobile-access",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Independent DSH bundle that pairs iPhones and iPads with the official DeepSeek Harness Web GUI over the local network.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/routes.js CHANGED
@@ -112,7 +112,28 @@ function pairingHostAllowed(ctx, request) {
112
112
  catch {
113
113
  return false;
114
114
  }
115
- return isLoopbackHost(bare) || bare === expected;
115
+ if (isLoopbackHost(bare) || bare === expected)
116
+ return true;
117
+ return isTailscaleServeRequest(request, bare);
118
+ }
119
+ /**
120
+ * Tailscale Serve terminates TLS and forwards to the loopback listener while
121
+ * preserving the public `*.ts.net` Host. Serve adds identity headers that a
122
+ * cross-site browser form cannot forge; requiring one plus a loopback peer
123
+ * keeps DNS-rebinding protection intact for direct loopback requests.
124
+ */
125
+ function isTailscaleServeRequest(request, hostname) {
126
+ if (!hostname.endsWith('.ts.net'))
127
+ return false;
128
+ const identity = firstHeader(request.headers, 'tailscale-user-login')
129
+ ?? firstHeader(request.headers, 'tailscale-user-name');
130
+ if (identity === undefined || identity.length === 0)
131
+ return false;
132
+ const remote = request.socket?.remoteAddress;
133
+ if (remote === undefined)
134
+ return false;
135
+ const normalized = remote.startsWith('::ffff:') ? remote.slice(7) : remote;
136
+ return isLoopbackHost(normalized);
116
137
  }
117
138
  function pairingNonce() {
118
139
  const bytes = new Uint8Array(18);