fix: include api key in tenant websocket endpoint

This commit is contained in:
richjohnrambo
2026-09-09 17:32:49 +08:00
parent 23afc1b7f1
commit e0a6ee27bc
3 changed files with 13 additions and 7 deletions
+5 -1
View File
@@ -856,8 +856,12 @@ func imPublicEndpoints(req *http.Request) map[string]any {
} else if strings.HasPrefix(wsBase, "http://") {
wsBase = "ws://" + strings.TrimPrefix(wsBase, "http://")
}
wsEndpoint := strings.TrimRight(wsBase, "/") + "/v0/channels"
if apiKey := strings.TrimSpace(getAPIKey(req)); apiKey != "" {
wsEndpoint += "?apikey=" + url.QueryEscape(apiKey)
}
return map[string]any{
"websocket": strings.TrimRight(wsBase, "/") + "/v0/channels",
"websocket": wsEndpoint,
"api": strings.TrimRight(base, "/") + "/v1/im",
"file": strings.TrimRight(base, "/") + "/v0/file",
}