将全局的通用设置--域名审核设置移到“集群设置--网站设置”中

This commit is contained in:
刘祥超
2023-09-18 16:07:57 +08:00
parent ba9245e724
commit 0f35b45704
6 changed files with 40 additions and 73 deletions

View File

@@ -100,6 +100,9 @@ func (this *IndexAction) RunPost(params struct {
HttpAllNodeIPShowPage bool HttpAllNodeIPShowPage bool
HttpAllEnableServerAddrVariable bool HttpAllEnableServerAddrVariable bool
HttpAllDomainAuditingIsOn bool
HttpAllDomainAuditingPrompt string
HttpAllServerName string HttpAllServerName string
HttpAllSupportsLowVersionHTTP bool HttpAllSupportsLowVersionHTTP bool
HttpAllMatchCertFromAllServers bool HttpAllMatchCertFromAllServers bool
@@ -172,6 +175,9 @@ func (this *IndexAction) RunPost(params struct {
config.HTTPAll.NodeIPShowPage = params.HttpAllNodeIPShowPage config.HTTPAll.NodeIPShowPage = params.HttpAllNodeIPShowPage
config.HTTPAll.NodeIPPageHTML = params.HttpAllNodeIPPageHTML config.HTTPAll.NodeIPPageHTML = params.HttpAllNodeIPPageHTML
config.HTTPAll.DomainAuditingIsOn = params.HttpAllDomainAuditingIsOn
config.HTTPAll.DomainAuditingPrompt = params.HttpAllDomainAuditingPrompt
// HTTP All // HTTP All
config.HTTPAll.ServerName = params.HttpAllServerName config.HTTPAll.ServerName = params.HttpAllServerName
config.HTTPAll.SupportsLowVersionHTTP = params.HttpAllSupportsLowVersionHTTP config.HTTPAll.SupportsLowVersionHTTP = params.HttpAllSupportsLowVersionHTTP

View File

@@ -31,9 +31,6 @@ func (this *IndexAction) RunGet(params struct{}) {
valueJSON := valueJSONResp.ValueJSON valueJSON := valueJSONResp.ValueJSON
globalConfig := &serverconfigs.GlobalConfig{} globalConfig := &serverconfigs.GlobalConfig{}
// 默认值
globalConfig.HTTPAll.DomainAuditingIsOn = false
if len(valueJSON) > 0 { if len(valueJSON) > 0 {
err = json.Unmarshal(valueJSON, globalConfig) err = json.Unmarshal(valueJSON, globalConfig)
if err != nil { if err != nil {

View File

@@ -5,7 +5,6 @@ import (
"github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/utils"
"github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils" "github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/maps"
@@ -28,17 +27,7 @@ func (this *StatusAction) RunPost(params struct {
} }
// 读取全局配置 // 读取全局配置
globalConfig, err := dao.SharedSysSettingDAO.ReadGlobalConfig(this.AdminContext()) var wg = sync.WaitGroup{}
if err != nil {
this.ErrorPage(err)
return
}
auditingPrompt := ""
if globalConfig != nil {
auditingPrompt = globalConfig.HTTPAll.DomainAuditingPrompt
}
wg := sync.WaitGroup{}
wg.Add(len(params.ServerIds)) wg.Add(len(params.ServerIds))
for _, serverId := range params.ServerIds { for _, serverId := range params.ServerIds {
@@ -98,6 +87,17 @@ func (this *StatusAction) RunPost(params struct {
if serverNamesResp.IsAuditing { if serverNamesResp.IsAuditing {
m["type"] = "auditing" m["type"] = "auditing"
m["message"] = "审核中" m["message"] = "审核中"
auditingPromptResp, err := this.RPC().ServerRPC().FindServerAuditingPrompt(this.AdminContext(), &pb.FindServerAuditingPromptRequest{ServerId: serverId})
if err != nil {
this.ErrorPage(err)
m["type"] = "serverErr"
m["message"] = "服务器错误"
m["todo"] = "错误信息FindServerNames(): " + err.Error() + ",请联系管理员修复此问题"
return
}
var auditingPrompt = auditingPromptResp.PromptText
if len(auditingPrompt) > 0 { if len(auditingPrompt) > 0 {
m["todo"] = auditingPrompt m["todo"] = auditingPrompt
} else { } else {

View File

@@ -7,7 +7,7 @@
<csrf-token></csrf-token> <csrf-token></csrf-token>
<input type="hidden" name="clusterId" :value="clusterId"/> <input type="hidden" name="clusterId" :value="clusterId"/>
<h4>域名</h4> <h4>域名绑定</h4>
<table class="ui table definition selectable"> <table class="ui table definition selectable">
<tr> <tr>
@@ -81,6 +81,26 @@
</tr> </tr>
</table> </table>
<div v-show="teaIsPlus">
<h4>域名审核</h4>
<table class="ui table definition selectable">
<tr>
<td class="title">域名变更时需要审核</td>
<td>
<checkbox name="httpAllDomainAuditingIsOn" v-model="config.httpAll.domainAuditingIsOn"></checkbox>
<p class="comment">选中后,用户在创建和修改域名时需要管理员审核通过才能生效。</p>
</td>
</tr>
<tr v-show="config.httpAll.domainAuditingIsOn">
<td>审核提示</td>
<td>
<input name="httpAllDomainAuditingPrompt" type="text" v-model="config.httpAll.domainAuditingPrompt" maxlength="200"/>
<p class="comment">提示用户需要审核的文字说明。</p>
</td>
</tr>
</table>
</div>
<h4>访问日志</h4> <h4>访问日志</h4>
<table class="ui table definition selectable"> <table class="ui table definition selectable">
<tr> <tr>

View File

@@ -1,33 +1,12 @@
{$layout} {$layout}
<div class="ui tabular menu tiny"> <div class="ui tabular menu tiny">
<a href="" class="item" :class="{active: tab == 'domainAuditing'}" @click.prevent="selectTab('domainAuditing')">域名审核配置</a>
<a href="" class="item" :class="{active: tab == 'tcpPorts'}" @click.prevent="selectTab('tcpPorts')">TCP/TLS端口</a> <a href="" class="item" :class="{active: tab == 'tcpPorts'}" @click.prevent="selectTab('tcpPorts')">TCP/TLS端口</a>
</div> </div>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success"> <form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="globalConfigJSON" :value="JSON.stringify(globalConfig)"/> <input type="hidden" name="globalConfigJSON" :value="JSON.stringify(globalConfig)"/>
<!-- 域名审核相关配置 -->
<div v-show="tab == 'domainAuditing'">
<table class="ui table definition selectable">
<tr>
<td class="title">域名变更时是否需要审核</td>
<td>
<checkbox v-model="globalConfig.httpAll.domainAuditingIsOn"></checkbox>
<p class="comment">选中后,用户在修改域名时需要管理员审核通过才能生效。</p>
</td>
</tr>
<tr v-show="globalConfig.httpAll.domainAuditingIsOn">
<td>审核提示</td>
<td>
<input type="text" v-model="globalConfig.httpAll.domainAuditingPrompt" maxlength="200"/>
<p class="comment">提示用户需要审核的文字说明。</p>
</td>
</tr>
</table>
</div>
<!-- TCP 相关 --> <!-- TCP 相关 -->
<div v-show="tab == 'tcpPorts'"> <div v-show="tab == 'tcpPorts'">
<table class="ui table definition selectable"> <table class="ui table definition selectable">

View File

@@ -1,5 +1,5 @@
Tea.context(function () { Tea.context(function () {
this.tab = "domainAuditing" this.tab = "tcpPorts"
this.$delay(function () { this.$delay(function () {
if (window.location.hash != null && window.location.hash.length > 1) { if (window.location.hash != null && window.location.hash.length > 1) {
@@ -18,41 +18,6 @@ Tea.context(function () {
}) })
} }
/**
* 域名不匹配动作
*/
this.domainMismatchAction = "page"
this.domainMismatchActionPageOptions = {
statusCode: 404,
contentHTML: `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>404 not found</title>
<style type="text/css">
* { font-family: Roboto, system-ui, sans-serif; }
h3, p { text-align: center; }
p { color: grey; }
</style>
</head>
<body>
<h3>Error: 404 Page Not Found</h3>
<h3>找不到您要访问的页面。</h3>
<p>原因:找不到当前访问域名对应的网站,请联系网站管理员。</p>
</body>
</html>`
}
if (this.globalConfig.httpAll.domainMismatchAction != null) {
this.domainMismatchAction = this.globalConfig.httpAll.domainMismatchAction.code
if (this.domainMismatchAction == "page") {
this.domainMismatchActionPageOptions = this.globalConfig.httpAll.domainMismatchAction.options;
}
}
/** /**
* TCP端口 * TCP端口
*/ */