fix: ethend OBv11配置界面字段丢失 — PLATFORM_FIELDS key qq→obv11
- 配置platform迁移后 PLATFORM_FIELDS['obv11'] 查不到返回空 - 新增 getPlatformFields() 归一化查找,兼容旧qq key - PLATFORM_ICONS/LABELS/REAL 同步增加 obv11 key Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -4227,8 +4227,7 @@ function toggleTimelineAutoRefresh(on) {
|
|||||||
|
|
||||||
// ========== 面板: 第三方聊天配置 ==========
|
// ========== 面板: 第三方聊天配置 ==========
|
||||||
|
|
||||||
var PLATFORM_FIELDS = {
|
var PLATFORM_FIELDS = { obv11: [
|
||||||
qq: [
|
|
||||||
{ key: 'mode', label: '连接模式', type: 'select', options: [
|
{ key: 'mode', label: '连接模式', type: 'select', options: [
|
||||||
{ value: 'client', label: '客户端模式 (主动连接 NapCat)' },
|
{ value: 'client', label: '客户端模式 (主动连接 NapCat)' },
|
||||||
{ value: 'server', label: '服务端模式 (等待 NapCat 连接)' }
|
{ value: 'server', label: '服务端模式 (等待 NapCat 连接)' }
|
||||||
@@ -4269,15 +4268,23 @@ var PLATFORM_FIELDS = {
|
|||||||
{ key: 'admin_uids', label: '管理员账号ID (多个用逗号分隔)', placeholder: '如: 123456789,987654321' }
|
{ key: 'admin_uids', label: '管理员账号ID (多个用逗号分隔)', placeholder: '如: 123456789,987654321' }
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
// Resolve platform fields with obv11→qq fallback
|
||||||
|
function getPlatformFields(platformType) {
|
||||||
|
var f = PLATFORM_FIELDS[platformType];
|
||||||
|
if (f) return f;
|
||||||
|
f = PLATFORM_FIELDS["qq"];
|
||||||
|
if (f) return f;
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
var PLATFORM_ICONS = { qq: '🔷', telegram: '✈️', webhook: '🪝', wechat: '💚', feishu: '🕊️', discord: '🎮' };
|
var PLATFORM_ICONS = { obv11: '🔷', qq: '🔷', telegram: '✈️', webhook: '🪝', wechat: '💚', feishu: '🕊️', discord: '🎮' };
|
||||||
var PLATFORM_LABELS = { qq: 'QQ', telegram: 'Telegram', webhook: 'Webhook', wechat: 'WeChat', feishu: 'Feishu', discord: 'Discord' };
|
var PLATFORM_LABELS = { obv11: 'OBv11', qq: 'QQ', telegram: 'Telegram', webhook: 'Webhook', wechat: 'WeChat', feishu: 'Feishu', discord: 'Discord' };
|
||||||
// 已完整实现的平台 (非桩代码)
|
// 已完整实现的平台 (非桩代码)
|
||||||
var PLATFORM_REAL = { qq: true, telegram: true, webhook: true };
|
var PLATFORM_REAL = { obv11: true, qq: true, telegram: true, webhook: true };
|
||||||
|
|
||||||
// 静态能力声明 (来自各适配器 Capabilities() 返回值,桥接离线时展示)
|
// 静态能力声明 (来自各适配器 Capabilities() 返回值,桥接离线时展示)
|
||||||
var PLATFORM_STATIC_CAPS = {
|
var PLATFORM_STATIC_CAPS = {
|
||||||
qq: { max_message_length: 4500, supports_markdown: false, supports_image: true, supports_voice: false, supports_emoji: true, supports_reaction: false, supports_typing_hint: false, recommend_burst_max: 3 },
|
obv11: { max_message_length: 4500, supports_markdown: false, supports_image: true, supports_voice: false, supports_emoji: true, supports_reaction: false, supports_typing_hint: false, recommend_burst_max: 3 },
|
||||||
telegram: { max_message_length: 4096, supports_markdown: true, supports_image: true, supports_voice: true, supports_emoji: true, supports_reaction: false, supports_typing_hint: true, recommend_burst_max: 5 },
|
telegram: { max_message_length: 4096, supports_markdown: true, supports_image: true, supports_voice: true, supports_emoji: true, supports_reaction: false, supports_typing_hint: true, recommend_burst_max: 5 },
|
||||||
webhook: { max_message_length: 4000, supports_markdown: true, supports_image: true, supports_voice: true, supports_emoji: true, supports_reaction: false, supports_typing_hint: false, recommend_burst_max: 3 },
|
webhook: { max_message_length: 4000, supports_markdown: true, supports_image: true, supports_voice: true, supports_emoji: true, supports_reaction: false, supports_typing_hint: false, recommend_burst_max: 3 },
|
||||||
wechat: { max_message_length: 2048, supports_markdown: false, supports_image: true, supports_voice: true, supports_emoji: false, supports_reaction: false, supports_typing_hint: false, recommend_burst_max: 3 },
|
wechat: { max_message_length: 2048, supports_markdown: false, supports_image: true, supports_voice: true, supports_emoji: false, supports_reaction: false, supports_typing_hint: false, recommend_burst_max: 3 },
|
||||||
@@ -4574,7 +4581,7 @@ function renderChatPlatformDetail(name) {
|
|||||||
|
|
||||||
function renderChatConfigForm(name, cfg) {
|
function renderChatConfigForm(name, cfg) {
|
||||||
var platformType = (cfg && cfg.platform) || name;
|
var platformType = (cfg && cfg.platform) || name;
|
||||||
var fields = PLATFORM_FIELDS[platformType] || [];
|
var fields = getPlatformFields(platformType);
|
||||||
var container = document.getElementById('chat-config-form');
|
var container = document.getElementById('chat-config-form');
|
||||||
if (!container) return;
|
if (!container) return;
|
||||||
var currentFields = (cfg && cfg.fields) || {};
|
var currentFields = (cfg && cfg.fields) || {};
|
||||||
@@ -4608,7 +4615,7 @@ function renderChatConfigForm(name, cfg) {
|
|||||||
function onCfgFieldChange(name) {
|
function onCfgFieldChange(name) {
|
||||||
var cfg = (STATE.chatConfigs || []).find(function(c) { return c.name === name; }) || null;
|
var cfg = (STATE.chatConfigs || []).find(function(c) { return c.name === name; }) || null;
|
||||||
var platformType = (cfg && cfg.platform) || name;
|
var platformType = (cfg && cfg.platform) || name;
|
||||||
var fieldDefs = PLATFORM_FIELDS[platformType] || [];
|
var fieldDefs = getPlatformFields(platformType);
|
||||||
var tempFields = {};
|
var tempFields = {};
|
||||||
fieldDefs.forEach(function(f) {
|
fieldDefs.forEach(function(f) {
|
||||||
var el = document.getElementById('cfg-field-' + f.key);
|
var el = document.getElementById('cfg-field-' + f.key);
|
||||||
@@ -4624,7 +4631,7 @@ async function saveChatConfig(name) {
|
|||||||
var cfg = (STATE.chatConfigs || []).find(function(c) { return c.name === name; }) || null;
|
var cfg = (STATE.chatConfigs || []).find(function(c) { return c.name === name; }) || null;
|
||||||
var platformType = (cfg && cfg.platform) || name;
|
var platformType = (cfg && cfg.platform) || name;
|
||||||
var fields = {};
|
var fields = {};
|
||||||
var fieldDefs = PLATFORM_FIELDS[platformType] || [];
|
var fieldDefs = getPlatformFields(platformType);
|
||||||
fieldDefs.forEach(function(f) {
|
fieldDefs.forEach(function(f) {
|
||||||
var el = document.getElementById('cfg-field-' + f.key);
|
var el = document.getElementById('cfg-field-' + f.key);
|
||||||
if (el) fields[f.key] = el.value;
|
if (el) fields[f.key] = el.value;
|
||||||
|
|||||||
Reference in New Issue
Block a user