mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-26 20:40:24 +08:00
WAF策略增加显示页面动作默认设置
This commit is contained in:
@@ -105,6 +105,7 @@ Vue.component("http-firewall-actions-box", {
|
||||
|
||||
tagTags: [],
|
||||
|
||||
pageUseDefault: true,
|
||||
pageStatus: 403,
|
||||
pageBody: defaultPageBody,
|
||||
defaultPageBody: defaultPageBody,
|
||||
@@ -302,6 +303,7 @@ Vue.component("http-firewall-actions-box", {
|
||||
|
||||
this.tagTags = []
|
||||
|
||||
this.pageUseDefault = true
|
||||
this.pageStatus = 403
|
||||
this.pageBody = this.defaultPageBody
|
||||
|
||||
@@ -429,8 +431,14 @@ Vue.component("http-firewall-actions-box", {
|
||||
}
|
||||
break
|
||||
case "page":
|
||||
this.pageUseDefault = true
|
||||
this.pageStatus = 403
|
||||
this.pageBody = this.defaultPageBody
|
||||
if (typeof config.options.useDefault === "boolean") {
|
||||
this.pageUseDefault = config.options.useDefault
|
||||
} else {
|
||||
this.pageUseDefault = false
|
||||
}
|
||||
if (config.options.status != null) {
|
||||
this.pageStatus = config.options.status
|
||||
}
|
||||
@@ -533,6 +541,7 @@ Vue.component("http-firewall-actions-box", {
|
||||
}
|
||||
|
||||
this.actionOptions = {
|
||||
useDefault: this.pageUseDefault,
|
||||
status: pageStatus,
|
||||
body: this.pageBody
|
||||
}
|
||||
@@ -691,7 +700,7 @@ Vue.component("http-firewall-actions-box", {
|
||||
<span v-if="config.code == 'tag'">:{{config.options.tags.join(", ")}}</span>
|
||||
|
||||
<!-- page -->
|
||||
<span v-if="config.code == 'page'">:[{{config.options.status}}]</span>
|
||||
<span v-if="config.code == 'page'">:[{{config.options.status}}]<span v-if="config.options.useDefault"> [默认页面]</span></span>
|
||||
|
||||
<!-- redirect -->
|
||||
<span v-if="config.code == 'redirect'">:{{config.options.url}}</span>
|
||||
@@ -893,11 +902,17 @@ Vue.component("http-firewall-actions-box", {
|
||||
|
||||
<!-- page -->
|
||||
<tr v-if="actionCode == 'page'">
|
||||
<td>状态码 *</td>
|
||||
<td>使用默认提示</td>
|
||||
<td>
|
||||
<checkbox v-model="pageUseDefault"></checkbox>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="actionCode == 'page' && !pageUseDefault">
|
||||
<td class="color-border">状态码 *</td>
|
||||
<td><input type="text" style="width: 4em" maxlength="3" v-model="pageStatus"/></td>
|
||||
</tr>
|
||||
<tr v-if="actionCode == 'page'">
|
||||
<td>网页内容</td>
|
||||
<tr v-if="actionCode == 'page' && !pageUseDefault">
|
||||
<td class="color-border">网页内容</td>
|
||||
<td>
|
||||
<textarea v-model="pageBody"></textarea>
|
||||
</td>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
Vue.component("http-firewall-page-options-viewer", {
|
||||
props: ["v-page-options"],
|
||||
data: function () {
|
||||
return {
|
||||
options: this.vPageOptions
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<span v-if="options == null">默认设置</span>
|
||||
<div v-else>
|
||||
状态码:{{options.status}} / 提示内容:<span v-if="options.body != null && options.body.length > 0">[{{options.body.length}}字符]</span>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
@@ -0,0 +1,67 @@
|
||||
Vue.component("http-firewall-page-options", {
|
||||
props: ["v-page-options"],
|
||||
data: function () {
|
||||
var defaultPageBody = `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
<style>
|
||||
address { line-height: 1.8; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>403 Forbidden By WAF</h1>
|
||||
<address>Connection: \${remoteAddr} (Client) -> \${serverAddr} (Server)</address>
|
||||
<address>Request ID: \${requestId}</address>
|
||||
</body>
|
||||
</html>`
|
||||
|
||||
return {
|
||||
pageOptions: this.vPageOptions,
|
||||
status: this.vPageOptions.status,
|
||||
body: this.vPageOptions.body,
|
||||
defaultPageBody: defaultPageBody,
|
||||
isEditing: false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
status: function (v) {
|
||||
if (typeof v === "string" && v.length != 3) {
|
||||
return
|
||||
}
|
||||
let statusCode = parseInt(v)
|
||||
if (isNaN(statusCode)) {
|
||||
this.pageOptions.status = 403
|
||||
} else {
|
||||
this.pageOptions.status = statusCode
|
||||
}
|
||||
},
|
||||
body: function (v) {
|
||||
this.pageOptions.body = v
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
edit: function () {
|
||||
this.isEditing = !this.isEditing
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<input type="hidden" name="pageOptionsJSON" :value="JSON.stringify(pageOptions)"/>
|
||||
<a href="" @click.prevent="edit">状态码:{{status}} / 提示内容:<span v-if="pageOptions.body != null && pageOptions.body.length > 0">[{{pageOptions.body.length}}字符]</span><span v-else class="disabled">[无]</span>
|
||||
<i class="icon angle" :class="{up: isEditing, down: !isEditing}"></i></a>
|
||||
<table class="ui table" v-show="isEditing">
|
||||
<tr>
|
||||
<td class="title">状态码 *</td>
|
||||
<td><input type="text" style="width: 4em" maxlength="3" v-model="status"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>网页内容</td>
|
||||
<td>
|
||||
<textarea v-model="body"></textarea>
|
||||
<p class="comment"><a href="" @click.prevent="body = defaultPageBody">[使用模板]</a> </p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
Reference in New Issue
Block a user