优化路由规则标签、菜单、删除UAM组件

This commit is contained in:
刘祥超
2023-03-09 11:42:15 +08:00
parent 9d6a3a8a0d
commit 8ccd41b551
5 changed files with 16 additions and 85 deletions

View File

@@ -11,3 +11,7 @@ import (
func filterMenuItems(serverConfig *serverconfigs.ServerConfig, menuItems []maps.Map, serverIdString string, secondMenuItem string) []maps.Map {
return menuItems
}
func filterMenuItems2(serverConfig *serverconfigs.ServerConfig, menuItems []maps.Map, serverIdString string, secondMenuItem string) []maps.Map {
return menuItems
}

View File

@@ -255,21 +255,7 @@ func (this *ServerHelper) createSettingsMenu(secondMenuItem string, serverIdStri
"isOn": serverConfig.ReverseProxyRef != nil && serverConfig.ReverseProxyRef.IsOn,
})
if teaconst.IsPlus {
menuItems = append(menuItems, maps.Map{
"name": "-",
"url": "",
"isActive": false,
})
menuItems = append(menuItems, maps.Map{
"name": "5秒盾",
"url": "/servers/server/settings/uam?serverId=" + serverIdString,
"isActive": secondMenuItem == "uam",
"isOn": serverConfig.UAM != nil && serverConfig.UAM.IsOn,
"isImportant": serverConfig.UAM != nil && serverConfig.UAM.IsOn,
})
}
menuItems = filterMenuItems(serverConfig, menuItems, serverIdString, secondMenuItem)
menuItems = append(menuItems, maps.Map{
"name": "-",
@@ -406,7 +392,7 @@ func (this *ServerHelper) createSettingsMenu(secondMenuItem string, serverIdStri
"isOn": serverConfig.Web != nil && serverConfig.Web.RequestLimit != nil && serverConfig.Web.RequestLimit.IsOn,
})
menuItems = filterMenuItems(serverConfig, menuItems, serverIdString, secondMenuItem)
menuItems = filterMenuItems2(serverConfig, menuItems, serverIdString, secondMenuItem)
menuItems = append(menuItems, maps.Map{
"name": "-",

View File

@@ -43,6 +43,12 @@ Vue.component("http-location-labels", {
<!-- 反向代理 -->
<http-location-labels-label v-if="refIsOn(location.reverseProxyRef, location.reverseProxy)" :v-href="url('/reverseProxy')">源站</http-location-labels-label>
<!-- UAM -->
<http-location-labels-label v-if="location.web != null && location.web.uam != null && location.web.uam.isPrior"><span :class="{disabled: !location.web.uam.isOn, red:location.web.uam.isOn}">5秒盾</span></http-location-labels-label>
<!-- CC -->
<http-location-labels-label v-if="location.web != null && location.web.cc != null && location.web.cc.isPrior"><span :class="{disabled: !location.web.cc.isOn, red:location.web.cc.isOn}">CC防护</span></http-location-labels-label>
<!-- WAF -->
<!-- TODO -->

View File

@@ -1,68 +0,0 @@
// UAM模式配置
Vue.component("uam-config-box", {
props: ["v-uam-config", "v-is-location", "v-is-group"],
data: function () {
let config = this.vUamConfig
if (config == null) {
config = {
isPrior: false,
isOn: false,
onlyURLPatterns: [],
exceptURLPatterns: []
}
}
if (config.onlyURLPatterns == null) {
config.onlyURLPatterns = []
}
if (config.exceptURLPatterns == null) {
config.exceptURLPatterns = []
}
return {
config: config,
moreOptionsVisible: false
}
},
methods: {
showMoreOptions: function () {
this.moreOptionsVisible = !this.moreOptionsVisible
}
},
template: `<div>
<input type="hidden" name="uamJSON" :value="JSON.stringify(config)"/>
<table class="ui table definition selectable">
<prior-checkbox :v-config="config" v-if="vIsLocation || vIsGroup"></prior-checkbox>
<tbody v-show="((!vIsLocation && !vIsGroup) || config.isPrior)">
<tr>
<td class="title">启用5秒盾</td>
<td>
<checkbox v-model="config.isOn"></checkbox>
<p class="comment"><plus-label></plus-label>启用后,访问网站时,自动检查浏览器环境,阻止非正常访问。</p>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td colspan="2"><more-options-indicator @change="showMoreOptions"></more-options-indicator></td>
</tr>
</tbody>
<tbody v-show="moreOptionsVisible">
<tr>
<td>例外URL</td>
<td>
<url-patterns-box v-model="config.exceptURLPatterns"></url-patterns-box>
<p class="comment">如果填写了例外URL表示这些URL跳过5秒盾不做处理。</p>
</td>
</tr>
<tr>
<td>限制URL</td>
<td>
<url-patterns-box v-model="config.onlyURLPatterns"></url-patterns-box>
<p class="comment">如果填写了支持URL表示只对这些URL进行5秒盾处理如果不填则表示支持所有的URL。</p>
</td>
</tr>
</tr>
</tbody>
</table>
<div class="margin"></div>
</div>`
})

View File

@@ -1,4 +1,7 @@
<first-menu>
<menu-item :href="'/servers/server/settings/locations?serverId=' + serverId">所有路由规则 &raquo;</menu-item>
<menu-item :href="'/servers/server/settings/locations?serverId=' + serverId">&laquo; 返回服务设置</menu-item>
<span class="item disabled" style="padding-left:0;padding-right:0">|</span>
<menu-item :href="'/servers/server/settings/locations?serverId=' + serverId">路由规则</menu-item>
<raquo-item></raquo-item>
<menu-item :href="'/servers/server/settings/locations/location?serverId=' + serverId + '&locationId=' + locationId" :active="true">{{locationConfig.pattern}}</menu-item>
</first-menu>