tailcat-webui 0.0.0-stage → 0.2.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.
Files changed (58) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +29 -0
  3. package/README.en.md +112 -0
  4. package/README.md +101 -2
  5. package/bin/tailcat-webui.js +12 -0
  6. package/docs/CORE-API.md +343 -0
  7. package/docs/DESIGN.md +398 -0
  8. package/docs/assets/character.jpg +0 -0
  9. package/docs/assets/portrait.jpg +0 -0
  10. package/docs/screenshots/01-overview-light.png +0 -0
  11. package/docs/screenshots/02-overview-dark.png +0 -0
  12. package/docs/screenshots/03-ticket-light.png +0 -0
  13. package/docs/screenshots/04-ticket-qr-light.png +0 -0
  14. package/docs/screenshots/05-settings-light.png +0 -0
  15. package/docs/screenshots/06-diagnostics-light.png +0 -0
  16. package/docs/screenshots/07-mobile-overview.png +0 -0
  17. package/docs/screenshots/08-install-missing.png +0 -0
  18. package/docs/screenshots/09-keeper.png +0 -0
  19. package/package.json +56 -4
  20. package/src/cli.js +238 -0
  21. package/src/config.js +167 -0
  22. package/src/devices.js +163 -0
  23. package/src/errors.js +24 -0
  24. package/src/index.js +19 -0
  25. package/src/installer.js +907 -0
  26. package/src/manager.js +647 -0
  27. package/src/parse.js +207 -0
  28. package/src/paths.js +97 -0
  29. package/src/preferences.js +190 -0
  30. package/src/qr.js +37 -0
  31. package/src/relay.js +76 -0
  32. package/src/runtime/node.js +281 -0
  33. package/src/serve-targets.js +127 -0
  34. package/src/server.js +674 -0
  35. package/src/settings.js +262 -0
  36. package/src/supervisor.js +833 -0
  37. package/vendor/qrcode.mjs +2289 -0
  38. package/web/api.js +114 -0
  39. package/web/assets/portrait.jpg +0 -0
  40. package/web/boot.js +29 -0
  41. package/web/components.js +558 -0
  42. package/web/dict.js +663 -0
  43. package/web/drawer-access.js +318 -0
  44. package/web/drawer-address.js +271 -0
  45. package/web/drawer-automation.js +223 -0
  46. package/web/drawer-relay.js +128 -0
  47. package/web/drawer-tunnel.js +309 -0
  48. package/web/drawer.js +302 -0
  49. package/web/format.js +252 -0
  50. package/web/icon.png +0 -0
  51. package/web/index.html +29 -0
  52. package/web/main.js +471 -0
  53. package/web/room-diagnostics.js +426 -0
  54. package/web/room-overview.js +438 -0
  55. package/web/room-settings.js +71 -0
  56. package/web/store.js +168 -0
  57. package/web/styles.css +2873 -0
  58. package/web/ticket.js +212 -0
