feat(settings): support dual-mode wechat oauth defaults
This commit is contained in:
@@ -36,6 +36,8 @@ type SystemSettings struct {
|
||||
WeChatConnectAppID string
|
||||
WeChatConnectAppSecret string
|
||||
WeChatConnectAppSecretConfigured bool
|
||||
WeChatConnectOpenEnabled bool
|
||||
WeChatConnectMPEnabled bool
|
||||
WeChatConnectMode string
|
||||
WeChatConnectScopes string
|
||||
WeChatConnectRedirectURL string
|
||||
@@ -191,12 +193,30 @@ type WeChatConnectOAuthConfig struct {
|
||||
Enabled bool
|
||||
AppID string
|
||||
AppSecret string
|
||||
OpenEnabled bool
|
||||
MPEnabled bool
|
||||
Mode string
|
||||
Scopes string
|
||||
RedirectURL string
|
||||
FrontendRedirectURL string
|
||||
}
|
||||
|
||||
func (cfg WeChatConnectOAuthConfig) SupportsMode(mode string) bool {
|
||||
switch normalizeWeChatConnectModeSetting(mode) {
|
||||
case "mp":
|
||||
return cfg.MPEnabled
|
||||
default:
|
||||
return cfg.OpenEnabled
|
||||
}
|
||||
}
|
||||
|
||||
func (cfg WeChatConnectOAuthConfig) ScopeForMode(mode string) string {
|
||||
if normalizeWeChatConnectModeSetting(mode) == "mp" {
|
||||
return normalizeWeChatConnectScopeSetting(cfg.Scopes, "mp")
|
||||
}
|
||||
return defaultWeChatConnectScopeForMode("open")
|
||||
}
|
||||
|
||||
// StreamTimeoutSettings 流超时处理配置(仅控制超时后的处理方式,超时判定由网关配置控制)
|
||||
type StreamTimeoutSettings struct {
|
||||
// Enabled 是否启用流超时处理
|
||||
|
||||
Reference in New Issue
Block a user