优化代码

This commit is contained in:
刘祥超
2023-06-01 18:07:46 +08:00
parent 586ccd90ec
commit c530869530
2 changed files with 9 additions and 13 deletions

View File

@@ -6,7 +6,6 @@ import (
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs"
@@ -87,26 +86,15 @@ func (this *IndexAction) RunGet(params struct {
}
// 当前集群是否支持HTTP/3
// TODO 检查当前服务所属用户是否支持HTTP/3
if server.NodeCluster == nil {
this.ErrorPage(errors.New("no node cluster for the server"))
return
}
http3PolicyResp, err := this.RPC().NodeClusterRPC().FindNodeClusterHTTP3Policy(this.AdminContext(), &pb.FindNodeClusterHTTP3PolicyRequest{NodeClusterId: server.NodeCluster.Id})
supportsHTTP3, err := this.checkSupportsHTTP3(server.NodeCluster.Id)
if err != nil {
this.ErrorPage(err)
return
}
var supportsHTTP3 = false
if len(http3PolicyResp.Http3PolicyJSON) > 0 {
var http3Policy = nodeconfigs.NewHTTP3Policy()
err = json.Unmarshal(http3PolicyResp.Http3PolicyJSON, http3Policy)
if err != nil {
this.ErrorPage(err)
return
}
supportsHTTP3 = http3Policy.IsOn
}
this.Data["serverType"] = server.Type
this.Data["httpsConfig"] = maps.Map{