mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 13:10:26 +08:00 
			
		
		
		
	提交components.js
This commit is contained in:
		
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -5725,6 +5725,8 @@ Vue.component("http-firewall-config-box", {
 | 
			
		||||
						<option value="none">默认</option>
 | 
			
		||||
						<option v-for="captchaType in captchaTypes" :value="captchaType.code">{{captchaType.name}}</option>
 | 
			
		||||
					</select>
 | 
			
		||||
					<p class="comment" v-if="firewall.defaultCaptchaType == 'none'">使用系统默认的设置。</p>
 | 
			
		||||
					<p class="comment" v-for="captchaType in captchaTypes" v-if="captchaType.code == firewall.defaultCaptchaType">{{captchaType.description}}</p>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			<tr>
 | 
			
		||||
@@ -8924,6 +8926,9 @@ Vue.component("http-firewall-actions-box", {
 | 
			
		||||
			this.editingIndex = index
 | 
			
		||||
 | 
			
		||||
			this.actionCode = config.code
 | 
			
		||||
			this.action = this.actions.$find(function (k, v) {
 | 
			
		||||
				return v.code == config.code
 | 
			
		||||
			})
 | 
			
		||||
 | 
			
		||||
			switch (config.code) {
 | 
			
		||||
				case "block":
 | 
			
		||||
@@ -12155,7 +12160,8 @@ Vue.component("reverse-proxy-box", {
 | 
			
		||||
				maxConns: 0,
 | 
			
		||||
				maxIdleConns: 0,
 | 
			
		||||
				followRedirects: false,
 | 
			
		||||
				retry50X: true
 | 
			
		||||
				retry50X: false,
 | 
			
		||||
				retry40X: false
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if (reverseProxyConfig.addHeaders == null) {
 | 
			
		||||
@@ -12365,6 +12371,38 @@ Vue.component("reverse-proxy-box", {
 | 
			
		||||
					<p class="comment">开启后将自动刷新缓冲区数据到客户端,在类似于SSE(server-sent events)等场景下很有用。</p>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			<tr v-show="family == null || family == 'http'">
 | 
			
		||||
            	<td>自动重试50X</td>
 | 
			
		||||
            	<td>
 | 
			
		||||
            		<checkbox v-model="reverseProxyConfig.retry50X"></checkbox>
 | 
			
		||||
            		<p class="comment">选中后,表示当源站返回状态码为50X(比如502、504等)时,自动重试其他源站。</p>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			<tr v-show="family == null || family == 'http'">
 | 
			
		||||
            	<td>自动重试40X</td>
 | 
			
		||||
            	<td>
 | 
			
		||||
            		<checkbox v-model="reverseProxyConfig.retry40X"></checkbox>
 | 
			
		||||
            		<p class="comment">选中后,表示当源站返回状态码为40X(403或404)时,自动重试其他源站。</p>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
            <tr v-show="family != 'unix'">
 | 
			
		||||
            	<td>PROXY Protocol</td>
 | 
			
		||||
            	<td>
 | 
			
		||||
            		<checkbox name="proxyProtocolIsOn" v-model="reverseProxyConfig.proxyProtocol.isOn"></checkbox>
 | 
			
		||||
            		<p class="comment">选中后表示启用PROXY Protocol,每次连接源站时都会在头部写入客户端地址信息。</p>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			<tr v-show="family != 'unix' && reverseProxyConfig.proxyProtocol.isOn">
 | 
			
		||||
				<td>PROXY Protocol版本</td>
 | 
			
		||||
				<td>
 | 
			
		||||
					<select class="ui dropdown auto-width" name="proxyProtocolVersion" v-model="reverseProxyConfig.proxyProtocol.version">
 | 
			
		||||
						<option value="1">1</option>
 | 
			
		||||
						<option value="2">2</option>
 | 
			
		||||
					</select>
 | 
			
		||||
					<p class="comment" v-if="reverseProxyConfig.proxyProtocol.version == 1">发送类似于<code-label>PROXY TCP4 192.168.1.1 192.168.1.10 32567 443</code-label>的头部信息。</p>
 | 
			
		||||
					<p class="comment" v-if="reverseProxyConfig.proxyProtocol.version == 2">发送二进制格式的头部信息。</p>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			<tr v-if="family == null || family == 'http'">
 | 
			
		||||
                <td class="color-border">源站连接失败超时时间</td>
 | 
			
		||||
                <td>
 | 
			
		||||
@@ -12429,31 +12467,6 @@ Vue.component("reverse-proxy-box", {
 | 
			
		||||
                    <p class="comment">源站保持等待的空闲超时时间,0表示使用默认时间。</p>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr v-show="family == null || family == 'http'">
 | 
			
		||||
            	<td>自动重试50X</td>
 | 
			
		||||
            	<td>
 | 
			
		||||
            		<checkbox v-model="reverseProxyConfig.retry50X"></checkbox>
 | 
			
		||||
            		<p class="comment">选中后,表示当源站返回状态码为50X(比如502、504)时,自动重试。</p>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
            <tr v-show="family != 'unix'">
 | 
			
		||||
            	<td>PROXY Protocol</td>
 | 
			
		||||
            	<td>
 | 
			
		||||
            		<checkbox name="proxyProtocolIsOn" v-model="reverseProxyConfig.proxyProtocol.isOn"></checkbox>
 | 
			
		||||
            		<p class="comment">选中后表示启用PROXY Protocol,每次连接源站时都会在头部写入客户端地址信息。</p>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			<tr v-show="family != 'unix' && reverseProxyConfig.proxyProtocol.isOn">
 | 
			
		||||
				<td>PROXY Protocol版本</td>
 | 
			
		||||
				<td>
 | 
			
		||||
					<select class="ui dropdown auto-width" name="proxyProtocolVersion" v-model="reverseProxyConfig.proxyProtocol.version">
 | 
			
		||||
						<option value="1">1</option>
 | 
			
		||||
						<option value="2">2</option>
 | 
			
		||||
					</select>
 | 
			
		||||
					<p class="comment" v-if="reverseProxyConfig.proxyProtocol.version == 1">发送类似于<code-label>PROXY TCP4 192.168.1.1 192.168.1.10 32567 443</code-label>的头部信息。</p>
 | 
			
		||||
					<p class="comment" v-if="reverseProxyConfig.proxyProtocol.version == 2">发送二进制格式的头部信息。</p>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
		</tbody>
 | 
			
		||||
	</table>
 | 
			
		||||
	<div class="margin"></div>
 | 
			
		||||
@@ -16128,6 +16141,101 @@ Vue.component("ip-box", {
 | 
			
		||||
	template: `<span @click.prevent="popup()" ref="container"><slot></slot></span>`
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
Vue.component("sms-sender", {
 | 
			
		||||
	props: ["value", "name"],
 | 
			
		||||
	mounted: function () {
 | 
			
		||||
		this.initType(this.config.type)
 | 
			
		||||
	},
 | 
			
		||||
	data: function () {
 | 
			
		||||
		let value = this.value
 | 
			
		||||
		if (value == null) {
 | 
			
		||||
			value = {
 | 
			
		||||
				isOn: false,
 | 
			
		||||
				type: "webHook",
 | 
			
		||||
				webHookParams: {
 | 
			
		||||
					url: "",
 | 
			
		||||
					method: "POST"
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return {
 | 
			
		||||
			config: value
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	watch: {
 | 
			
		||||
		"config.type": function (v) {
 | 
			
		||||
			this.initType(v)
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		initType: function (v) {
 | 
			
		||||
			// initialize params
 | 
			
		||||
			switch (v) {
 | 
			
		||||
				case "webHook":
 | 
			
		||||
					if (this.config.webHookParams == null) {
 | 
			
		||||
						this.config.webHookParams = {
 | 
			
		||||
							url: "",
 | 
			
		||||
							method: "POST"
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
					break
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		test: function () {
 | 
			
		||||
			window.TESTING_SMS_CONFIG = this.config
 | 
			
		||||
			teaweb.popup("/users/setting/smsTest", {
 | 
			
		||||
				height: "22em"
 | 
			
		||||
			})
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	template: `<div>
 | 
			
		||||
	<input type="hidden" :name="name" :value="JSON.stringify(config)"/>
 | 
			
		||||
	<table class="ui table selectable definition">
 | 
			
		||||
		<tbody>
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td class="title">启用</td>
 | 
			
		||||
				<td><checkbox v-model="config.isOn"></checkbox></td>
 | 
			
		||||
			</tr>
 | 
			
		||||
		</tbody>
 | 
			
		||||
		<tbody v-show="config.isOn">
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td>发送渠道</td>
 | 
			
		||||
				<td>
 | 
			
		||||
					<select class="ui dropdown auto-width" v-model="config.type">
 | 
			
		||||
						<option value="webHook">WebHook</option>
 | 
			
		||||
					</select>
 | 
			
		||||
					<p class="comment" v-if="config.type">通过WebHook的方式调用你的自定义发送短信接口。</p>
 | 
			
		||||
				</td>				
 | 
			
		||||
			</tr>
 | 
			
		||||
			<tr v-if="config.type == 'webHook' && config.webHookParams != null">
 | 
			
		||||
				<td class="color-border">WebHook URL地址 *</td>
 | 
			
		||||
				<td>
 | 
			
		||||
					<input type="text" maxlength="100" placeholder="https://..." v-model="config.webHookParams.url"/>
 | 
			
		||||
					<p class="comment">接收发送短信请求的URL,必须以<code-label>http://</code-label>或<code-label>https://</code-label>开头。</p>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			<tr v-if="config.type == 'webHook' && config.webHookParams != null">
 | 
			
		||||
				<td class="color-border">WebHook请求方法</td>
 | 
			
		||||
				<td>
 | 
			
		||||
					<select class="ui dropdown auto-width" v-model="config.webHookParams.method">
 | 
			
		||||
						<option value="GET">GET</option>
 | 
			
		||||
						<option value="POST">POST</option>
 | 
			
		||||
					</select>
 | 
			
		||||
					<p class="comment" v-if="config.webHookParams.method == 'GET'">以在URL参数中加入mobile、body和code三个参数(<code-label>YOUR_WEB_HOOK_URL?mobile=手机号&body=短信内容&code=验证码</code-label>)的方式调用你的WebHook URL地址;状态码返回200表示成功。</p>
 | 
			
		||||
					<p class="comment" v-if="config.webHookParams.method == 'POST'">通过POST表单发送mobile、body和code三个参数(<code-label>mobile=手机号&body=短信内容&code=验证码</code-label>)的方式调用你的WebHook URL地址;状态码返回200表示成功。</p>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td>发送测试</td>
 | 
			
		||||
				<td><a href="" @click.prevent="test">[点此测试]</a></td>
 | 
			
		||||
			</tr>
 | 
			
		||||
		</tbody>
 | 
			
		||||
	</table>
 | 
			
		||||
	<div class="margin"></div>
 | 
			
		||||
</div>`
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
Vue.component("email-sender", {
 | 
			
		||||
	props: ["value", "name"],
 | 
			
		||||
	data: function () {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user