节点自动升级功能之前的版本

This commit is contained in:
robin
2026-03-02 23:42:55 +08:00
parent 2a76d1773d
commit 853897a6f8
29 changed files with 1063 additions and 81 deletions

View File

@@ -48,7 +48,7 @@ func (this *CustomRecordsCreatePopupAction) RunGet(params struct {
"lineCountry": "默认",
"ruleName": "",
"weightEnabled": false,
"ttl": 30,
"ttl": 60,
"isOn": true,
"recordItemsJson": `[{"type":"A","value":"","weight":100}]`,
}

View File

@@ -47,6 +47,8 @@ func (this *ClusterSettingsAction) RunGet(params struct {
"fallbackTimeout": cluster.GetInt("fallbackTimeout"),
"installDir": cluster.GetString("installDir"),
"isOn": cluster.GetBool("isOn"),
"autoRemoteStart": cluster.GetBool("autoRemoteStart"),
"accessLogIsOn": cluster.GetBool("accessLogIsOn"),
}
if settings.GetInt("cacheTtl") <= 0 {
settings["cacheTtl"] = 60
@@ -110,6 +112,8 @@ func (this *ClusterSettingsAction) RunPost(params struct {
FallbackTimeout int32
InstallDir string
IsOn bool
AutoRemoteStart bool
AccessLogIsOn bool
Addresses []byte
SslPolicyJSON []byte
@@ -183,6 +187,8 @@ func (this *ClusterSettingsAction) RunPost(params struct {
TlsPolicyJSON: tlsPolicyJSON,
IsOn: params.IsOn,
IsDefault: false,
AutoRemoteStart: params.AutoRemoteStart,
AccessLogIsOn: params.AccessLogIsOn,
})
if err != nil {
this.ErrorPage(err)

View File

@@ -92,6 +92,8 @@ func findClusterMap(parent *actionutils.ParentAction, clusterID int64) (maps.Map
"isOn": cluster.GetIsOn(),
"isDefault": cluster.GetIsDefault(),
"tlsPolicyJSON": cluster.GetTlsPolicyJSON(),
"autoRemoteStart": cluster.GetAutoRemoteStart(),
"accessLogIsOn": cluster.GetAccessLogIsOn(),
}, nil
}
}

View File

@@ -10,7 +10,6 @@ import (
"github.com/TeaOSLab/EdgeCommon/pkg/systemconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/userconfigs"
"github.com/iwind/TeaGo/actions"
"github.com/iwind/TeaGo/lists"
"github.com/iwind/TeaGo/maps"
"github.com/xlzd/gotp"
)
@@ -184,9 +183,6 @@ func (this *CreatePopupAction) RunPost(params struct {
return
}
var featureCodes = config.Features
if config.HTTPDNSIsOn && !lists.ContainsString(featureCodes, userconfigs.UserFeatureCodeHTTPDNS) {
featureCodes = append(featureCodes, userconfigs.UserFeatureCodeHTTPDNS)
}
_, err = this.RPC().UserRPC().UpdateUserFeatures(this.AdminContext(), &pb.UpdateUserFeaturesRequest{
UserId: userId,

View File

@@ -7,6 +7,8 @@ import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/users/userutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/systemconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/userconfigs"
"github.com/iwind/TeaGo/actions"
"github.com/iwind/TeaGo/maps"
"github.com/xlzd/gotp"
@@ -87,17 +89,13 @@ func (this *UpdateAction) RunGet(params struct {
this.Data["clusterId"] = user.NodeCluster.Id
}
// 检查用户是否开通了 HTTPDNS 功能
// 检查全局是否启用了 HTTPDNS 功能
var hasHTTPDNSFeature = false
userFeaturesResp, err := this.RPC().UserRPC().FindUserFeatures(this.AdminContext(), &pb.FindUserFeaturesRequest{UserId: params.UserId})
if err != nil {
this.ErrorPage(err)
return
}
for _, f := range userFeaturesResp.Features {
if f.Code == "httpdns" {
hasHTTPDNSFeature = true
break
sysResp, sysErr := this.RPC().SysSettingRPC().ReadSysSetting(this.AdminContext(), &pb.ReadSysSettingRequest{Code: systemconfigs.SettingCodeUserRegisterConfig})
if sysErr == nil && len(sysResp.ValueJSON) > 0 {
var regConfig = userconfigs.DefaultUserRegisterConfig()
if json.Unmarshal(sysResp.ValueJSON, regConfig) == nil {
hasHTTPDNSFeature = regConfig.HTTPDNSIsOn
}
}
this.Data["hasHTTPDNSFeature"] = hasHTTPDNSFeature