节点自动升级功能之前的版本
This commit is contained in:
@@ -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}]`,
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
vm.record.lineContinent = vm.record.lineContinent || "默认";
|
||||
vm.record.lineCountry = vm.record.lineCountry || "默认";
|
||||
vm.record.ruleName = vm.record.ruleName || "";
|
||||
vm.record.ttl = vm.record.ttl || 30;
|
||||
vm.record.ttl = vm.record.ttl || 60;
|
||||
vm.record.weightEnabled = vm.normalizeBoolean(vm.record.weightEnabled, false);
|
||||
vm.record.isOn = vm.normalizeBoolean(vm.record.isOn, true);
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
<td>配置内容</td>
|
||||
<td>
|
||||
<source-code-box id="rpc-code" type="text/yaml">rpc.endpoints: [ {{apiEndpoints}} ]
|
||||
nodeId: "{{node.uniqueId}}"
|
||||
secret: "{{node.secret}}"</source-code-box>
|
||||
nodeId: "{{node.uniqueId}}"
|
||||
secret: "{{node.secret}}"</source-code-box>
|
||||
<p class="comment">每个节点的配置文件内容均不相同,不能混用。</p>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -81,8 +81,8 @@
|
||||
<td>配置内容</td>
|
||||
<td>
|
||||
<source-code-box id="rpc-code" type="text/yaml">rpc.endpoints: [ {{apiEndpoints}} ]
|
||||
nodeId: "{{node.uniqueId}}"
|
||||
secret: "{{node.secret}}"</source-code-box>
|
||||
nodeId: "{{node.uniqueId}}"
|
||||
secret: "{{node.secret}}"</source-code-box>
|
||||
<p class="comment">每个节点的配置文件内容均不相同,不能混用。</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -45,7 +45,8 @@
|
||||
<td>默认解析 TTL</td>
|
||||
<td>
|
||||
<div class="ui input right labeled">
|
||||
<input type="text" name="cacheTtl" maxlength="5" v-model="settings.cacheTtl" style="width: 6em" />
|
||||
<input type="text" name="cacheTtl" maxlength="5" v-model="settings.cacheTtl"
|
||||
style="width: 6em" />
|
||||
<span class="ui label">秒</span>
|
||||
</div>
|
||||
<p class="comment">SDK 通过 HTTPDNS 解析域名时返回的默认 TTL。</p>
|
||||
@@ -55,12 +56,33 @@
|
||||
<td>降级超时容忍度</td>
|
||||
<td>
|
||||
<div class="ui input right labeled">
|
||||
<input type="text" name="fallbackTimeout" maxlength="5" v-model="settings.fallbackTimeout" style="width: 6em" />
|
||||
<input type="text" name="fallbackTimeout" maxlength="5" v-model="settings.fallbackTimeout"
|
||||
style="width: 6em" />
|
||||
<span class="ui label">毫秒</span>
|
||||
</div>
|
||||
<p class="comment">节点回源查询上游 DNS 时的最大等待时间。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>自动远程启动</td>
|
||||
<td>
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" name="autoRemoteStart" value="1" v-model="settings.autoRemoteStart" />
|
||||
<label></label>
|
||||
</div>
|
||||
<p class="comment">当检测到节点离线时,自动尝试远程启动(前提是节点已经设置了SSH登录认证)。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>访问日志</td>
|
||||
<td>
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" name="accessLogIsOn" value="1" v-model="settings.accessLogIsOn" />
|
||||
<label></label>
|
||||
</div>
|
||||
<p class="comment">启用后,HTTPDNS 节点将会记录客户端的请求访问日志。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>启用当前集群</td>
|
||||
<td>
|
||||
@@ -77,13 +99,15 @@
|
||||
<tr>
|
||||
<td class="title">绑定端口 *</td>
|
||||
<td>
|
||||
<network-addresses-box :v-url="'/httpdns/addPortPopup'" :v-addresses="tlsConfig.listen" :v-protocol="'tls'" :v-support-range="true"></network-addresses-box>
|
||||
<network-addresses-box :v-url="'/httpdns/addPortPopup'" :v-addresses="tlsConfig.listen"
|
||||
:v-protocol="'tls'" :v-support-range="true"></network-addresses-box>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<ssl-config-box v-show="activeSection == 'tls'" :v-ssl-policy="tlsConfig.sslPolicy" :v-protocol="'tls'"></ssl-config-box>
|
||||
<ssl-config-box v-show="activeSection == 'tls'" :v-ssl-policy="tlsConfig.sslPolicy"
|
||||
:v-protocol="'tls'"></ssl-config-box>
|
||||
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user