实现源站端口跟随功能
This commit is contained in:
@@ -29,11 +29,14 @@ Vue.component("combo-box", {
|
||||
}
|
||||
|
||||
// 设定菜单宽度
|
||||
let inputWidth = this.$refs.searchBox.offsetWidth
|
||||
if (inputWidth != null && inputWidth > 0) {
|
||||
this.$refs.menu.style.width = inputWidth + "px"
|
||||
} else if (this.styleWidth.length > 0) {
|
||||
this.$refs.menu.style.width = this.styleWidth
|
||||
let searchBox = this.$refs.searchBox
|
||||
if (searchBox != null) {
|
||||
let inputWidth = searchBox.offsetWidth
|
||||
if (inputWidth != null && inputWidth > 0) {
|
||||
this.$refs.menu.style.width = inputWidth + "px"
|
||||
} else if (this.styleWidth.length > 0) {
|
||||
this.$refs.menu.style.width = this.styleWidth
|
||||
}
|
||||
}
|
||||
},
|
||||
data: function () {
|
||||
|
||||
@@ -86,10 +86,11 @@ Vue.component("origin-list-table", {
|
||||
</thead>
|
||||
<tr v-for="origin in vOrigins">
|
||||
<td :class="{disabled:!origin.isOn}"><a href="" @click.prevent="updateOrigin(origin.id)">{{origin.addr}} <i class="icon expand small"></i></a>
|
||||
<div style="margin-top: 0.3em" v-if="origin.name.length > 0 || origin.hasCert || (origin.host != null && origin.host.length > 0) || (origin.domains != null && origin.domains.length > 0)">
|
||||
<div style="margin-top: 0.3em" v-if="origin.name.length > 0 || origin.hasCert || (origin.host != null && origin.host.length > 0) || origin.followPort || (origin.domains != null && origin.domains.length > 0)">
|
||||
<tiny-basic-label v-if="origin.name.length > 0">{{origin.name}}</tiny-basic-label>
|
||||
<tiny-basic-label v-if="origin.hasCert">证书</tiny-basic-label>
|
||||
<tiny-basic-label v-if="origin.host != null && origin.host.length > 0">主机名: {{origin.host}}</tiny-basic-label>
|
||||
<tiny-basic-label v-if="origin.followPort">端口跟随</tiny-basic-label>
|
||||
<span v-if="origin.domains != null && origin.domains.length > 0"><tiny-basic-label v-for="domain in origin.domains">匹配: {{domain}}</tiny-basic-label></span>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
</select>
|
||||
|
||||
<!-- TCP -->
|
||||
<select class="ui dropdown auto-width" name="protocol" v-if="serverType == 'tcpProxy'">
|
||||
<select class="ui dropdown auto-width" name="protocol" v-if="serverType == 'tcpProxy'" v-model="protocol">
|
||||
<option value="tcp">TCP</option>
|
||||
<option value="tls">TLS</option>
|
||||
</select>
|
||||
|
||||
<!-- UDP -->
|
||||
<select class="ui dropdown auto-width" name="protocol" v-if="serverType == 'udpProxy'">
|
||||
<select class="ui dropdown auto-width" name="protocol" v-if="serverType == 'udpProxy'" v-model="protocol">
|
||||
<option value="udp">UDP</option>
|
||||
</select>
|
||||
</td>
|
||||
@@ -32,6 +32,38 @@
|
||||
<p class="comment"><span class="red" v-if="addrError.length > 0">{{addrError}}</span>源站服务器地址,通常是一个IP(或域名)加端口<span v-if="serverType == 'httpProxy'">,不需要加 http:// 或 https://</span>。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||
</tr>
|
||||
<tbody v-show="moreOptionsVisible">
|
||||
<tr v-if="protocol == 'https' || protocol == 'tls'">
|
||||
<td>{{protocol.toUpperCase()}}证书</td>
|
||||
<td>
|
||||
<ssl-certs-box :v-single-mode="true" :v-view-size="'mini'" :v-description="'可以选择连接源站使用的证书。'"></ssl-certs-box>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="isHTTP || protocol == 'tls'">
|
||||
<td>回源主机名</td>
|
||||
<td>
|
||||
<input type="text" name="host" placeholder="比如example.com" maxlength="100"/>
|
||||
<p class="comment">请求源站时的Host,用于修改源站接收到的域名<span v-if="isHTTP">,自定义Host内容中支持请求变量</span>。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="isHTTP">
|
||||
<td>专属域名</td>
|
||||
<td>
|
||||
<domains-box></domains-box>
|
||||
<p class="comment">默认不需要填写,表示支持所有域名。如果填写了专属域名,表示这些源站只会在所列的专属域名被访问时才生效。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>端口跟随</td>
|
||||
<td>
|
||||
<checkbox name="followPort"></checkbox>
|
||||
<p class="comment">选中后表示源站的端口保持和用户访问的服务端口保持一致;此时的源站地址中的端口号可以任意填写。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
@@ -4,8 +4,14 @@ Tea.context(function () {
|
||||
|
||||
this.addrError = ""
|
||||
|
||||
// 当前服务协议
|
||||
this.isHTTP = (this.serverType == "httpProxy" || this.serverType == "httpWeb")
|
||||
if (this.serverType == "httpProxy") {
|
||||
this.protocol = "http"
|
||||
} else if (this.serverType == "tcpProxy") {
|
||||
this.protocol = "tcp"
|
||||
} else if (this.serverType == "udpProxy") {
|
||||
this.protocol = "udp"
|
||||
}
|
||||
|
||||
this.changeProtocol = function () {
|
||||
|
||||
@@ -45,6 +45,7 @@ Tea.context(function () {
|
||||
|
||||
this.addOrigin = function () {
|
||||
teaweb.popup("/servers/addOriginPopup?serverType=" + this.serverType, {
|
||||
height: "27em",
|
||||
callback: function (resp) {
|
||||
this.origins.push(resp.data.origin);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ Tea.context(function () {
|
||||
this.success = NotifyReloadSuccess("保存成功")
|
||||
|
||||
this.updateOn = function (b) {
|
||||
teaweb.confirm(b ? "确定要启用反向代理服务吗?" : "确定要停用反向代理服务吗?", function () {
|
||||
teaweb.confirm(b ? "确定要启用源站吗?" : "确定要停用源站服务吗?", function () {
|
||||
this.$post(".updateOn")
|
||||
.params({
|
||||
"serverId": this.serverId,
|
||||
|
||||
@@ -59,6 +59,13 @@
|
||||
<p class="comment">默认不需要填写,表示支持所有域名。如果填写了专属域名,表示这些源站只会在所列的专属域名被访问时才生效。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>端口跟随</td>
|
||||
<td>
|
||||
<checkbox name="followPort"></checkbox>
|
||||
<p class="comment">选中后表示源站的端口保持和用户访问的服务端口保持一致;此时的源站地址中的端口号可以任意填写。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>权重</td>
|
||||
<td>
|
||||
|
||||
@@ -60,6 +60,13 @@
|
||||
<p class="comment">默认不需要填写,表示支持所有域名。如果填写了专属域名,表示这些源站只会在所列的专属域名被访问时才生效。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>端口跟随</td>
|
||||
<td>
|
||||
<checkbox name="followPort" v-model="origin.followPort"></checkbox>
|
||||
<p class="comment">选中后表示源站的端口保持和用户访问的服务端口保持一致;此时的源站地址中的端口号可以任意填写。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>权重</td>
|
||||
<td>
|
||||
|
||||
Reference in New Issue
Block a user