diff --git a/apps/web/public/channels/matrix.svg b/apps/web/public/channels/matrix.svg new file mode 100644 index 00000000..979fc713 --- /dev/null +++ b/apps/web/public/channels/matrix.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/apps/web/src/i18n/locales/en.json b/apps/web/src/i18n/locales/en.json index 26cc6e28..71fd7f96 100644 --- a/apps/web/src/i18n/locales/en.json +++ b/apps/web/src/i18n/locales/en.json @@ -887,11 +887,16 @@ "webhookCallback": "WebHook Callback URL", "webhookCallbackHint": "Use this URL as the event subscription request URL in Feishu/Lark.", "webhookCallbackPending": "Save this platform configuration to generate the callback URL.", + "showSecretField": "Show {field}", + "hideSecretField": "Hide {field}", + "feishuWebhookSecurityHint": "For security, webhook mode requires either an Encrypt Key or a Verification Token; an unprotected public callback URL should not be exposed.", + "feishuWebhookSecretRequired": "For security, configure at least one of Encrypt Key or Verification Token.", "noAvailableTypes": "All platform types have been configured", "types": { "feishu": "Feishu", "discord": "Discord", "qq": "QQ", + "matrix": "Matrix", "telegram": "Telegram", "web": "Web", "local": "Local" @@ -900,6 +905,7 @@ "feishu": "FS", "discord": "DC", "qq": "QQ", + "matrix": "MX", "telegram": "TG", "web": "Web", "local": "CLI" diff --git a/apps/web/src/i18n/locales/zh.json b/apps/web/src/i18n/locales/zh.json index 95584c98..399efb8f 100644 --- a/apps/web/src/i18n/locales/zh.json +++ b/apps/web/src/i18n/locales/zh.json @@ -883,11 +883,16 @@ "webhookCallback": "WebHook 回调地址", "webhookCallbackHint": "将该地址配置到飞书/Lark 事件订阅的请求 URL。", "webhookCallbackPending": "保存平台配置后会生成回调地址。", + "showSecretField": "显示{field}", + "hideSecretField": "隐藏{field}", + "feishuWebhookSecurityHint": "出于安全考虑,Webhook 模式必须配置 Encrypt Key 或 Verification Token 之一;未受保护的回调地址不应直接暴露在公网上。", + "feishuWebhookSecretRequired": "出于安全考虑,请至少配置 Encrypt Key 或 Verification Token 之一。", "noAvailableTypes": "所有平台类型均已配置", "types": { "feishu": "飞书", "discord": "Discord", "qq": "QQ", + "matrix": "Matrix", "telegram": "Telegram", "web": "Web", "local": "本地" @@ -896,6 +901,7 @@ "feishu": "飞", "discord": "DC", "qq": "QQ", + "matrix": "MX", "telegram": "TG", "web": "Web", "local": "CLI" diff --git a/apps/web/src/pages/bots/components/bot-channels.vue b/apps/web/src/pages/bots/components/bot-channels.vue index 5bc6b190..200733f8 100644 --- a/apps/web/src/pages/bots/components/bot-channels.vue +++ b/apps/web/src/pages/bots/components/bot-channels.vue @@ -199,10 +199,19 @@ const selectedItem = computed(() => allChannels.value.find((c) => c.meta.type === selectedType.value) ?? null, ) -watch(configuredChannels, (list) => { - if (list.length > 0 && !selectedType.value) { - selectedType.value = list[0].meta.type +watch(allChannels, (list) => { + if (list.length === 0) { + selectedType.value = null + return } + + const current = selectedType.value + if (current && list.some((item) => item.meta.type === current)) { + return + } + + const configured = list.find((item) => item.configured) + selectedType.value = configured?.meta.type ?? list[0].meta.type }, { immediate: true }) function addChannel(type: string) { @@ -214,6 +223,7 @@ function channelIcon(type: string): string { const icons: Record = { qq: 'QQ', telegram: 'TG', + matrix: 'MX', feishu: '飞', } return icons[type] ?? type.slice(0, 2).toUpperCase() @@ -223,6 +233,7 @@ function channelBadgeClass(type: string): string { const classes: Record = { qq: 'bg-sky-100 text-sky-700 dark:bg-sky-900 dark:text-sky-300', telegram: 'bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300', + matrix: 'bg-emerald-100 text-emerald-700 dark:bg-emerald-900 dark:text-emerald-300', feishu: 'bg-indigo-100 text-indigo-700 dark:bg-indigo-900 dark:text-indigo-300', } return classes[type] ?? 'bg-secondary text-secondary-foreground' diff --git a/apps/web/src/pages/bots/components/channel-settings-panel.vue b/apps/web/src/pages/bots/components/channel-settings-panel.vue index dc75e20d..6526be6b 100644 --- a/apps/web/src/pages/bots/components/channel-settings-panel.vue +++ b/apps/web/src/pages/bots/components/channel-settings-panel.vue @@ -121,14 +121,15 @@ >