mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-05-30 21:00:30 +08:00
fix: 修复 pairing required - 改用 openclaw-control-ui 客户端 ID 触发静默自动配对
上游源码分析发现根本原因: - Gateway 的 shouldAllowSilentLocalPairing 需要 isControlUi=true 才能在本地连接时静默自动批准设备配对 - 我们之前用 gateway-client+backend,isControlUi=false,加上 Tauri WebView 会发 Origin 头(hasBrowserOriginHeader=true), 导致 shouldAllowSilentLocalPairing 返回 false → 'pairing required' 修复内容: - device.rs: client.id 改为 openclaw-control-ui,mode 改为 ui, v3 签名 payload 同步更新,本地连接触发静默自动配对 - pairing.rs: paired.json 的 clientId/clientMode 同步更新 - main.js: 启动时自动调用 autoPairDevice(),确保 device 已配对 + allowedOrigins 已写入,无需用户手动点击一键修复
This commit is contained in:
@@ -78,9 +78,12 @@ async function autoConnectWebSocket() {
|
||||
const port = config?.gateway?.port || 18789
|
||||
const token = config?.gateway?.auth?.token || ''
|
||||
|
||||
if (!token) {
|
||||
console.warn('[main] Gateway token 未设置,跳过 WebSocket 连接')
|
||||
return
|
||||
// 启动前先确保设备已配对 + allowedOrigins 已写入,无需用户手动操作
|
||||
try {
|
||||
await api.autoPairDevice()
|
||||
console.log('[main] 设备配对 + origins 已就绪')
|
||||
} catch (pairErr) {
|
||||
console.warn('[main] autoPairDevice 失败(非致命):', pairErr)
|
||||
}
|
||||
|
||||
wsClient.connect(`127.0.0.1:${port}`, token)
|
||||
|
||||
Reference in New Issue
Block a user