package/web/dict.js ADDED
@@ -0,0 +1,663 @@
1
+ /**
2
+ * Every string the interface shows, in Chinese (default) and English.
3
+ *
4
+ * The page owns no other copy: components take a translator and pass a key, so
5
+ * a new language is one more object in this file. Placeholders use `{name}`
6
+ * and are substituted literally; there are no format functions in here.
7
+ */
8
+
9
+ const zh = {
10
+ documentTitle: 'tailcat webui',
11
+ roomNavAria: '房间',
12
+ tabOverview: '总览',
13
+ tabSettings: '设置',
14
+ tabDiagnostics: '诊断',
15
+
16
+ themeToggle: '切换主题',
17
+ themeCurrent: '当前:{mode}',
18
+ themeSystem: '跟随系统',
19
+ themeLight: '浅色',
20
+ themeDark: '深色',
21
+
22
+ langToggle: '切换语言',
23
+
24
+ dismiss: '关闭',
25
+ retry: '重试',
26
+ refresh: '刷新',
27
+ unknown: '未知',
28
+ loading: '正在读取本地服务…',
29
+ loadErrorTitle: '无法读取本地服务',
30
+ loadErrorBody: '请确认 tailcat-webui 仍在运行,然后重试。',
31
+ pollErrorText: '无法读取状态:{message}',
32
+ networkError: '无法连接到本地服务。',
33
+ actionBusy: '另一个操作还在进行,请稍后再试。',
34
+ actionFailed: '操作没有完成:{message}',
35
+
36
+ phaseOnline: '在线',
37
+ phaseStarting: '启动中',
38
+ phaseRestarting: '正在重启',
39
+ phaseStopping: '停止中',
40
+ phaseStopped: '已停止',
41
+ phaseError: '异常',
42
+ phaseUnknown: '未知',
43
+
44
+ heroStart: '启动',
45
+ heroStop: '停止',
46
+ heroRestart: '重启',
47
+ heroRotate: '更换地址',
48
+ heroRotateConfirm: '确认更换',
49
+ cancel: '取消',
50
+ busyStart: '正在启动…',
51
+ busyStop: '正在停止…',
52
+ busyRestart: '正在重启…',
53
+ busyRotate: '正在更换…',
54
+ factVia: '经由 {region} 中继',
55
+ factUptime: '已运行 {duration}',
56
+ factJoin: ',',
57
+ factStarting: '正在建立隧道,通常需要几秒钟。',
58
+ factRestarting: '正在重启隧道。',
59
+ factStopping: '正在关闭隧道。',
60
+ rotateArmNote: '更换地址会覆盖保存密钥,隧道会重启,旧地址立即失效。',
61
+ rotateEphemeral: '临时密钥每次重启都会更换地址,不需要手动更换。',
62
+ noticeStarted: '隧道正在启动。',
63
+ noticeStopped: '隧道已停止。',
64
+ noticeRestarted: '隧道正在重启。',
65
+ noticeRotated: '地址已更换。',
66
+ programMissingTitle: '未检测到 tailcat',
67
+ programBannerBody: '安装 tailcat 后才能启动隧道。安装只会写入本地状态目录,不会修改系统 PATH。',
68
+ programMissingAction: '去安装',
69
+ pqPill: '后量子握手',
70
+
71
+ wireLocal: '本机',
72
+ wireClient: '客户端',
73
+
74
+ ticketTitle: '配对票根',
75
+ ticketShowAddress: '显示地址',
76
+ ticketHideAddress: '隐藏地址',
77
+ copy: '复制',
78
+ copied: '已复制',
79
+ copyFailed: '复制失败',
80
+ ticketCredentialHint: '地址就是凭据,只分享给你控制的设备。',
81
+ ticketEmpty: '隧道上线后,票根会出现在这里',
82
+ ticketEmptyNoTargets: '先在设置里添加端口映射',
83
+ ticketEmptyAction: '去设置',
84
+ clientRun: '客户端运行',
85
+ commandEmpty: '添加端口映射后,这里会给出转发命令。',
86
+ localAddress: '本机地址',
87
+ openLocal: '在客户端浏览器打开',
88
+ qrShow: '显示二维码',
89
+ qrHide: '隐藏二维码',
90
+ qrCaption: '扫码把地址带到客户端',
91
+ qrAlt: '包含 tailcat 地址的二维码',
92
+ qrFailed: '二维码生成失败,请直接复制地址。',
93
+ customMapNote: '客户端还需要同一个 DERP map',
94
+ sealWordmark: 'TAILCAT',
95
+
96
+ pqTitle: '您目前还没有开启后量子时代加密',
97
+ pqBody:
98
+ 'tailcat 的混合后量子握手(ML-KEM-768)没有开启。开启后,即使地址被公开,已录下的流量也受后量子加密保护;旧客户端将无法连接。',
99
+ pqAction: '打开访问与凭据',
100
+ pqEnabled: '后量子握手已开启(ML-KEM-768)',
101
+
102
+ stepsTitle: '接入这台机器',
103
+ step1Title: '安装 tailcat 客户端',
104
+ step1Body: '在客户端设备上安装 tailcat,然后生成一把客户端密钥。',
105
+ step1Link: '官方安装说明',
106
+ step2Title: '在客户端建立转发',
107
+ step2Body: '在客户端运行下面的命令,把隧道端口带到本机端口。',
108
+ step3Title: '打开客户端本机地址',
109
+ step3Body: '在客户端设备上打开这个地址。',
110
+
111
+ keeperTitle: '猫猫看家',
112
+ keeperBody: '隧道、密钥和这张票根交给 tailcat 看管;这只猫只负责把地址安全地交到你手上。',
113
+ keeperCredit: '形象图 · gpt-image-2.6',
114
+
115
+ settingsTitle: '设置',
116
+ settingsSubtitle: '带琥珀点的字段已由这里覆盖,其余跟随默认配置。',
117
+ save: '保存',
118
+ undo: '撤销',
119
+ saving: '保存中…',
120
+ unsaved: '有未保存的修改',
121
+ saveRestart: '保存后会重启隧道',
122
+ saveAddress: '保存后会更换地址',
123
+ saved: '设置已保存。',
124
+ saveFailed: '没有保存:{message}',
125
+ overrideDot: '由这里覆盖,其余字段跟随默认配置',
126
+ summaryJoin: ',',
127
+ listJoin: '、',
128
+
129
+ drawerTunnel: '隧道与端口映射',
130
+ summaryTunnelKey: '保存密钥 {key}',
131
+ summaryTunnelEphemeral: '临时密钥',
132
+ mappingCount: '{n} 条端口映射',
133
+ mappingCountZero: '没有端口映射',
134
+ tunnelMode: '密钥模式',
135
+ tunnelModeHint: '保存密钥会复用地址,只有主动更换地址时才变化。',
136
+ tunnelModeStable: '保存密钥(地址稳定)',
137
+ tunnelModeEphemeral: '临时密钥(每次重启换地址)',
138
+ tunnelKeyName: '保存密钥名称',
139
+ tunnelKeyNameHint: '改成不存在的名称会生成新密钥。',
140
+ keyNameRequired: '保存密钥名称不能为空。',
141
+ tunnelMappings: '端口映射',
142
+ tunnelMappingsHint: '把本机端口或 Unix socket 通过同一个 tailcat 地址暴露。至少一条映射,隧道才能启动。',
143
+ tunnelMappingsWarning: '端口映射会把本机服务开放给拿到地址或白名单的设备;只添加确实需要暴露的端口。',
144
+ tunnelMappingAdd: '添加一条',
145
+ tunnelMappingRemove: '删除这条端口映射',
146
+ tunnelMappingVirtual: '虚拟端口',
147
+ tunnelMappingTarget: '目标',
148
+ tunnelMappingTargetPlaceholder: 'localhost:8080 或 unix:/run/app.sock',
149
+ tunnelMappingEmpty: '还没有端口映射。',
150
+ mappingIncomplete: '每条端口映射都需要虚拟端口和目标。',
151
+ mappingDuplicate: '虚拟端口不能重复。',
152
+ mappingInvalidPort: '虚拟端口必须是 1 到 65535 的整数。',
153
+
154
+ drawerRelay: '中继',
155
+ relayLabel: '自定义 DERP map URL',
156
+ relayPlaceholder: 'https://…/derpmap.json',
157
+ relayHint: '留空使用官方中继。保存会重启隧道(如果在运行),但不会更换地址。',
158
+ relaySourceConfig: '当前值来自配置文件;在这里留空会继续使用配置值。',
159
+ relayInsecure: '这个 URL 使用 HTTP,map 内容可能被篡改;请只在可信网络中使用。',
160
+ relayClientLabel: '客户端还需要同一个 DERP map',
161
+ relayClientHint: '在客户端设备上设置这个环境变量,或使用 --derpmap-url。',
162
+ relaySaved: '中继 map 已保存。',
163
+ relayBusy: '正在应用…',
164
+ summaryRelayDefault: '官方中继',
165
+ summaryRelayCustom: '自定义 DERP map',
166
+ summaryRelayConfig: '配置中的 DERP map',
167
+
168
+ drawerAddress: '地址与区域',
169
+ addressFormat: '地址格式',
170
+ addressFormatShort: '短地址(推荐)',
171
+ addressFormatFull: '完整地址(内嵌中继)',
172
+ addressFormatHint: '完整地址更长,客户端不需要 DERP map。',
173
+ regionMode: '区域选择',
174
+ regionModeAuto: '自动选择最近区域',
175
+ regionModeExplicit: '指定 ID、代码或名称',
176
+ regionModeHosts: '指定 DERP 主机',
177
+ regionValueLabel: '区域或主机',
178
+ regionValueHint: '区域只在生成或更换地址时使用;保存不会立即重启。',
179
+ regionPlaceholder: '例如 304、tok、Tokyo',
180
+ regionHostsPlaceholder: 'derp-a.example.com,derp-b.example.com',
181
+ regionValueEmpty: '选择非自动的区域模式后,需要填写区域或主机。',
182
+ addressRotate: '更换地址',
183
+ addressRotateConfirm: '确认更换',
184
+ addressRotateBusy: '正在更换…',
185
+ addressRotated: '地址已更换。',
186
+ addressShort: '短地址',
187
+ addressFull: '完整地址',
188
+ regionAuto: '自动选择区域',
189
+ regionExplicit: '指定区域',
190
+ regionHosts: '指定 DERP 主机',
191
+
192
+ drawerAccess: '访问与凭据',
193
+ accessDevices: '设备白名单',
194
+ accessDevicesHint: '每行一个客户端公钥。留空表示地址就是唯一凭据。',
195
+ accessDevicesPlaceholder: 'nodekey:…',
196
+ accessDevicesSave: '保存白名单',
197
+ accessDevicesSaved: '白名单已保存。',
198
+ accessDevicesSaveFailed: '白名单没有保存:{message}',
199
+ accessDevicesReset: '撤销',
200
+ accessDevicesEnforced: '已限制 {count} 台设备',
201
+ accessDevicesOpenBody: '任何拿到地址的人都能访问映射的端口。添加至少一个客户端公钥后,访问才会限制在已配对设备。',
202
+ accessDevicesKeyHint: '在客户端设备生成密钥:',
203
+ accessCredentials: '凭据与日志',
204
+ accessPsk: '预共享密钥',
205
+ accessPskHint: '关闭会缩短地址,但降低安全性;只用于兼容旧客户端。',
206
+ accessHybrid: '混合后量子握手',
207
+ accessHybridHint: '需要预共享密钥和支持的客户端;开启会更换地址。',
208
+ accessHybridNote:
209
+ '开启后,即使地址被公开,已录下的流量也受后量子加密保护;旧客户端将无法连接。开启会更换地址。',
210
+ accessPskOffHybrid: '关闭预共享密钥会同时关闭后量子握手。',
211
+ accessLog: '记录访问',
212
+ accessLogHint: '在诊断页显示最近连接与拒绝记录。',
213
+ accessVerbose: '详细日志',
214
+ accessVerboseHint: '只用于排查问题,会增加日志量。',
215
+ summaryAccessDevices: '{n} 台设备',
216
+ summaryAccessDevicesNone: '无白名单',
217
+ summaryPskOn: 'PSK 开启',
218
+ summaryPskOff: 'PSK 关闭',
219
+ summaryHybridOn: '后量子握手',
220
+ summaryHybridOff: '经典加密',
221
+
222
+ drawerAutomation: '自动化',
223
+ automationAutoStart: '程序启动后自动开隧道',
224
+ automationAutoStartHint: '在下次启动时生效。',
225
+ automationRestart: '异常退出后自动重启',
226
+ automationAttempts: '最大连续重启次数',
227
+ automationBaseDelay: '首次重试延迟(毫秒)',
228
+ automationMaxDelay: '最大重试延迟(毫秒)',
229
+ automationNote: '重启策略立即生效;自动启动在下次启动时生效。',
230
+ summaryAutoOn: '启动时自动开隧道',
231
+ summaryAutoOff: '不自动启动',
232
+ summaryRestartOn: '崩溃后重启',
233
+ summaryRestartOff: '崩溃后不重启',
234
+ automationDelayOrder: '首次重试延迟不能大于最大重试延迟。',
235
+ automationAttemptsRange: '最大连续重启次数必须是 0 到 100 的整数。',
236
+ automationBaseRange: '首次重试延迟必须是 100 到 60000 的整数。',
237
+ automationMaxRange: '最大重试延迟必须是 1000 到 600000 的整数。',
238
+
239
+ diagTitle: '诊断',
240
+ diagSubtitle: '只读的运行状态、最近连接与故障信息。',
241
+ factsTitle: '运行事实',
242
+ factPhase: '状态',
243
+ factAddress: '地址',
244
+ factTargets: '端口映射',
245
+ factVersion: 'tailcat 版本',
246
+ factBinary: '可执行文件',
247
+ factRegion: '中继区域',
248
+ factRestarts: '自动重启',
249
+ factRefusals: '拒绝次数',
250
+ factStateFile: '状态文件',
251
+ factKeyMode: '密钥模式',
252
+ factAddressFormat: '地址格式',
253
+ factModeStable: '保存密钥',
254
+ factModeEphemeral: '临时密钥',
255
+ factFullAddress: '完整地址',
256
+ factShortAddress: '短地址',
257
+ factTargetsEmpty: '还没有端口映射',
258
+ programTitle: 'tailcat 程序',
259
+ programChecking: '正在检查系统是否已安装 tailcat…',
260
+ programFound: '已检测到系统 tailcat',
261
+ programFoundBody: '版本 {version},路径 {path}。会直接使用它。',
262
+ programMissing: '没有找到 tailcat',
263
+ programMissingBody: '可以安装受管版本,或手动安装后重新检测。',
264
+ programOutdated: '检测到的 tailcat {version} 低于 0.8.0',
265
+ programOutdatedBody: '可以安装受管版本,或先升级系统 tailcat。',
266
+ programInstalled: '受管版本',
267
+ programInstalledBody: '受管版本位于 {path},不会修改系统 PATH。',
268
+ programInstall: '安装 tailcat',
269
+ programReinstall: '重新安装受管版本',
270
+ programUpgrade: '升级受管版本',
271
+ programInstalling: '安装中…',
272
+ programRedetect: '重新检测',
273
+ programManual: '手动安装说明',
274
+ programBrew: '安装方式:Homebrew({command})',
275
+ programBrewNote: '会通过 Homebrew 升级系统 tailcat,并复制一份到受管目录。',
276
+ programDownload: '安装方式:下载官方 {asset},校验 SHA-256 后解压。',
277
+ programUnsupported: '当前平台 {platform}/{arch} 暂无自动安装。',
278
+ programConfigOverride: 'binaryPath 当前为 {path};受管安装不会覆盖它。',
279
+ programError: '安装失败',
280
+ programPhaseDownload: '正在下载 tailcat…',
281
+ programPhaseChecksums: '正在获取官方校验值…',
282
+ programPhaseVerify: '正在校验下载文件…',
283
+ programPhaseExtract: '正在解压…',
284
+ programPhaseInstall: '正在安装…',
285
+ programPhaseHomebrew: '正在通过 Homebrew 安装,可能需要几分钟…',
286
+ programProgress: '{percent}%({received} / {total})',
287
+ programProgressUnknown: '已下载 {received}',
288
+ programInstalledNotice: 'tailcat 已安装。',
289
+ connectionsTitle: '最近连接',
290
+ connectionsEmpty: '还没有连接记录',
291
+ connTime: '时间',
292
+ connPeer: '对端',
293
+ connPort: '端口',
294
+ connVia: '路径',
295
+ connDuration: '时长',
296
+ refusalsTitle: '拒绝记录',
297
+ refusalsEmpty: '还没有拒绝记录',
298
+ refusalTime: '时间',
299
+ refusalPeer: '对端',
300
+ refusalReason: '原因',
301
+ refusalPort: '端口',
302
+ refusalNotInAllow: '不在白名单',
303
+ refusalPortNotServed: '端口没有映射',
304
+ refusalUnknown: '其他原因',
305
+ refusalUnknownPeer: '未知设备',
306
+ logTitle: '最近日志',
307
+ logHint: '日志中的地址与密钥会被脱敏。',
308
+ logEmpty: '暂无日志',
309
+ warningsTitle: '警告',
310
+ lastErrorTitle: '最近错误',
311
+ noticeRefreshed: '状态已刷新。',
312
+
313
+ durationSeconds: '{n} 秒',
314
+ durationMinutes: '{n} 分钟',
315
+ durationHours: '{h} 小时',
316
+ durationHoursMinutes: '{h} 小时 {m} 分钟',
317
+ durationDays: '{d} 天',
318
+ };
319
+
320
+ const en = {
321
+ documentTitle: 'tailcat webui',
322
+ roomNavAria: 'Rooms',
323
+ tabOverview: 'Overview',
324
+ tabSettings: 'Settings',
325
+ tabDiagnostics: 'Diagnostics',
326
+
327
+ themeToggle: 'Switch theme',
328
+ themeCurrent: 'Current: {mode}',
329
+ themeSystem: 'System',
330
+ themeLight: 'Light',
331
+ themeDark: 'Dark',
332
+
333
+ langToggle: 'Switch language',
334
+
335
+ dismiss: 'Close',
336
+ retry: 'Retry',
337
+ refresh: 'Refresh',
338
+ unknown: 'Unknown',
339
+ loading: 'Reading the local service…',
340
+ loadErrorTitle: 'The local service is unavailable',
341
+ loadErrorBody: 'Make sure tailcat-webui is still running, then retry.',
342
+ pollErrorText: 'Could not read the state: {message}',
343
+ networkError: 'Could not reach the local service.',
344
+ actionBusy: 'Another action is still running; try again when it finishes.',
345
+ actionFailed: 'The action did not finish: {message}',
346
+
347
+ phaseOnline: 'Online',
348
+ phaseStarting: 'Starting',
349
+ phaseRestarting: 'Restarting',
350
+ phaseStopping: 'Stopping',
351
+ phaseStopped: 'Stopped',
352
+ phaseError: 'Error',
353
+ phaseUnknown: 'Unknown',
354
+
355
+ heroStart: 'Start',
356
+ heroStop: 'Stop',
357
+ heroRestart: 'Restart',
358
+ heroRotate: 'Rotate address',
359
+ heroRotateConfirm: 'Confirm rotation',
360
+ cancel: 'Cancel',
361
+ busyStart: 'Starting…',
362
+ busyStop: 'Stopping…',
363
+ busyRestart: 'Restarting…',
364
+ busyRotate: 'Rotating…',
365
+ factVia: 'via the {region} relay',
366
+ factUptime: 'running for {duration}',
367
+ factJoin: ', ',
368
+ factStarting: 'Opening the tunnel; this usually takes a few seconds.',
369
+ factRestarting: 'Restarting the tunnel.',
370
+ factStopping: 'Closing the tunnel.',
371
+ rotateArmNote: 'Rotating replaces the saved key, restarts the tunnel, and makes the old address stop working immediately.',
372
+ rotateEphemeral: 'An ephemeral key changes the address on every restart, so there is nothing to rotate.',
373
+ noticeStarted: 'The tunnel is starting.',
374
+ noticeStopped: 'The tunnel stopped.',
375
+ noticeRestarted: 'The tunnel is restarting.',
376
+ noticeRotated: 'The address was rotated.',
377
+ programMissingTitle: 'tailcat was not found',
378
+ programBannerBody: 'The tunnel needs tailcat. Installing writes only to the local state directory and leaves the system PATH alone.',
379
+ programMissingAction: 'Install it',
380
+ pqPill: 'Post-quantum',
381
+
382
+ wireLocal: 'This machine',
383
+ wireClient: 'Client',
384
+
385
+ ticketTitle: 'Pairing ticket',
386
+ ticketShowAddress: 'Show address',
387
+ ticketHideAddress: 'Hide address',
388
+ copy: 'Copy',
389
+ copied: 'Copied',
390
+ copyFailed: 'Copy failed',
391
+ ticketCredentialHint: 'The address is the credential; share it only with devices you control.',
392
+ ticketEmpty: 'The ticket appears here once the tunnel is online',
393
+ ticketEmptyNoTargets: 'Add a port mapping in settings first',
394
+ ticketEmptyAction: 'Open settings',
395
+ clientRun: 'Run on the client',
396
+ commandEmpty: 'The forward command appears here once a port mapping exists.',
397
+ localAddress: 'Local address',
398
+ openLocal: 'Open in the client browser',
399
+ qrShow: 'Show QR code',
400
+ qrHide: 'Hide QR code',
401
+ qrCaption: 'Scan to carry the address to the client',
402
+ qrAlt: 'QR code that contains the tailcat address',
403
+ qrFailed: 'The QR code could not be built; copy the address instead.',
404
+ customMapNote: 'The client needs the same DERP map',
405
+ sealWordmark: 'TAILCAT',
406
+
407
+ pqTitle: 'Post-quantum encryption is not enabled',
408
+ pqBody:
409
+ 'tailcat’s hybrid post-quantum handshake (ML-KEM-768) is off. When it is on, traffic that was recorded before an address is published is still protected; older clients will not be able to connect.',
410
+ pqAction: 'Open access and credentials',
411
+ pqEnabled: 'Post-quantum handshake is on (ML-KEM-768)',
412
+
413
+ stepsTitle: 'Connect this machine',
414
+ step1Title: 'Install the tailcat client',
415
+ step1Body: 'Install tailcat on the client device and generate a client key.',
416
+ step1Link: 'Installation guide',
417
+ step2Title: 'Forward from the client',
418
+ step2Body: 'Run this command on the client to carry the tunnel port to a local port.',
419
+ step3Title: 'Open the client address',
420
+ step3Body: 'Open this address in the client device’s browser.',
421
+
422
+ keeperTitle: 'Cat on watch',
423
+ keeperBody: 'tailcat keeps the tunnel, the keys and this ticket; this cat only makes sure the address reaches you safely.',
424
+ keeperCredit: 'Artwork · gpt-image-2.6',
425
+
426
+ settingsTitle: 'Settings',
427
+ settingsSubtitle: 'Fields with an amber dot are overridden here; the rest follow the built-in defaults.',
428
+ save: 'Save',
429
+ undo: 'Undo',
430
+ saving: 'Saving…',
431
+ unsaved: 'Unsaved changes',
432
+ saveRestart: 'Saving restarts the tunnel',
433
+ saveAddress: 'Saving rotates the address',
434
+ saved: 'Settings saved.',
435
+ saveFailed: 'Not saved: {message}',
436
+ overrideDot: 'Overridden here; the other fields keep following the defaults',
437
+ summaryJoin: ', ',
438
+ listJoin: ', ',
439
+
440
+ drawerTunnel: 'Tunnel and port mappings',
441
+ summaryTunnelKey: 'Saved key {key}',
442
+ summaryTunnelEphemeral: 'Ephemeral key',
443
+ mappingCount: '{n} port mappings',
444
+ mappingCountZero: 'no port mappings',
445
+ tunnelMode: 'Key mode',
446
+ tunnelModeHint: 'A saved key keeps the address stable; it changes only when you rotate it.',
447
+ tunnelModeStable: 'Saved key (stable address)',
448
+ tunnelModeEphemeral: 'Ephemeral key (new address on every restart)',
449
+ tunnelKeyName: 'Saved key name',
450
+ tunnelKeyNameHint: 'Changing it to a name that does not exist creates a new key.',
451
+ keyNameRequired: 'The saved key name cannot be empty.',
452
+ tunnelMappings: 'Port mappings',
453
+ tunnelMappingsHint: 'Expose local ports or Unix sockets through the same tailcat address. The tunnel needs at least one mapping to start.',
454
+ tunnelMappingsWarning: 'Port mappings expose local services to anyone who has the address or is on the allow-list. Add only what you really need.',
455
+ tunnelMappingAdd: 'Add one',
456
+ tunnelMappingRemove: 'Remove this port mapping',
457
+ tunnelMappingVirtual: 'Virtual port',
458
+ tunnelMappingTarget: 'Target',
459
+ tunnelMappingTargetPlaceholder: 'localhost:8080 or unix:/run/app.sock',
460
+ tunnelMappingEmpty: 'No port mappings yet.',
461
+ mappingIncomplete: 'Every port mapping needs both a virtual port and a target.',
462
+ mappingDuplicate: 'Virtual ports must be unique.',
463
+ mappingInvalidPort: 'The virtual port must be a whole number from 1 to 65535.',
464
+
465
+ drawerRelay: 'Relay',
466
+ relayLabel: 'Custom DERP map URL',
467
+ relayPlaceholder: 'https://…/derpmap.json',
468
+ relayHint: 'Leave it empty to use the official relays. Saving restarts a running tunnel but does not rotate the address.',
469
+ relaySourceConfig: 'The value comes from the config file; leaving it empty here keeps using that value.',
470
+ relayInsecure: 'This URL uses HTTP, so the map can be tampered with; use it only on a trusted network.',
471
+ relayClientLabel: 'The client needs the same DERP map',
472
+ relayClientHint: 'Set this environment variable on the client, or pass --derpmap-url.',
473
+ relaySaved: 'Relay map saved.',
474
+ relayBusy: 'Applying…',
475
+ summaryRelayDefault: 'Official relays',
476
+ summaryRelayCustom: 'Custom DERP map',
477
+ summaryRelayConfig: 'DERP map from config',
478
+
479
+ drawerAddress: 'Address and region',
480
+ addressFormat: 'Address format',
481
+ addressFormatShort: 'Short address (recommended)',
482
+ addressFormatFull: 'Full address (embeds the relay)',
483
+ addressFormatHint: 'A full address is longer and needs no DERP map on the client.',
484
+ regionMode: 'Region',
485
+ regionModeAuto: 'Pick the nearest region',
486
+ regionModeExplicit: 'Pin an ID, code, or name',
487
+ regionModeHosts: 'Pin DERP hosts',
488
+ regionValueLabel: 'Region or hosts',
489
+ regionValueHint: 'The region is used only when a saved key is generated or rotated; saving does not restart the tunnel.',
490
+ regionPlaceholder: 'for example 304, tok, or Tokyo',
491
+ regionHostsPlaceholder: 'derp-a.example.com,derp-b.example.com',
492
+ regionValueEmpty: 'Pick a region or relay hosts for the selected mode.',
493
+ addressRotate: 'Rotate address',
494
+ addressRotateConfirm: 'Confirm rotation',
495
+ addressRotateBusy: 'Rotating…',
496
+ addressRotated: 'The address was rotated.',
497
+ addressShort: 'Short address',
498
+ addressFull: 'Full address',
499
+ regionAuto: 'Nearest region',
500
+ regionExplicit: 'Pinned region',
501
+ regionHosts: 'Pinned hosts',
502
+
503
+ drawerAccess: 'Access and credentials',
504
+ accessDevices: 'Device allow-list',
505
+ accessDevicesHint: 'One client public key per line. Empty means the address is the only credential.',
506
+ accessDevicesPlaceholder: 'nodekey:…',
507
+ accessDevicesSave: 'Save allow-list',
508
+ accessDevicesSaved: 'The allow-list was saved.',
509
+ accessDevicesSaveFailed: 'The allow-list was not saved: {message}',
510
+ accessDevicesReset: 'Undo',
511
+ accessDevicesEnforced: '{count} device(s) allowed',
512
+ accessDevicesOpenBody: 'Anyone with the address can reach the mapped ports. Add at least one client public key to limit access to paired devices.',
513
+ accessDevicesKeyHint: 'Generate a key on the client device:',
514
+ accessCredentials: 'Credentials and logging',
515
+ accessPsk: 'Pre-shared key',
516
+ accessPskHint: 'Turning it off shortens the address but weakens security; use it only for older clients.',
517
+ accessHybrid: 'Hybrid post-quantum handshake',
518
+ accessHybridHint: 'Needs the pre-shared key and a supported client; turning it on rotates the address.',
519
+ accessHybridNote:
520
+ 'When it is on, traffic recorded before an address is published stays protected and older clients cannot connect. Turning it on rotates the address.',
521
+ accessPskOffHybrid: 'Turning off the pre-shared key also turns off the post-quantum handshake.',
522
+ accessLog: 'Log access',
523
+ accessLogHint: 'Shows recent connections and refusals in diagnostics.',
524
+ accessVerbose: 'Verbose log',
525
+ accessVerboseHint: 'For troubleshooting only; it increases the log volume.',
526
+ summaryAccessDevices: '{n} device(s)',
527
+ summaryAccessDevicesNone: 'No allow-list',
528
+ summaryPskOn: 'PSK on',
529
+ summaryPskOff: 'PSK off',
530
+ summaryHybridOn: 'post-quantum',
531
+ summaryHybridOff: 'classic encryption',
532
+
533
+ drawerAutomation: 'Automation',
534
+ automationAutoStart: 'Start the tunnel when the app starts',
535
+ automationAutoStartHint: 'Takes effect on the next start.',
536
+ automationRestart: 'Restart after an unexpected exit',
537
+ automationAttempts: 'Maximum consecutive restarts',
538
+ automationBaseDelay: 'First retry delay (ms)',
539
+ automationMaxDelay: 'Maximum retry delay (ms)',
540
+ automationNote: 'Restart policy applies immediately; auto-start applies on the next start.',
541
+ summaryAutoOn: 'starts the tunnel on launch',
542
+ summaryAutoOff: 'does not start on launch',
543
+ summaryRestartOn: 'restarts after a crash',
544
+ summaryRestartOff: 'does not restart after a crash',
545
+ automationDelayOrder: 'The first retry delay cannot be larger than the maximum delay.',
546
+ automationAttemptsRange: 'The maximum consecutive restarts must be a whole number from 0 to 100.',
547
+ automationBaseRange: 'The first retry delay must be a whole number from 100 to 60000.',
548
+ automationMaxRange: 'The maximum retry delay must be a whole number from 1000 to 600000.',
549
+
550
+ diagTitle: 'Diagnostics',
551
+ diagSubtitle: 'Read-only runtime facts, recent connections, and failure details.',
552
+ factsTitle: 'Runtime facts',
553
+ factPhase: 'State',
554
+ factAddress: 'Address',
555
+ factTargets: 'Port mappings',
556
+ factVersion: 'tailcat version',
557
+ factBinary: 'Executable',
558
+ factRegion: 'Relay region',
559
+ factRestarts: 'Auto-restarts',
560
+ factRefusals: 'Refusals',
561
+ factStateFile: 'State file',
562
+ factKeyMode: 'Key mode',
563
+ factAddressFormat: 'Address format',
564
+ factModeStable: 'Saved key',
565
+ factModeEphemeral: 'Ephemeral key',
566
+ factFullAddress: 'Full address',
567
+ factShortAddress: 'Short address',
568
+ factTargetsEmpty: 'no port mappings',
569
+ programTitle: 'tailcat program',
570
+ programChecking: 'Checking whether tailcat is installed…',
571
+ programFound: 'A system tailcat was found',
572
+ programFoundBody: 'Version {version}, path {path}. It will be used as is.',
573
+ programMissing: 'tailcat was not found',
574
+ programMissingBody: 'Install the managed copy, or install it manually and check again.',
575
+ programOutdated: 'The detected tailcat {version} is older than 0.8.0',
576
+ programOutdatedBody: 'Install the managed copy, or upgrade the system tailcat first.',
577
+ programInstalled: 'Managed copy',
578
+ programInstalledBody: 'The managed copy lives at {path} and does not change the system PATH.',
579
+ programInstall: 'Install tailcat',
580
+ programReinstall: 'Reinstall the managed copy',
581
+ programUpgrade: 'Upgrade the managed copy',
582
+ programInstalling: 'Installing…',
583
+ programRedetect: 'Check again',
584
+ programManual: 'Manual install notes',
585
+ programBrew: 'Install method: Homebrew ({command})',
586
+ programBrewNote: 'This upgrades the system tailcat through Homebrew and copies it into the managed directory.',
587
+ programDownload: 'Install method: download the official {asset}, verify its SHA-256, then extract it.',
588
+ programUnsupported: 'No automated install for {platform}/{arch}.',
589
+ programConfigOverride: 'binaryPath is set to {path}; a managed install will not overwrite it.',
590
+ programError: 'Install failed',
591
+ programPhaseDownload: 'Downloading tailcat…',
592
+ programPhaseChecksums: 'Fetching the official checksums…',
593
+ programPhaseVerify: 'Verifying the download…',
594
+ programPhaseExtract: 'Extracting…',
595
+ programPhaseInstall: 'Installing…',
596
+ programPhaseHomebrew: 'Installing through Homebrew; this can take a few minutes…',
597
+ programProgress: '{percent}% ({received} / {total})',
598
+ programProgressUnknown: 'Downloaded {received}',
599
+ programInstalledNotice: 'tailcat was installed.',
600
+ connectionsTitle: 'Recent connections',
601
+ connectionsEmpty: 'No connections recorded yet',
602
+ connTime: 'Time',
603
+ connPeer: 'Peer',
604
+ connPort: 'Port',
605
+ connVia: 'Path',
606
+ connDuration: 'Duration',
607
+ refusalsTitle: 'Refusals',
608
+ refusalsEmpty: 'No refusals recorded yet',
609
+ refusalTime: 'Time',
610
+ refusalPeer: 'Peer',
611
+ refusalReason: 'Reason',
612
+ refusalPort: 'Port',
613
+ refusalNotInAllow: 'not on the allow-list',
614
+ refusalPortNotServed: 'port is not mapped',
615
+ refusalUnknown: 'other reason',
616
+ refusalUnknownPeer: 'Unknown device',
617
+ logTitle: 'Recent log',
618
+ logHint: 'Addresses and keys are redacted in this log.',
619
+ logEmpty: 'No log lines yet',
620
+ warningsTitle: 'Warnings',
621
+ lastErrorTitle: 'Last error',
622
+ noticeRefreshed: 'State refreshed.',
623
+
624
+ durationSeconds: '{n} sec',
625
+ durationMinutes: '{n} min',
626
+ durationHours: '{h} h',
627
+ durationHoursMinutes: '{h} h {m} min',
628
+ durationDays: '{d} d',
629
+ };
630
+
631
+ const DICTS = { zh, en };
632
+
633
+ /**
634
+ * Follow the browser language; Chinese browsers get Chinese, everyone else
635
+ * gets English. Stored choice wins when the page passes one.
636
+ * @param {{ language?: string, languages?: string[] }} [nav] - navigator-like object.
637
+ * @param {string | null} [stored] - stored language code.
638
+ * @returns {'zh' | 'en'} language code.
639
+ */
640
+ export function resolveLang(nav = globalThis.navigator, stored = null) {
641
+ if (stored === 'zh' || stored === 'en') return stored;
642
+ const list = Array.isArray(nav?.languages) && nav.languages.length > 0 ? nav.languages : [nav?.language ?? ''];
643
+ for (const code of list) {
644
+ if (typeof code === 'string' && code.toLowerCase().startsWith('zh')) return 'zh';
645
+ }
646
+ return 'en';
647
+ }
648
+
649
+ /**
650
+ * Translate one key; unknown keys fall back to Chinese, then to the key itself.
651
+ * @param {'zh' | 'en'} lang - language code.
652
+ * @param {string} key - dictionary key.
653
+ * @param {Record<string, unknown>} [params] - `{name}` replacements.
654
+ * @returns {string} translated text.
655
+ */
656
+ export function translate(lang, key, params) {
657
+ const dict = DICTS[lang] ?? zh;
658
+ let value = dict[key];
659
+ if (typeof value !== 'string') value = zh[key];
660
+ if (typeof value !== 'string') return key;
661
+ if (!params) return value;
662
+ return value.replace(/\{(\w+)\}/g, (match, name) => (params[name] === undefined ? match : String(params[name])));
663
+ }