feat(channel): 为 Telegram 和微信企业号添加代理支持
Publish Docker image (amd64) / Push Docker image to multiple registries (push) Has been cancelled
Publish Docker image (arm64) / Push Docker image to multiple registries (push) Has been cancelled
Linux Release / release (push) Has been cancelled
macOS Release / release (push) Has been cancelled
Windows Release / release (push) Has been cancelled
Publish Docker image (amd64) / Push Docker image to multiple registries (push) Has been cancelled
Publish Docker image (arm64) / Push Docker image to multiple registries (push) Has been cancelled
Linux Release / release (push) Has been cancelled
macOS Release / release (push) Has been cancelled
Windows Release / release (push) Has been cancelled
新增 HTTP 客户端工厂函数以支持通过代理发送请求,代理地址可在频道配置中设置。同时修复了微信企业号 TokenStore 更新时代理地址未同步的问题,并确保 Token 存储键值包含代理信息以避免冲突。
This commit is contained in:
@@ -41,6 +41,7 @@ func channel2item(channel_ *model.Channel) TokenStoreItem {
|
||||
CorpId: corpId,
|
||||
AgentSecret: channel_.Secret,
|
||||
AgentId: agentId,
|
||||
Proxy: channel_.URL,
|
||||
}
|
||||
return item
|
||||
case model.TypeLarkApp:
|
||||
@@ -227,12 +228,13 @@ func TokenStoreUpdateChannel(newChannel *model.Channel, oldChannel *model.Channe
|
||||
CorpId: corpId,
|
||||
AgentSecret: oldChannel.Secret,
|
||||
AgentId: agentId,
|
||||
Proxy: oldChannel.URL,
|
||||
}
|
||||
// Yeah, it's a deep copy.
|
||||
newItem := oldItem
|
||||
// This means the user updated those fields.
|
||||
if newChannel.AppId != "" {
|
||||
corpId, agentId, err := parseWechatCorpAccountAppId(oldChannel.AppId)
|
||||
corpId, agentId, err := parseWechatCorpAccountAppId(newChannel.AppId)
|
||||
if err != nil {
|
||||
common.SysError(err.Error())
|
||||
return
|
||||
@@ -243,6 +245,9 @@ func TokenStoreUpdateChannel(newChannel *model.Channel, oldChannel *model.Channe
|
||||
if newChannel.Secret != "" {
|
||||
newItem.AgentSecret = newChannel.Secret
|
||||
}
|
||||
if newChannel.URL != oldChannel.URL {
|
||||
newItem.Proxy = newChannel.URL
|
||||
}
|
||||
if !oldItem.IsShared() {
|
||||
TokenStoreRemoveItem(&oldItem)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user