mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-12 11:20:27 +08:00
实现HTTP部分功能
This commit is contained in:
@@ -53,7 +53,7 @@ Vue.component("http-header-policy-box", {
|
||||
responseDeletingHeaders = responsePolicy.deleteHeaders
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
type: type,
|
||||
typeName: (type == "request") ? "请求" : "响应",
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
Vue.component("http-pages-and-shutdown-box", {
|
||||
props: ["v-pages", "v-shutdown-config"],
|
||||
props: ["v-pages", "v-shutdown-config", "v-is-location"],
|
||||
data: function () {
|
||||
let pages = []
|
||||
if (this.vPages != null) {
|
||||
pages = this.vPages
|
||||
}
|
||||
let shutdownConfig = {
|
||||
isPrior: false,
|
||||
isOn: false,
|
||||
url: "",
|
||||
status: 0
|
||||
@@ -84,25 +85,33 @@ Vue.component("http-pages-and-shutdown-box", {
|
||||
<td>临时关闭页面</td>
|
||||
<td>
|
||||
<div>
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" value="1" v-model="shutdownConfig.isOn" />
|
||||
<label></label>
|
||||
</div>
|
||||
<div v-show="shutdownConfig.isOn">
|
||||
<table class="ui table selectable definition">
|
||||
<table class="ui table selectable definition">
|
||||
<prior-checkbox :v-config="shutdownConfig" v-if="vIsLocation"></prior-checkbox>
|
||||
<tbody v-show="!vIsLocation || shutdownConfig.isPrior">
|
||||
<tr>
|
||||
<td class="title">是否开启</td>
|
||||
<td>
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" value="1" v-model="shutdownConfig.isOn" />
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody v-show="(!vIsLocation || shutdownConfig.isPrior) && shutdownConfig.isOn">
|
||||
<tr>
|
||||
<td class="title">页面URL</td>
|
||||
<td>
|
||||
<input type="text" v-model="shutdownConfig.url" placeholder="页面文件路径或一个完整URL"/>
|
||||
<p class="comment">页面文件是相对于节点安装目录的页面文件比如web/pages/40x.html,或者一个完整的URL。</p>
|
||||
<p class="comment">页面文件是相对于节点安装目录的页面文件比如pages/40x.html,或者一个完整的URL。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>状态码</td>
|
||||
<td><input type="text" size="3" maxlength="3" name="shutdownStatus" style="width:5.2em" placeholder="状态码" v-model="shutdownStatus"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="comment">开启临时关闭页面时,所有请求的响应都会显示此页面。可用于临时升级网站使用。</p>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -5,11 +5,41 @@ Vue.component("http-redirect-to-https-box", {
|
||||
if (redirectToHttpsConfig == null) {
|
||||
redirectToHttpsConfig = {
|
||||
isPrior: false,
|
||||
isOn: false
|
||||
isOn: false,
|
||||
host: "",
|
||||
port: 0,
|
||||
status: 0
|
||||
}
|
||||
}
|
||||
return {
|
||||
redirectToHttpsConfig: redirectToHttpsConfig
|
||||
redirectToHttpsConfig: redirectToHttpsConfig,
|
||||
portString: (redirectToHttpsConfig.port > 0) ? redirectToHttpsConfig.port.toString() : "",
|
||||
moreOptionsVisible: false,
|
||||
statusOptions: [
|
||||
{"code": 301, "text": "Moved Permanently"},
|
||||
{"code": 308, "text": "Permanent Redirect"},
|
||||
{"code": 302, "text": "Found"},
|
||||
{"code": 303, "text": "See Other"},
|
||||
{"code": 307, "text": "Temporary Redirect"}
|
||||
]
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
"redirectToHttpsConfig.status": function () {
|
||||
this.redirectToHttpsConfig.status = parseInt(this.redirectToHttpsConfig.status)
|
||||
},
|
||||
portString: function (v) {
|
||||
let port = parseInt(v)
|
||||
if (!isNaN(port)) {
|
||||
this.redirectToHttpsConfig.port = port
|
||||
} else {
|
||||
this.redirectToHttpsConfig.port = 0
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeMoreOptions: function (isVisible) {
|
||||
this.moreOptionsVisible = isVisible
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
@@ -26,9 +56,36 @@ Vue.component("http-redirect-to-https-box", {
|
||||
<input type="checkbox" v-model="redirectToHttpsConfig.isOn"/>
|
||||
<label></label>
|
||||
</div>
|
||||
<p class="comment">开启后,所有HTTP的请求都会自动跳转到对应的HTTPS URL上。</p>
|
||||
<p class="comment">开启后,所有HTTP的请求都会自动跳转到对应的HTTPS URL上,<more-options-angle @change="changeMoreOptions"></more-options-angle></p>
|
||||
|
||||
<!-- TODO 如果已经设置了特殊设置,需要在界面上显示 -->
|
||||
<table class="ui table" v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td class="title">状态码</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" v-model="redirectToHttpsConfig.status">
|
||||
<option value="0">[使用默认]</option>
|
||||
<option v-for="option in statusOptions" :value="option.code">{{option.code}} {{option.text}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>域名或IP地址</td>
|
||||
<td>
|
||||
<input type="text" name="host" v-model="redirectToHttpsConfig.host"/>
|
||||
<p class="comment">默认和用户正在访问的域名或IP地址一致。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>端口</td>
|
||||
<td>
|
||||
<input type="text" name="port" v-model="portString" maxlength="5" style="width:6em"/>
|
||||
<p class="comment">默认端口为443。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -38,7 +95,34 @@ Vue.component("http-redirect-to-https-box", {
|
||||
<input type="checkbox" v-model="redirectToHttpsConfig.isOn"/>
|
||||
<label></label>
|
||||
</div>
|
||||
<p class="comment">开启后,所有HTTP的请求都会自动跳转到对应的HTTPS URL上。</p>
|
||||
<p class="comment">开启后,所有HTTP的请求都会自动跳转到对应的HTTPS URL上,<more-options-angle @change="changeMoreOptions"></more-options-angle></p>
|
||||
|
||||
<!-- TODO 如果已经设置了特殊设置,需要在界面上显示 -->
|
||||
<table class="ui table" v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td class="title">状态码</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" v-model="redirectToHttpsConfig.status">
|
||||
<option value="0">[使用默认]</option>
|
||||
<option v-for="option in statusOptions" :value="option.code">{{option.code}} {{option.text}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>域名或IP地址</td>
|
||||
<td>
|
||||
<input type="text" name="host" v-model="redirectToHttpsConfig.host"/>
|
||||
<p class="comment">默认和用户正在访问的域名或IP地址一致。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>端口</td>
|
||||
<td>
|
||||
<input type="text" name="port" v-model="portString" maxlength="5" style="width:6em"/>
|
||||
<p class="comment">默认端口为443。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="margin"></div>
|
||||
</div>`
|
||||
|
||||
Reference in New Issue
Block a user