dsh-plugin-weapp-gateway 0.8.48 → 0.8.49
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.md +6 -0
- package/lib/client.js +87 -73
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
`dsh-plugin-weapp-gateway` · DeepSeek Harness 移动客户端连接插件
|
|
8
8
|
|
|
9
|
+
### v0.8.49 · 配对区改为两层:鲸尾公网主用,兼容 App 折叠备用
|
|
10
|
+
|
|
11
|
+
- 第一层常显:**鲸尾公网(小程序 · 主用)** —— 自动选择 / 鲸尾公网 · 小程序、中继状态与「生成小程序二维码」。
|
|
12
|
+
- 第二层折叠:**兼容 App(备用)** —— 点击展开上游插件的直连方式(局域网直连 / Cloudflare 外网 / Tailscale 私有网络 / 公网或其他手动地址),独立地址输入与「生成 App 二维码」;默认收起,与鲸尾公网内容完全分开。
|
|
13
|
+
- App 连接排查:协议层实测正常(LAN 入口 `dsh-pair` 握手 → `paired`/`hello` v3、token 重连;LAN / 自定义 / Tailscale / Cloudflare 四种 App 路线均 201);此前失败最可能是扫了中继专用 v3 码。现在 App 走第二层生成的直连码。
|
|
14
|
+
- 帮助气泡、面板文案与渲染测试同步;全量测试通过。
|
|
9
15
|
### v0.8.48 · 配对界面拆分为两个模块(App 连接修复)
|
|
10
16
|
|
|
11
17
|
- 「连接与配对」拆成两个独立模块,避免把小程序中继码当 App 码用:
|
package/lib/client.js
CHANGED
|
@@ -545,7 +545,7 @@ window.__ModuleLoader__.load({
|
|
|
545
545
|
const [showAllDevices, setShowAllDevices] = React.useState(false)
|
|
546
546
|
const [status, setStatus] = React.useState(null)
|
|
547
547
|
const [dismissedNotice, setDismissedNotice] = React.useState(() => dismissedRestartInstance)
|
|
548
|
-
//
|
|
548
|
+
// 两个配对模块各自维护方案:鲸尾公网小程序(主用)与兼容 App(折叠备用)。
|
|
549
549
|
const [appUrl, setAppUrl] = React.useState('')
|
|
550
550
|
const [miniPlan, setMiniPlan] = React.useState('auto')
|
|
551
551
|
const [appRoute, setAppRoute] = React.useState('lan')
|
|
@@ -613,6 +613,7 @@ window.__ModuleLoader__.load({
|
|
|
613
613
|
const [revokingIds, setRevokingIds] = React.useState(() => new Set())
|
|
614
614
|
const [sidebarBusy, setSidebarBusy] = React.useState(false)
|
|
615
615
|
const [offlineClearing, setOfflineClearing] = React.useState(false)
|
|
616
|
+
const [appLayerOpen, setAppLayerOpen] = React.useState(false)
|
|
616
617
|
|
|
617
618
|
const revokingIdsRef = React.useRef(new Set())
|
|
618
619
|
const manualAppUrlRef = React.useRef(false)
|
|
@@ -1355,7 +1356,7 @@ window.__ModuleLoader__.load({
|
|
|
1355
1356
|
helpLine('小程序连接(推荐)', '鲸尾小程序在微信里通过鲸尾公网中继连接,不受 wss 域名限制;「自动选择」的二维码同时带上 App 可用的地址。'),
|
|
1356
1357
|
helpLine('自动选择', '优先已就绪的公网入口,同时保留局域网与 Tailscale 地址;没有公网入口时小程序自动使用已注册的鲸尾中继。'),
|
|
1357
1358
|
helpLine('鲸尾公网 · 小程序', '生成仅供鲸尾小程序使用的中继二维码。'),
|
|
1358
|
-
helpLine('App
|
|
1359
|
+
helpLine('兼容 App(备用)', 'DSH App 使用直连入口:局域网直连、Cloudflare 外网、Tailscale 私有网络或公网/手动地址。'),
|
|
1359
1360
|
helpLine('局域网直连', '手机与 DSH 在同一个可互访的局域网,使用 ws:// 私有地址;离开该网络就无法直连。'),
|
|
1360
1361
|
helpLine('Cloudflare 外网', 'PC 主动连接 Cloudflare,外网用固定域名的 wss://;需要 Cloudflare 账户和域名。'),
|
|
1361
1362
|
helpLine('Tailscale 私有网络', '可检测本机地址,或填写主机的 100.x 私有地址;手机与电脑需登录同一 tailnet。'),
|
|
@@ -1374,7 +1375,7 @@ window.__ModuleLoader__.load({
|
|
|
1374
1375
|
React.createElement('option', { value: 'relay', disabled: !status?.relay }, status?.relay
|
|
1375
1376
|
? '鲸尾公网 · 小程序' : '鲸尾公网 · 尚未注册'))),
|
|
1376
1377
|
React.createElement('p', { style: { ...styles.muted, margin: '-6px 0 10px' } }, miniPlan === 'relay'
|
|
1377
|
-
? '此方案生成仅供鲸尾小程序使用的中继二维码;App
|
|
1378
|
+
? '此方案生成仅供鲸尾小程序使用的中继二维码;App 请展开下方「兼容 App(备用)」。'
|
|
1378
1379
|
: '自动选择会优先已就绪的公网入口,同时保留局域网与 Tailscale 地址;小程序没有公网入口时自动使用已注册的鲸尾中继;App 也可使用该二维码。生成新二维码不会断开已连接设备。'),
|
|
1379
1380
|
// 中继信息块属于小程序模块(自动选择 / 鲸尾公网中继)。
|
|
1380
1381
|
(relayInfo || relayConnector?.running || relayConnector?.delegatedTo || relayConnector?.lastError)
|
|
@@ -1406,77 +1407,90 @@ window.__ModuleLoader__.load({
|
|
|
1406
1407
|
}, busy ? '正在生成…' : !(status && status.gatewayEnabled) ? '请先开启移动网关'
|
|
1407
1408
|
: miniPlan === 'relay' ? '生成小程序中继二维码' : '生成小程序二维码'),
|
|
1408
1409
|
React.createElement('span', { style: styles.muted }, '配对码仅可使用一次,5 分钟内有效。'))),
|
|
1409
|
-
// ──
|
|
1410
|
+
// ── 第二层:兼容 App(折叠备用)────────────────────────────────
|
|
1410
1411
|
React.createElement('section', { style: { ...styles.card, marginTop: 16 } },
|
|
1411
|
-
React.createElement('
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
:
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1412
|
+
React.createElement('button', {
|
|
1413
|
+
type: 'button',
|
|
1414
|
+
style: { ...styles.button, width: '100%', textAlign: 'left', display: 'flex', justifyContent: 'space-between', alignItems: 'center', background: 'transparent', border: 0, padding: 0 },
|
|
1415
|
+
'aria-expanded': appLayerOpen,
|
|
1416
|
+
onClick: () => setAppLayerOpen((value) => !value),
|
|
1417
|
+
},
|
|
1418
|
+
React.createElement('span', null,
|
|
1419
|
+
React.createElement('strong', null, '兼容 App(备用)'),
|
|
1420
|
+
React.createElement('span', { style: { ...styles.muted, marginLeft: 8, fontWeight: 400 } },
|
|
1421
|
+
appLayerOpen ? '收起 App 兼容方式' : '需要连接 DSH App 时展开')),
|
|
1422
|
+
React.createElement('span', { 'aria-hidden': true, style: styles.muted }, appLayerOpen ? '▾' : '▸')),
|
|
1423
|
+
appLayerOpen
|
|
1424
|
+
? React.createElement(React.Fragment, null,
|
|
1425
|
+
React.createElement('p', { style: styles.muted }, '仅用于 DSH App(上游移动网关的直连方式),与上方鲸尾公网互不影响。'),
|
|
1426
|
+
React.createElement('div', { style: { display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: '8px 14px', maxWidth: '100%' } },
|
|
1427
|
+
React.createElement(GatewaySelect, { style: styles.input, value: appRoute, onChange: (event) => chooseAppRoute(event.target.value), disabled: !status, 'aria-label': 'App 连接方式' },
|
|
1428
|
+
React.createElement('option', { value: 'lan', disabled: !lanPairingUrl(status) }, lanPairingUrl(status)
|
|
1429
|
+
? '局域网直连'
|
|
1430
|
+
: '局域网直连 · 当前不可用'),
|
|
1431
|
+
status?.cloudflare?.supported
|
|
1432
|
+
? React.createElement('option', { value: 'cloudflare' }, 'Cloudflare 外网') : null,
|
|
1433
|
+
React.createElement('option', { value: 'tailscale', disabled: !(status && status.lan && status.lan.listening) },
|
|
1434
|
+
(status && status.lan && status.lan.listening) ? 'Tailscale 私有网络' : 'Tailscale 私有网络 · 请先开启局域网入口'),
|
|
1435
|
+
React.createElement('option', { value: 'custom' }, '公网或其他手动地址'))),
|
|
1436
|
+
React.createElement('label', { style: styles.label, htmlFor: 'mgw-pair-address' }, appRoute === 'tailscale'
|
|
1437
|
+
? '主机 Tailscale 地址(运行网关的电脑,不是手机)'
|
|
1438
|
+
: '配对入口地址(手机需能访问)'),
|
|
1439
|
+
React.createElement('input', {
|
|
1440
|
+
id: 'mgw-pair-address',
|
|
1441
|
+
style: styles.input,
|
|
1442
|
+
value: appUrl,
|
|
1443
|
+
onChange: (event) => {
|
|
1444
|
+
const value = event.target.value
|
|
1445
|
+
if (appRoute === 'tailscale') { manualAppUrlRef.current = true; setAppUrl(value); return }
|
|
1446
|
+
if (appRoute !== 'custom') { chooseAppRoute('custom'); setAppUrl(value); return }
|
|
1447
|
+
setAppUrl(value)
|
|
1448
|
+
},
|
|
1449
|
+
placeholder: appRoute === 'tailscale'
|
|
1450
|
+
? '100.x.x.x 或 ws://100.x.x.x:3081/ws/mobile(IPv6 用 [fd7a:…])'
|
|
1451
|
+
: 'ws://192.168.1.10:3081/ws/mobile 或 wss://gateway.example.com/ws/mobile',
|
|
1452
|
+
spellCheck: false,
|
|
1453
|
+
}),
|
|
1454
|
+
appRoute === 'tailscale' && appUrl.trim() && !isTailscaleInput(appUrl)
|
|
1455
|
+
? React.createElement('div', { style: { ...styles.error, margin: '-4px 0 8px' } }, '这里要填 100.64.0.0/10(或 fd7a:115c:a1e0::/48)的 Tailscale 私有地址。')
|
|
1456
|
+
: null,
|
|
1457
|
+
// Tailscale 手动地址指引:检测到本机地址时提示可直接使用。
|
|
1458
|
+
appRoute === 'tailscale'
|
|
1459
|
+
? React.createElement('div', { style: { ...styles.muted, margin: '-4px 0 10px', fontWeight: 500 } }, (() => {
|
|
1460
|
+
const detected = Array.isArray(status?.tailscale?.urls) ? status.tailscale.urls : []
|
|
1461
|
+
return detected.length
|
|
1462
|
+
? `已检测到本机 Tailscale 地址:${detected.join('、')}(可直接生成二维码)。手机需登录同一 tailnet。`
|
|
1463
|
+
: '未检测到本机 Tailscale 地址:请填写运行网关这台主机的 Tailscale IP(不是手机 IP),例如 100.x.x.x。手机与电脑需登录同一 tailnet。'
|
|
1464
|
+
})())
|
|
1465
|
+
: null,
|
|
1466
|
+
appRoute !== 'tailscale' && status && status.lan && status.lan.enabled
|
|
1467
|
+
? React.createElement('div', { style: { ...styles.muted, margin: '-7px 0 10px', fontWeight: 500, color: status.lan.error ? colors.danger : status.lan.listening ? colors.success : 'var(--dsw-alias-link, #4176e6)' } },
|
|
1468
|
+
status.lan.error
|
|
1469
|
+
? `局域网监听失败:${status.lan.error}`
|
|
1470
|
+
: status.lan.listening
|
|
1471
|
+
? `局域网入口已开启${status.lan.urls && status.lan.urls.length ? `:${status.lan.urls.join('、')}` : `,端口 ${status.lan.port}`}`
|
|
1472
|
+
: '局域网入口启动中…')
|
|
1473
|
+
: null,
|
|
1474
|
+
appRoute === 'cloudflare' && !cloudflareReady
|
|
1475
|
+
? React.createElement('div', { style: { ...styles.muted, margin: '-4px 0 10px', fontWeight: 500 } }, status?.cloudflare?.enabled
|
|
1476
|
+
? 'Cloudflare 外网尚未就绪,请稍候或查看下方 Cloudflare 设置。'
|
|
1477
|
+
: '尚未开启 Cloudflare Tunnel,可在下方设置中一键开启。')
|
|
1478
|
+
: null,
|
|
1479
|
+
React.createElement('div', { style: { display: 'flex', alignItems: 'center', gap: 12, flexWrap: 'wrap' } },
|
|
1480
|
+
React.createElement('button', {
|
|
1481
|
+
style: { ...styles.button, ...styles.primary, opacity: appPairingDisabled ? .65 : 1 },
|
|
1482
|
+
disabled: appPairingDisabled,
|
|
1483
|
+
onClick: () => pairFor('app'),
|
|
1484
|
+
}, busy ? '正在生成…' : !(status && status.gatewayEnabled) ? '请先开启移动网关'
|
|
1485
|
+
: appRoute === 'cloudflare' && !cloudflareReady
|
|
1486
|
+
? status?.cloudflare?.enabled ? '等待 Cloudflare 外网就绪' : '先开启 Cloudflare Tunnel'
|
|
1487
|
+
: appRoute === 'tailscale' && !status?.lan?.listening ? '请先开启局域网入口'
|
|
1488
|
+
: appRoute === 'tailscale' && !isTailscaleInput(appUrl) ? '填写主机 Tailscale 地址'
|
|
1489
|
+
: appRoute === 'lan' && !lanPairingUrl(status) ? '当前不可用'
|
|
1490
|
+
: appRoute === 'custom' && !appUrl.trim() ? '等待连接地址' : '生成 App 二维码'),
|
|
1491
|
+
React.createElement('span', { style: styles.muted }, '二维码只发给 App;小程序请用上方模块。')))
|
|
1492
|
+
: React.createElement('p', { style: { ...styles.muted, margin: '8px 0 0' } }, '局域网直连 / Cloudflare 外网 / Tailscale 私有网络 / 公网或其他手动地址;与鲸尾公网互不影响。')),
|
|
1493
|
+
appLayerOpen && appRoute === 'cloudflare' && status?.cloudflare?.supported
|
|
1480
1494
|
? React.createElement('section', { className: 'mgw-cloudflare-block', style: { ...styles.card, background: colors.card, border: 0, borderRadius: 16, padding: 18, marginTop: 16 } },
|
|
1481
1495
|
React.createElement('h3', { className: 'mgw-section-title' }, 'Cloudflare Tunnel · 外网接入'),
|
|
1482
1496
|
React.createElement('p', { style: styles.muted }, status.platform === 'linux'
|