chore: 清除最后5处硬编码qq引用(注释+配置白名单)

This commit is contained in:
2026-06-23 18:20:33 +08:00
parent 8a3236b8bb
commit 73f0bf7b3e
4 changed files with 5 additions and 5 deletions
@@ -128,7 +128,7 @@ func (r *PlatformRouter) SetMessageHandler(h MessageHandler) {
} }
// RouteMessage converts a platform message to unified, checks permissions, and dispatches. // RouteMessage converts a platform message to unified, checks permissions, and dispatches.
// adapterKey is the config name (e.g., "qq", "qq-home") used to look up the adapter instance. // adapterKey is the config name (e.g., "obv11", "obv11-home") used to look up the adapter instance.
func (r *PlatformRouter) RouteMessage(adapterKey string, rawMsg interface{}) (*UnifiedResponse, error) { func (r *PlatformRouter) RouteMessage(adapterKey string, rawMsg interface{}) (*UnifiedResponse, error) {
a, err := r.GetAdapter(adapterKey) a, err := r.GetAdapter(adapterKey)
if err != nil { if err != nil {
@@ -156,7 +156,7 @@ func (r *PlatformRouter) RouteMessage(adapterKey string, rawMsg interface{}) (*U
} }
// Resolve identity (nil for unknown users; caller decides routing). // Resolve identity (nil for unknown users; caller decides routing).
// Use platform type (e.g. "qq") for identity resolution, not adapter key. // Use platform type (e.g. "obv11") for identity resolution, not adapter key.
identity := r.mapper.ResolveOrNil(a.PlatformName(), unified.SenderID) identity := r.mapper.ResolveOrNil(a.PlatformName(), unified.SenderID)
if identity != nil { if identity != nil {
unified.SenderID = identity.CyreneUser unified.SenderID = identity.CyreneUser
@@ -14,7 +14,7 @@ import (
type PlatformConfig struct { type PlatformConfig struct {
ID string `json:"id"` // immutable unique ID, generated at creation ID string `json:"id"` // immutable unique ID, generated at creation
Name string `json:"name"` // config key, e.g. "qq-main", "qq-work" Name string `json:"name"` // config key, e.g. "qq-main", "qq-work"
Platform string `json:"platform"` // base platform type: "qq", "telegram", etc. Platform string `json:"platform"` // base platform type: "obv11", "telegram", etc.
Enabled bool `json:"enabled"` Enabled bool `json:"enabled"`
Label string `json:"label"` Label string `json:"label"`
Fields map[string]string `json:"fields"` Fields map[string]string `json:"fields"`
@@ -9,7 +9,7 @@ import (
) )
var validPlatformTypes = map[string]bool{ var validPlatformTypes = map[string]bool{
"qq": true, "telegram": true, "webhook": true, "obv11": true, "telegram": true, "webhook": true,
"wechat": true, "feishu": true, "discord": true, "wechat": true, "feishu": true, "discord": true,
} }
@@ -29,7 +29,7 @@ func (h *LogHandler) handleLogs(w http.ResponseWriter, r *http.Request) {
return return
} }
// Resolve platform type from config name (e.g. "qq-home" → "qq"). // Resolve platform type from config name (e.g. "obv11-home" → "obv11").
platform := name platform := name
if h.store != nil { if h.store != nil {
if cfg, err := h.store.Get(name); err == nil && cfg.Platform != "" { if cfg, err := h.store.Get(name); err == nil && cfg.Platform != "" {