fix(bridge): align admin panel field keys with backend adapter settings

Frontend sent remote_url/bot_token/webhook_url while the backend reads
ws_url/token/listen_addr, so QQ adapters could never connect. Also add
the missing bot_qq field and wire the webhook adapter's APIKey.
This commit is contained in:
Aska committed 2026-08-20 19:40:32 +08:00
1 parent a58ec7325d
commit 9a3c77dbd3
2 files changed
+7 -6

No files matched your search

+1 -1
View File
@@ -366,7 +366,7 @@ func loadAdaptersFromConfig(router *bridge.Router, cfg *bridge.BridgeConfig, orc
case "discord":
router.Register(bridgedc.New(bridgedc.Config{Name: ac.Name, Token: ac.Settings["token"]}))
case "webhook":
router.Register(bridgewh.New(bridgewh.Config{Name: ac.Name, ListenAddr: ac.Settings["listen_addr"]}))
router.Register(bridgewh.New(bridgewh.Config{Name: ac.Name, ListenAddr: ac.Settings["listen_addr"], APIKey: ac.Settings["api_key"]}))
}
}
+6 -5
View File
@@ -7,8 +7,9 @@ interface PlatformDef { value: string; label: string; fields: FieldDef[] }
const platformTypes: PlatformDef[] = [
{ value: 'qq-obv11', label: 'QQ (OBv11)', fields: [
{ key: 'mode', label: '连接模式', placeholder: '', type: 'select' },
{ key: 'remote_url', label: 'NapCat OneBot WS 地址', placeholder: 'ws://127.0.0.1:10311' },
{ key: 'ws_url', label: 'NapCat OneBot WS 地址', placeholder: 'ws://127.0.0.1:10311' },
{ key: 'access_token', label: 'Access Token (可选)', placeholder: '留空则不验证' },
{ key: 'bot_qq', label: '机器人 QQ 号', placeholder: '用于 @ 检测' },
{ key: 'http_url', label: 'NapCat HTTP API 地址 (可选)', placeholder: 'http://127.0.0.1:6099' },
{ key: 'http_token', label: 'HTTP API Token (可选)', placeholder: '留空则使用 Access Token' },
{ key: 'bot_port', label: '本地监听端口', placeholder: '8096' },
@@ -16,17 +17,17 @@ const platformTypes: PlatformDef[] = [
{ key: 'admin_uids', label: '管理员 QQ 号 (逗号分隔)', placeholder: '123456789,987654321' },
]},
{ value: 'telegram', label: 'Telegram', fields: [
{ key: 'bot_token', label: 'Bot Token', placeholder: '123456:ABC-DEF...' },
{ key: 'token', label: 'Bot Token', placeholder: '123456:ABC-DEF...' },
{ key: 'webhook_url', label: 'Webhook URL', placeholder: 'https://your-domain.com' },
{ key: 'admin_uids', label: '管理员账号ID (逗号分隔)', placeholder: '123456789,987654321' },
]},
{ value: 'discord', label: 'Discord', fields: [
{ key: 'bot_token', label: 'Bot Token', placeholder: '...' },
{ key: 'token', label: 'Bot Token', placeholder: '...' },
{ key: 'webhook_url', label: 'Webhook URL (可选)', placeholder: 'https://...' },
]},
{ value: 'webhook', label: 'Webhook', fields: [
{ key: 'webhook_url', label: 'Webhook URL', placeholder: 'https://hook.example.com/chat' },
{ key: 'secret', label: 'Secret Token (可选)', placeholder: '' },
{ key: 'listen_addr', label: '监听地址', placeholder: ':8097' },
{ key: 'api_key', label: 'API Key (可选)', placeholder: '留空则不校验 X-API-Key' },
]},
]