dsh-plugin-tether 0.1.15 → 0.1.16

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  本文件记录面向用户的变化。每个版本的这一节会原样作为该版本 Release 的说明。
4
4
 
5
+ ## 0.1.16
6
+
7
+ ### 新增
8
+
9
+ - **英文界面**([#8](https://github.com/zexadev/dsh-tether/issues/8))。手机 App 的界面、连接与本地模式的报错、常驻通知,以及电脑上插件与 sidecar 打在终端里的输出,现在都有英文。没有单独的语言开关,各处跟随各自那一侧的语言:App 跟手机的系统语言,终端输出跟电脑的系统语言,插件注入在 dsh 界面里的那部分(侧栏按钮、配对串弹窗、已配对手机列表)跟 dsh 自己的语言设置,在 dsh 设置里切换语言即时生效。dsh 界面本身的语言仍由 dsh 的设置决定。
10
+
5
11
  ## 0.1.15
6
12
 
7
13
  ### 新增
package/README.md CHANGED
@@ -135,6 +135,7 @@ The Termux route still works if you prefer it: install dsh and this plugin insid
135
135
  - The iOS build is beta: built only in CI, never run on a real device, and you sign it yourself. Android is the one verified on real hardware.
136
136
  - The app connects when you open it and holds no background connection — Android's doze would not let it anyway.
137
137
  - The interface on the phone is DSH's own; the narrow-screen fit comes from minimal injected styles, so a dsh layout change may need a follow-up here.
138
+ - English and Chinese: the app follows your phone's system language, terminal output follows the computer's, and the part injected into the dsh interface follows dsh's own language setting. There is no separate language switch.
138
139
  - Local mode exists only in the `arm64` build, never on iOS; the phone lacks bash and a full coreutils, so shell-dependent tools are incomplete. The `arm64` APK is about 71 MB because of the bundled runtime; the others are about 32 MB.
139
140
  - Verified against dsh **`0.1.0-rc.7`**, **`0.1.0-rc.8`**, **`0.1.2`** (alpha and rc.1), **`0.1.5-alpha.1`** and **`0.1.5-rc.2`**. dsh is in developer preview — check this line before assuming a newer dsh works. The browser authentication dsh introduced in 0.1.2-alpha is handled entirely on the machine side; the phone app needs no update for it.
140
141
 
package/README.zh.md CHANGED
@@ -135,6 +135,7 @@ dsh plugin --profile web add .
135
135
  - iOS 版是测试版:只在 CI 上构建,从未在真机运行过,且需要自行签名。安卓版是经过真机验证的那一个。
136
136
  - App 打开时才连接,不在后台常驻——Android 的 doze 也留不住它。
137
137
  - 手机上的界面是 DSH 自己的,窄屏适配靠注入的最小样式完成;dsh 改版式时可能需要跟进。
138
+ - 中英双语:App 界面跟随手机的系统语言;电脑终端上的输出跟随电脑的系统语言;注入 dsh 界面的那部分跟随 dsh 自己的语言设置。没有单独的语言开关。
138
139
  - 本地模式只有 `arm64` 包有,iOS 没有;手机上没有 bash 与完整 coreutils,依赖 shell 的工具用不全。arm64 包因内置运行时约 71 MB,其余包约 32 MB。
139
140
  - 已针对 dsh **`0.1.0-rc.7`**、**`0.1.0-rc.8`**、**`0.1.2`**(alpha 与 rc.1)、**`0.1.5-alpha.1`** 与 **`0.1.5-rc.2`** 验证。dsh 处于 developer preview,换更新的 dsh 之前先看这一行。dsh 0.1.2-alpha 引入的浏览器认证完全在电脑侧处理,手机 App 无需更新。
140
141
 
package/index.js CHANGED
@@ -17,6 +17,21 @@ import { dirname, join } from 'node:path'
17
17
  const name = 'dsh-plugin-tether'
18
18
  const inject = ['webServer', 'settings']
19
19
 
20
+ // 文案三处出处各不相同,各自跟随自己那一侧的语言:
21
+ // 终端输出 → 电脑的系统语言
22
+ // 路由的报错 → 请求方声明的语言(手机侧界面会带 x-dsh-tether-lang,其余按 Accept-Language)
23
+ // 注入 dsh 界面的那部分 → dsh 自己的语言设置,它写在 <html lang> 上
24
+ const terminalZh = /^zh/i.test(
25
+ process.env.LC_ALL || process.env.LANG || Intl.DateTimeFormat().resolvedOptions().locale || '',
26
+ )
27
+ /** 终端文案 */
28
+ const tt = (zh, en) => (terminalZh ? zh : en)
29
+ /** 路由文案 */
30
+ const tr = (req, zh, en) => {
31
+ const declared = req.headers['x-dsh-tether-lang'] || req.headers['accept-language'] || ''
32
+ return /(^|[\s,])zh/i.test(declared) ? zh : en
33
+ }
34
+
20
35
  /** 手机侧只读查看配置文件的路由 */
21
36
  const CONFIG_DOCUMENT_PATH = '/dsh-tether/config-document'
22
37
  /** 按需开一个配对窗口,拿回配对串 */
@@ -101,7 +116,7 @@ function applyUi(ctx) {
101
116
  const path = await ctx.settings.prepareDocument()
102
117
  if (path === undefined) {
103
118
  res.writeHead(404, { 'content-type': 'text/plain; charset=utf-8' })
104
- res.end('当前的设置存储不是本地文件,没有可查看的配置文件')
119
+ res.end(tr(req, '当前的设置存储不是本地文件,没有可查看的配置文件', 'The settings store is not a local file, so there is no config file to show'))
105
120
  return
106
121
  }
107
122
  let text
@@ -109,7 +124,7 @@ function applyUi(ctx) {
109
124
  text = await readFile(path, 'utf8')
110
125
  } catch (error) {
111
126
  res.writeHead(500, { 'content-type': 'text/plain; charset=utf-8' })
112
- res.end(`读不到配置文件 ${path}: ${String(error)}`)
127
+ res.end(`${tr(req, '读不到配置文件 ', 'cannot read the config file ')}${path}: ${String(error)}`)
113
128
  return
114
129
  }
115
130
  res.writeHead(200, {
@@ -136,16 +151,19 @@ function apply(ctx, config = {}) {
136
151
  const binary = config.hostBinary ?? resolveHostBinary()
137
152
  if (binary === undefined || !existsSync(binary)) {
138
153
  throw new Error(
139
- `[tether] 找不到 sidecar 二进制(平台 ${process.platform}-${process.arch})。`
140
- + '从源码用:先跑 cargo build --release -p tether-host;'
141
- + '或在插件 config.hostBinary 里指定路径。'
142
- + '若你是从 npm/GitHub 安装的,说明该平台的 dsh-tether-host-* 子包还没发布,请提 issue。',
154
+ `[tether] ${tt(
155
+ `找不到 sidecar 二进制(平台 ${process.platform}-${process.arch})。从源码用:先跑 cargo build --release -p tether-host;`
156
+ + '或在插件 config.hostBinary 里指定路径。若你是从 npm/GitHub 安装的,说明该平台的 dsh-tether-host-* 子包还没发布,请提 issue。',
157
+ `sidecar binary not found for ${process.platform}-${process.arch}. From source: run cargo build --release -p tether-host, `
158
+ + 'or point config.hostBinary at it. If you installed from npm/GitHub, the dsh-tether-host-* package for this platform is not published yet — please open an issue.',
159
+ )}`,
143
160
  )
144
161
  }
145
162
  // webServer.port 是真实监听端口(config 写 0 时为 OS 分配值),手机由此拿到完整界面
146
163
  const proxyTarget = `${ctx.webServer.host}:${ctx.webServer.port}`
147
164
 
148
- const args = ['host', '--proxy-target', proxyTarget]
165
+ // sidecar 的人读日志与这里打在同一个终端上,语言跟着走,免得一半中文一半英文
166
+ const args = ['host', '--proxy-target', proxyTarget, '--lang', terminalZh ? 'zh' : 'en']
149
167
  if (config.pair) args.push('--pair')
150
168
  const child = spawn(binary, args, { stdio: ['pipe', 'pipe', 'inherit'] })
151
169
  ctx.effect(() => () => { child.kill() })
@@ -153,16 +171,16 @@ function apply(ctx, config = {}) {
153
171
  let sidecarGone
154
172
  child.on('exit', (code) => {
155
173
  // sidecar 死了必须可见:手机端会静默失联,而电脑侧一切照常
156
- sidecarGone = `sidecar 已退出(code=${code})`
157
- console.error(`[tether] sidecar 退出 code=${code};手机端已失联`)
174
+ sidecarGone = tt(`sidecar 已退出(code=${code})`, `the sidecar exited (code=${code})`)
175
+ console.error(`[tether] ${tt(`sidecar 退出 code=${code};手机端已失联`, `the sidecar exited with code=${code}; the phone is now cut off`)}`)
158
176
  })
159
177
  // spawn 失败只走 error 不走 exit;不接住就是 uncaught。EACCES 曾实发过:
160
178
  // 打包丢了二进制执行位,现场只有一句干瘪的 Permission denied,毫无指向
161
179
  child.on('error', (error) => {
162
180
  const hint = error.code === 'EACCES'
163
- ? ';EACCES 通常是二进制缺可执行位,试 chmod 0755 该文件并升级插件'
181
+ ? tt(';EACCES 通常是二进制缺可执行位,试 chmod 0755 该文件并升级插件', '; EACCES usually means the binary lost its execute bit — try chmod 0755 on it and update the plugin')
164
182
  : ''
165
- sidecarGone = `sidecar 启动失败: ${error.message}${hint}`
183
+ sidecarGone = `${tt('sidecar 启动失败: ', 'the sidecar failed to start: ')}${error.message}${hint}`
166
184
  console.error(`[tether] ${sidecarGone}(${binary})`)
167
185
  })
168
186
 
@@ -178,43 +196,43 @@ function apply(ctx, config = {}) {
178
196
  try {
179
197
  msg = JSON.parse(line)
180
198
  } catch {
181
- console.error(`[tether] 无法解析 sidecar 消息: ${line}`)
199
+ console.error(`[tether] ${tt('无法解析 sidecar 消息: ', 'cannot parse the sidecar message: ')}${line}`)
182
200
  return
183
201
  }
184
202
  switch (msg.type) {
185
203
  case 'ready':
186
204
  endpointId = msg['endpoint_id']
187
- console.log(`[tether] 就绪,本机设备 ID: ${endpointId}`)
188
- console.log(`[tether] 手机将看到 http://${proxyTarget} 的完整界面`)
205
+ console.log(`[tether] ${tt('就绪,本机设备 ID: ', 'ready, device ID of this machine: ')}${endpointId}`)
206
+ console.log(`[tether] ${tt(`手机将看到 http://${proxyTarget} 的完整界面`, `the phone will see the full interface at http://${proxyTarget}`)}`)
189
207
  break
190
208
  case 'pairing': {
191
209
  // 一行可整体粘贴到手机,省去分别输 ID 和码
192
210
  const pairingString = `${endpointId}#${msg.code}`
193
- console.log(`[tether] 配对串(${Math.round(msg['expires_in_sec'] / 60)} 分钟内有效): ${pairingString}`)
211
+ console.log(`[tether] ${tt(`配对串(${Math.round(msg['expires_in_sec'] / 60)} 分钟内有效): `, `pairing string (valid for ${Math.round(msg['expires_in_sec'] / 60)} min): `)}${pairingString}`)
194
212
  const waiter = pendingPairing
195
213
  pendingPairing = undefined
196
214
  waiter?.({ pairingString, expiresInSec: msg['expires_in_sec'] })
197
215
  break
198
216
  }
199
217
  case 'pairing-closed':
200
- console.log(`[tether] 配对窗口已关闭: ${msg.reason}`)
218
+ console.log(`[tether] ${tt('配对窗口已关闭: ', 'the pairing window closed: ')}${msg.reason}`)
201
219
  break
202
220
  case 'pairing-done':
203
- console.log(`[tether] 配对成功: ${msg.name}(${msg.peer.slice(0, 16)}…)`)
221
+ console.log(`[tether] ${tt('配对成功: ', 'paired: ')}${msg.name}(${msg.peer.slice(0, 16)}…)`)
204
222
  break
205
223
  case 'peer-connected':
206
- console.log(`[tether] 手机已连接: ${msg.name}`)
224
+ console.log(`[tether] ${tt('手机已连接: ', 'phone connected: ')}${msg.name}`)
207
225
  break
208
226
  case 'peer-path':
209
- console.log(msg.kind === 'direct'
210
- ? `[tether] 连接路径: P2P 直连(NAT 打洞成功) ${msg.remote}`
211
- : `[tether] 连接路径: relay 中转(打洞未成,可用但延迟略高) ${msg.remote}`)
227
+ console.log(`[tether] ${msg.kind === 'direct'
228
+ ? tt('连接路径: P2P 直连(NAT 打洞成功) ', 'path: direct P2P (NAT hole punch succeeded) ')
229
+ : tt('连接路径: relay 中转(打洞未成,可用但延迟略高) ', 'path: via relay (hole punch failed; works, slightly higher latency) ')}${msg.remote}`)
212
230
  break
213
231
  case 'peer-disconnected':
214
- console.log('[tether] 手机已断开')
232
+ console.log(`[tether] ${tt('手机已断开', 'phone disconnected')}`)
215
233
  break
216
234
  case 'proxy-opened':
217
- console.log('[tether] 手机已开始加载界面')
235
+ console.log(`[tether] ${tt('手机已开始加载界面', 'the phone started loading the interface')}`)
218
236
  break
219
237
  case 'devices': {
220
238
  const waiters = pendingDevices
@@ -223,7 +241,7 @@ function apply(ctx, config = {}) {
223
241
  break
224
242
  }
225
243
  default:
226
- console.error(`[tether] 未知 sidecar 消息: ${line}`)
244
+ console.error(`[tether] ${tt('未知 sidecar 消息: ', 'unknown sidecar message: ')}${line}`)
227
245
  }
228
246
  })
229
247
 
@@ -244,7 +262,7 @@ function apply(ctx, config = {}) {
244
262
  const res = await fetch(url, { redirect: 'manual' })
245
263
  const setCookie = res.headers.getSetCookie()
246
264
  if (res.status !== 303 || setCookie.length !== 1) {
247
- throw new Error(`token 兑换应答异常: HTTP ${res.status}, set-cookie ×${setCookie.length}`)
265
+ throw new Error(`${tt('token 兑换应答异常: ', 'unexpected token-exchange reply: ')}HTTP ${res.status}, set-cookie ×${setCookie.length}`)
248
266
  }
249
267
  send({ type: 'proxy-auth', cookie: setCookie[0].split(';', 1)[0], authority })
250
268
  }
@@ -254,7 +272,7 @@ function apply(ctx, config = {}) {
254
272
  return await exchange()
255
273
  } catch (error) {
256
274
  if (attempt >= 3) {
257
- console.error('[tether] 浏览器认证 cookie 获取失败,手机端将收到 401:', error)
275
+ console.error(`[tether] ${tt('浏览器认证 cookie 获取失败,手机端将收到 401:', 'could not obtain the browser auth cookie; the phone will get 401:')}`, error)
258
276
  return
259
277
  }
260
278
  await new Promise((resolve) => setTimeout(resolve, 1000 * attempt))
@@ -291,7 +309,7 @@ function apply(ctx, config = {}) {
291
309
  })
292
310
  if (result === undefined) {
293
311
  res.writeHead(504, { 'content-type': 'text/plain; charset=utf-8' })
294
- res.end('sidecar 没有在 5 秒内给出配对码')
312
+ res.end(tr(req, 'sidecar 没有在 5 秒内给出配对码', 'the sidecar did not return a pairing code within 5 seconds'))
295
313
  return
296
314
  }
297
315
  res.writeHead(200, { 'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-store' })
@@ -315,7 +333,7 @@ function apply(ctx, config = {}) {
315
333
  const id = await readForgetId(req)
316
334
  if (id === undefined) {
317
335
  res.writeHead(400, { 'content-type': 'text/plain; charset=utf-8' })
318
- res.end('缺少要移除的设备 id')
336
+ res.end(tr(req, '缺少要移除的设备 id', 'the device id to remove is missing'))
319
337
  return
320
338
  }
321
339
  send({ type: 'device-forget', id })
@@ -333,7 +351,7 @@ function apply(ctx, config = {}) {
333
351
  })
334
352
  if (devices === undefined) {
335
353
  res.writeHead(504, { 'content-type': 'text/plain; charset=utf-8' })
336
- res.end('sidecar 没有在 5 秒内返回设备列表')
354
+ res.end(tr(req, 'sidecar 没有在 5 秒内返回设备列表', 'the sidecar did not return the device list within 5 seconds'))
337
355
  return
338
356
  }
339
357
  res.writeHead(200, { 'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-store' })
@@ -489,6 +507,10 @@ function injectNarrowScreenCss(html) {
489
507
  const script = `
490
508
  (function () {
491
509
  var narrow = window.matchMedia('(max-width: 640px)')
510
+ // 这一部分长在 dsh 界面里,语言就该跟 dsh 的设置走;它把当前语言写在 <html lang> 上
511
+ function zhUi() { return /^zh/i.test(document.documentElement.lang || '') }
512
+ function tx(zh, en) { return zhUi() ? zh : en }
513
+ function langHeaders() { return { 'x-dsh-tether-lang': zhUi() ? 'zh' : 'en' } }
492
514
  document.addEventListener('pointerdown', function (event) {
493
515
  if (!narrow.matches) return
494
516
  var frame = document.querySelector('[class*="_frame"]')
@@ -538,16 +560,16 @@ function injectNarrowScreenCss(html) {
538
560
  var slim = 'flex:none;font:inherit;font-size:12px;font-weight:400;padding:5px 12px;border-radius:14px;'
539
561
  + 'border:1px solid ' + t.line + ';background:transparent;color:inherit;cursor:pointer'
540
562
  var copy = document.createElement('button')
541
- copy.textContent = '复制'
563
+ copy.textContent = tx('复制', 'Copy')
542
564
  copy.style.cssText = slim
543
565
  copy.addEventListener('click', function () {
544
566
  navigator.clipboard.writeText(body).then(
545
- function () { copy.textContent = '已复制' },
546
- function () { copy.textContent = '复制失败' },
567
+ function () { copy.textContent = tx('已复制', 'Copied') },
568
+ function () { copy.textContent = tx('复制失败', 'Copy failed') },
547
569
  )
548
570
  })
549
571
  var close = document.createElement('button')
550
- close.textContent = '关闭'
572
+ close.textContent = tx('关闭', 'Close')
551
573
  close.style.cssText = slim
552
574
  close.addEventListener('click', function () { mask.remove() })
553
575
  bar.append(name)
@@ -580,7 +602,7 @@ function injectNarrowScreenCss(html) {
580
602
  box.style.cssText = 'flex:none;border-top:1px solid ' + t.line + ';padding:12px 16px 14px'
581
603
  var head = document.createElement('div')
582
604
  head.style.cssText = 'font-size:12px;color:' + t.muted + ';padding-bottom:8px'
583
- head.textContent = '已配对的手机'
605
+ head.textContent = tx('已配对的手机', 'Paired phones')
584
606
  var list = document.createElement('div')
585
607
  box.append(head, list)
586
608
 
@@ -589,7 +611,7 @@ function injectNarrowScreenCss(html) {
589
611
  if (!devices.length) {
590
612
  var none = document.createElement('div')
591
613
  none.style.cssText = 'font-size:12px;color:' + t.muted
592
- none.textContent = '还没有手机配对过'
614
+ none.textContent = tx('还没有手机配对过', 'No phone paired yet')
593
615
  list.append(none)
594
616
  return
595
617
  }
@@ -599,7 +621,7 @@ function injectNarrowScreenCss(html) {
599
621
  var dot = document.createElement('span')
600
622
  dot.style.cssText = 'flex:none;width:7px;height:7px;border-radius:50%;background:'
601
623
  + (d.online ? '#12b76a' : t.line)
602
- dot.title = d.online ? '在线' : '离线'
624
+ dot.title = d.online ? tx('在线', 'online') : tx('离线', 'offline')
603
625
  var label = document.createElement('div')
604
626
  label.style.cssText = 'flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap'
605
627
  label.textContent = d.name
@@ -610,34 +632,34 @@ function injectNarrowScreenCss(html) {
610
632
  label.append(idTag)
611
633
  // 不用原生 confirm:第一下改文案,第二下才真删
612
634
  var drop = document.createElement('button')
613
- drop.textContent = '移除'
635
+ drop.textContent = tx('移除', 'Remove')
614
636
  drop.style.cssText = slim
615
637
  var armed = false
616
638
  drop.addEventListener('click', function () {
617
639
  if (!armed) {
618
640
  armed = true
619
- drop.textContent = '确认移除?'
641
+ drop.textContent = tx('确认移除?', 'Remove it?')
620
642
  drop.style.color = t.danger
621
643
  setTimeout(function () {
622
644
  if (!armed) return
623
645
  armed = false
624
- drop.textContent = '移除'
646
+ drop.textContent = tx('移除', 'Remove')
625
647
  drop.style.color = 'inherit'
626
648
  }, 4000)
627
649
  return
628
650
  }
629
651
  drop.disabled = true
630
- drop.textContent = '移除中'
652
+ drop.textContent = tx('移除中', 'Removing')
631
653
  fetch('${DEVICES_PATH}', {
632
654
  method: 'POST',
633
- headers: { 'content-type': 'application/json' },
655
+ headers: Object.assign({ 'content-type': 'application/json' }, langHeaders()),
634
656
  body: JSON.stringify({ id: d.id }),
635
657
  })
636
658
  .then(function (r) { return r.ok ? r.json() : r.text().then(function (x) { throw new Error(x) }) })
637
659
  .then(function (x) { render(x.devices) })
638
660
  .catch(function (e) {
639
661
  drop.disabled = false
640
- drop.textContent = '移除失败'
662
+ drop.textContent = tx('移除失败', 'Removal failed')
641
663
  console.error('[dsh-tether] 移除设备失败', e)
642
664
  })
643
665
  })
@@ -648,27 +670,28 @@ function injectNarrowScreenCss(html) {
648
670
 
649
671
  var loading = document.createElement('div')
650
672
  loading.style.cssText = 'font-size:12px;color:' + t.muted
651
- loading.textContent = '读取中…'
673
+ loading.textContent = tx('读取中…', 'Loading…')
652
674
  list.append(loading)
653
- fetch('${DEVICES_PATH}')
675
+ fetch('${DEVICES_PATH}', { headers: langHeaders() })
654
676
  .then(function (r) { return r.ok ? r.json() : r.text().then(function (x) { throw new Error(x) }) })
655
677
  .then(function (x) { render(x.devices) })
656
- .catch(function (e) { loading.textContent = '读取失败: ' + (e && e.message ? e.message : e) })
678
+ .catch(function (e) { loading.textContent = tx('读取失败: ', 'Loading failed: ') + (e && e.message ? e.message : e) })
657
679
  return box
658
680
  }
659
681
 
660
682
  function showPairing() {
661
- fetch('${PAIRING_PATH}')
683
+ fetch('${PAIRING_PATH}', { headers: langHeaders() })
662
684
  .then(function (r) { return r.ok ? r.json() : r.text().then(function (t) { throw new Error(t) }) })
663
685
  .then(function (d) {
664
686
  viewer(
665
- '在手机上「添加电脑」里粘贴整行,' + Math.round(d.expiresInSec / 60) + ' 分钟内有效',
687
+ tx('在手机上「添加电脑」里粘贴整行,', 'Paste the whole line into “Add a computer” on the phone; valid for ')
688
+ + Math.round(d.expiresInSec / 60) + tx(' 分钟内有效', ' min'),
666
689
  d.pairingString,
667
690
  undefined,
668
691
  devicesBlock,
669
692
  )
670
693
  })
671
- .catch(function (e) { viewer('配对', '', String(e && e.message ? e.message : e)) })
694
+ .catch(function (e) { viewer(tx('配对', 'Pairing'), '', String(e && e.message ? e.message : e)) })
672
695
  }
673
696
 
674
697
  function mountHostsTrigger() {
@@ -686,7 +709,7 @@ function injectNarrowScreenCss(html) {
686
709
  var button = document.createElement('button')
687
710
  button.type = 'button'
688
711
  button.setAttribute('data-dsh-tether', 'hosts-trigger')
689
- var label = framed ? '我的电脑' : '连接手机'
712
+ var label = framed ? tx('我的电脑', 'My computers') : tx('连接手机', 'Connect a phone')
690
713
  button.setAttribute('aria-label', label)
691
714
  // 类名带内容哈希,照抄隔壁「设置」按钮当前的,外观自然一致
692
715
  button.className = reference.className
@@ -702,6 +725,13 @@ function injectNarrowScreenCss(html) {
702
725
  button.className = reference.className
703
726
  row.className = reference.parentElement.className
704
727
  }).observe(reference.parentElement, { attributes: true, attributeFilter: ['class'], subtree: true })
728
+ // dsh 的语言能在设置里当场切,这个标签跟着换
729
+ new MutationObserver(function () {
730
+ var next = framed ? tx('我的电脑', 'My computers') : tx('连接手机', 'Connect a phone')
731
+ button.setAttribute('aria-label', next)
732
+ var span = button.querySelector('[data-dsh-tether="hosts-label"]')
733
+ if (span) span.textContent = next
734
+ }).observe(document.documentElement, { attributes: true, attributeFilter: ['lang'] })
705
735
  }
706
736
  mountHostsTrigger()
707
737
  new MutationObserver(mountHostsTrigger).observe(document.documentElement, { childList: true, subtree: true })
@@ -713,10 +743,10 @@ function injectNarrowScreenCss(html) {
713
743
  if (!button || !/打开配置文件|Open config|open the config/i.test(button.textContent || '')) return
714
744
  event.preventDefault()
715
745
  event.stopPropagation()
716
- fetch('${CONFIG_DOCUMENT_PATH}')
746
+ fetch('${CONFIG_DOCUMENT_PATH}', { headers: langHeaders() })
717
747
  .then(function (r) { return r.ok ? r.json() : r.text().then(function (t) { throw new Error(t) }) })
718
748
  .then(function (d) { viewer(d.path, d.text) })
719
- .catch(function (e) { viewer('配置文件', '', String(e && e.message ? e.message : e)) })
749
+ .catch(function (e) { viewer(tx('配置文件', 'Config file'), '', String(e && e.message ? e.message : e)) })
720
750
  }, true)
721
751
  })()`
722
752
  return html.replace(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-tether",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "Mobile client for the DeepSeek Harness — use the dsh on your dev machine from your Android or iOS phone, remotely across networks, peer-to-peer over iroh with no server to set up (falls back to a relay that only sees ciphertext)",
5
5
  "keywords": [
6
6
  "dsh",
@@ -54,11 +54,11 @@
54
54
  "@deepseek-ai/dsh-user-approval": { "optional": true }
55
55
  },
56
56
  "optionalDependencies": {
57
- "dsh-tether-host-android-arm64": "0.1.15",
58
- "dsh-tether-host-darwin-arm64": "0.1.15",
59
- "dsh-tether-host-darwin-x64": "0.1.15",
60
- "dsh-tether-host-linux-arm64": "0.1.15",
61
- "dsh-tether-host-linux-x64": "0.1.15",
62
- "dsh-tether-host-win32-x64": "0.1.15"
57
+ "dsh-tether-host-android-arm64": "0.1.16",
58
+ "dsh-tether-host-darwin-arm64": "0.1.16",
59
+ "dsh-tether-host-darwin-x64": "0.1.16",
60
+ "dsh-tether-host-linux-arm64": "0.1.16",
61
+ "dsh-tether-host-linux-x64": "0.1.16",
62
+ "dsh-tether-host-win32-x64": "0.1.16"
63
63
  }
64
64
  }