feat: 渠道管理分两块(.env必要回退+删除同步+可用类型/已保存分开)
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

agent-120 .env只留必要回退:
- .env.example KOOK移4可选业务字段(RECEIVE_MODE/WEBHOOK_PATH/VERIFY_TOKEN/ENCRYPT_KEY),只留token/base_url; channelAccountsFromEnv不读这4个; 说明业务字段走channelConfigForm.channels.json
- 黑名单/限流/receive_mode等走管理面板热更新, env仅必要连接回退

agent-121 删除渠道列表同步(根因: adminListChannels枚举caps,删除不同步caps):
- adminListChannels 以channels.json为准: 遍历caps时已删账号adapter跳过(s.channels注入时), 删除/保存后列表=channels.json, 删除即消失
- (capReg Remove后续可加,范围外标注)

agent-122 渠道管理分两块显示(主人:不割裂):
- ①可用适配器类型(顶部PLATFORM_TYPES全集grid卡片,已配置/未配置Tag,点新建配置)
- ②已保存配置(下方AdminTable过滤accounts>0,账号+bot身份+掩码token提示+连接/断开/删除)
- 拆 channelConfigForm.tsx(248行) 表单抽出; Channels.tsx 463→306行; token只回填hint不写值(保存留空不改secret)
全仓 build/vet/test绿+前端build绿(356KB)
This commit is contained in:
Aska committed 2026-09-07 16:16:50 +08:00
1 parent b614633432
commit 0ed7984de3
8 files changed
+578 -290

No files matched your search

+27 -2
View File
@@ -150,9 +150,20 @@ func (s *Server) adminListChannels(w http.ResponseWriter, r *http.Request) {
if !ok {
continue
}
platform, acctID := splitAdapterName(ch.Name())
// channels.json is the source of truth for which accounts exist. A
// registered adapter surfaces only while its account is still
// configured, so a deleted account disappears from the list. Without a
// config store (tests) every registered adapter is listed unchanged.
if s.channels != nil {
accts, ok := accountsByPlatform[platform]
if !ok || !platformHasAccountID(accts, acctID) {
continue
}
}
sum := ChannelSummary{Name: ch.Name(), Connected: ch.IsConnected()}
if accts, ok := accountsByPlatform[channelBasePlatform(ch.Name())]; ok && len(accts) > 0 {
sum.Accounts = enrichAccountsWithBot(accts, botByPlatform[channelBasePlatform(ch.Name())])
if accts, ok := accountsByPlatform[platform]; ok && len(accts) > 0 {
sum.Accounts = enrichAccountsWithBot(accts, botByPlatform[platform])
}
out = append(out, sum)
}
@@ -201,6 +212,20 @@ func (s *Server) hasChannelSummary(out []ChannelSummary, platform string) bool {
return false
}
// platformHasAccountID reports whether the configured accounts of a platform still
// include the account an adapter is bound to. A bare adapter (kook) binds to that
// platform's default account (empty id); a multi-account adapter (kook:conf0)
// binds to exactly that account id. A mismatch means the adapter is stale — its
// account was deleted from channels.json — so it must not surface in the list.
func platformHasAccountID(accts []AdminChannelAccount, id string) bool {
for _, a := range accts {
if a.ID == id {
return true
}
}
return false
}
// botInfo is the live, connected bot's resolved identity (kook fetches it from
// /api/v3/user/me on Connect). It is surfaced through the adapter's Config() so
// the admin list can show who the bot is without persisting it.