feat(im): support custom endpoints for private WeCom deployments
Allow configuring custom WebSocket and API base URLs for WeCom via optional credentials fields (ws_endpoint, api_base_url), enabling integration with privately deployed WeCom instances. Changes: - LongConnClient and WebhookAdapter accept custom endpoint URLs - Endpoint URLs validated at construction (scheme + SSRF check) - Private deployment hostnames added to file download SSRF allowlist - Frontend forms added for both WebSocket and Webhook modes - i18n support for zh-CN, en-US, ru-RU, ko-KR Uses default public cloud endpoints when not specified.
This commit is contained in:
@@ -1059,6 +1059,7 @@ func registerIMAdapterFactories(imService *imPkg.Service) {
|
||||
getString(creds, "token"),
|
||||
getString(creds, "encoding_aes_key"),
|
||||
corpAgentID,
|
||||
getString(creds, "api_base_url"),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@@ -1066,12 +1067,16 @@ func registerIMAdapterFactories(imService *imPkg.Service) {
|
||||
return adapter, nil, nil
|
||||
|
||||
case "websocket":
|
||||
client := wecom.NewLongConnClient(
|
||||
client, err := wecom.NewLongConnClient(
|
||||
getString(creds, "bot_id"),
|
||||
getString(creds, "bot_secret"),
|
||||
getString(creds, "ws_endpoint"),
|
||||
getString(creds, "bot_name"),
|
||||
msgHandler,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
wsCtx, wsCancel := context.WithCancel(context.Background())
|
||||
go func() {
|
||||
|
||||
Reference in New Issue
Block a user