feat: 白名单
parent
8b0f2d0f5d
commit
53f199a4a9
|
@ -39,8 +39,10 @@
|
||||||
<div>开启此项之后,被代理应用关闭SSL校验也问题不大了</div>
|
<div>开启此项之后,被代理应用关闭SSL校验也问题不大了</div>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="根证书:" :label-col="labelCol" :wrapper-col="wrapperCol">
|
<a-form-item label="根证书:" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||||
<a-input-search addon-before="Cert" enter-button="选择" @search="onCrtSelect" v-model="config.server.setting.rootCaFile.certPath" />
|
<a-input-search addon-before="Cert" enter-button="选择" @search="onCrtSelect"
|
||||||
<a-input-search addon-before="Key" enter-button="选择" @search="onKeySelect" v-model="config.server.setting.rootCaFile.keyPath" />
|
v-model="config.server.setting.rootCaFile.certPath"/>
|
||||||
|
<a-input-search addon-before="Key" enter-button="选择" @search="onKeySelect"
|
||||||
|
v-model="config.server.setting.rootCaFile.keyPath"/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="启用拦截" :label-col="labelCol" :wrapper-col="wrapperCol">
|
<a-form-item label="启用拦截" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||||
<a-tooltip title="关闭拦截,且关闭功能增强的话,就不需要安装根证书,本应用退化为dns优选,最安全">
|
<a-tooltip title="关闭拦截,且关闭功能增强的话,就不需要安装根证书,本应用退化为dns优选,最安全">
|
||||||
|
@ -58,9 +60,29 @@
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane tab="拦截设置" key="2">
|
<a-tab-pane tab="拦截设置" key="2">
|
||||||
<vue-json-editor style="height:100%;" ref="editor" v-model="config.server.intercepts" mode="code" :show-btns="false" :expandedOnStart="true" @json-change="onJsonChange" ></vue-json-editor>
|
<vue-json-editor style="height:100%;" ref="editor" v-model="config.server.intercepts" mode="code"
|
||||||
|
:show-btns="false" :expandedOnStart="true" @json-change="onJsonChange"></vue-json-editor>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane tab="DNS设置" key="3">
|
<a-tab-pane tab="域名白名单" key="3">
|
||||||
|
<a-row style="margin-top:10px">
|
||||||
|
<a-col span="19">
|
||||||
|
<div>这里配置哪些域名不需要通过代理</div>
|
||||||
|
</a-col>
|
||||||
|
<a-col span="3">
|
||||||
|
<a-button style="margin-left:8px" type="primary" icon="plus" @click="addWhiteList()"/>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
<a-row :gutter="10" style="margin-top: 10px" v-for="(item,index) of whiteList" :key='index'>
|
||||||
|
<a-col :span="14">
|
||||||
|
<a-input :disabled="item.value ===false" v-model="item.key"></a-input>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="3">
|
||||||
|
<a-button v-if="item.value!==false" type="danger" icon="minus" @click="deleteWhiteList(item,index)"/>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
|
||||||
|
</a-tab-pane>
|
||||||
|
<a-tab-pane tab="DNS设置" key="4">
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<a-row style="margin-top:10px">
|
<a-row style="margin-top:10px">
|
||||||
|
@ -77,18 +99,21 @@
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="5">
|
<a-col :span="5">
|
||||||
<a-select :disabled="item.value ===false" v-model="item.value" style="width: 100%">
|
<a-select :disabled="item.value ===false" v-model="item.value" style="width: 100%">
|
||||||
<a-select-option v-for="(item) of speedDnsOptions" :key="item.value" :value="item.value">{{item.value}}</a-select-option>
|
<a-select-option v-for="(item) of speedDnsOptions" :key="item.value" :value="item.value">
|
||||||
|
{{ item.value }}
|
||||||
|
</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="3">
|
<a-col :span="3">
|
||||||
<a-button v-if="item.value!==false" type="danger" icon="minus" @click="deleteDnsMapping(item,index)"/>
|
<a-button v-if="item.value!==false" type="danger" icon="minus" @click="deleteDnsMapping(item,index)"/>
|
||||||
<a-button v-if="item.value===false" type="primary" icon="checked" @click="restoreDefDnsMapping(item,index)" ></a-button>
|
<a-button v-if="item.value===false" type="primary" icon="checked"
|
||||||
|
@click="restoreDefDnsMapping(item,index)"></a-button>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane tab="IP测速" key="4">
|
<a-tab-pane tab="IP测速" key="5">
|
||||||
<div>
|
<div>
|
||||||
<a-alert type="info" message="对从dns获取到的ip进行测速,使用速度最快的ip进行访问。(对使用增强功能的域名没啥用)"></a-alert>
|
<a-alert type="info" message="对从dns获取到的ip进行测速,使用速度最快的ip进行访问。(对使用增强功能的域名没啥用)"></a-alert>
|
||||||
<a-form-item label="开启dns测速" :label-col="labelCol" :wrapper-col="wrapperCol">
|
<a-form-item label="开启dns测速" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||||
|
@ -97,7 +122,8 @@
|
||||||
</a-checkbox>
|
</a-checkbox>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="自动测试间隔" :label-col="labelCol" :wrapper-col="wrapperCol">
|
<a-form-item label="自动测试间隔" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||||
<a-input-number id="inputNumber" v-model="getSpeedTestConfig().interval" :step="1000" :min="1" /> ms
|
<a-input-number id="inputNumber" v-model="getSpeedTestConfig().interval" :step="1000" :min="1"/>
|
||||||
|
ms
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<div>使用以下dns获取ip进行测速</div>
|
<div>使用以下dns获取ip进行测速</div>
|
||||||
<a-row style="margin-top:10px">
|
<a-row style="margin-top:10px">
|
||||||
|
@ -116,7 +142,8 @@
|
||||||
<a-button style="margin-left:10px" type="primary" icon="plus" @click="addSpeedHostname()"/>
|
<a-button style="margin-left:10px" type="primary" icon="plus" @click="addSpeedHostname()"/>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
<a-row :gutter="10" style="margin-top: 10px" v-for="(item,index) of getSpeedTestConfig().hostnameList" :key = 'index'>
|
<a-row :gutter="10" style="margin-top: 10px" v-for="(item,index) of getSpeedTestConfig().hostnameList"
|
||||||
|
:key='index'>
|
||||||
<a-col :span="21">
|
<a-col :span="21">
|
||||||
<a-input v-model="getSpeedTestConfig().hostnameList[index]"/>
|
<a-input v-model="getSpeedTestConfig().hostnameList[index]"/>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
@ -140,7 +167,10 @@
|
||||||
<a-icon v-if="item.alive.length>0" type="check"/>
|
<a-icon v-if="item.alive.length>0" type="check"/>
|
||||||
<a-icon v-else type="info-circle"/>
|
<a-icon v-else type="info-circle"/>
|
||||||
</a>
|
</a>
|
||||||
<a-tag style="margin:2px;" v-for="(element,index) of item.backupList" :color="element.time?'green':'red'" :key = 'index'>{{element.host}} {{element.time}}{{element.time?'ms':''}}</a-tag>
|
<a-tag style="margin:2px;" v-for="(element,index) of item.backupList"
|
||||||
|
:color="element.time?'green':'red'" :key='index'>{{ element.host }}
|
||||||
|
{{ element.time }}{{ element.time ? 'ms' : '' }}
|
||||||
|
</a-tag>
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
@ -163,6 +193,7 @@
|
||||||
import vueJsonEditor from 'vue-json-editor'
|
import vueJsonEditor from 'vue-json-editor'
|
||||||
import Plugin from '../mixins/plugin'
|
import Plugin from '../mixins/plugin'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Server',
|
name: 'Server',
|
||||||
components: {
|
components: {
|
||||||
|
@ -175,7 +206,8 @@ export default {
|
||||||
labelCol: { span: 4 },
|
labelCol: { span: 4 },
|
||||||
wrapperCol: { span: 20 },
|
wrapperCol: { span: 20 },
|
||||||
dnsMappings: [],
|
dnsMappings: [],
|
||||||
speedTestList: []
|
speedTestList: [],
|
||||||
|
whiteList: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
|
@ -215,6 +247,23 @@ export default {
|
||||||
onJsonChange (json) {
|
onJsonChange (json) {
|
||||||
},
|
},
|
||||||
ready () {
|
ready () {
|
||||||
|
this.initDnsMapping()
|
||||||
|
this.initWhiteList()
|
||||||
|
if (this.config.server.dns.speedTest.dnsProviders) {
|
||||||
|
this.speedDns = this.config.server.dns.speedTest.dnsProviders
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async applyBefore () {
|
||||||
|
this.submitDnsMapping()
|
||||||
|
this.submitWhiteList()
|
||||||
|
},
|
||||||
|
async applyAfter () {
|
||||||
|
if (this.status.server.enabled) {
|
||||||
|
return this.$api.server.restart()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// dnsMapping
|
||||||
|
initDnsMapping () {
|
||||||
this.dnsMappings = []
|
this.dnsMappings = []
|
||||||
for (const key in this.config.server.dns.mapping) {
|
for (const key in this.config.server.dns.mapping) {
|
||||||
const value = this.config.server.dns.mapping[key]
|
const value = this.config.server.dns.mapping[key]
|
||||||
|
@ -222,11 +271,8 @@ export default {
|
||||||
key, value
|
key, value
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (this.config.server.dns.speedTest.dnsProviders) {
|
|
||||||
this.speedDns = this.config.server.dns.speedTest.dnsProviders
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
async applyBefore () {
|
submitDnsMapping () {
|
||||||
const dnsMapping = {}
|
const dnsMapping = {}
|
||||||
for (const item of this.dnsMappings) {
|
for (const item of this.dnsMappings) {
|
||||||
if (item.key) {
|
if (item.key) {
|
||||||
|
@ -235,11 +281,6 @@ export default {
|
||||||
}
|
}
|
||||||
this.config.server.dns.mapping = dnsMapping
|
this.config.server.dns.mapping = dnsMapping
|
||||||
},
|
},
|
||||||
async applyAfter () {
|
|
||||||
if (this.status.server.enabled) {
|
|
||||||
return this.$api.server.restart()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
deleteDnsMapping (item, index) {
|
deleteDnsMapping (item, index) {
|
||||||
this.dnsMappings.splice(index, 1)
|
this.dnsMappings.splice(index, 1)
|
||||||
},
|
},
|
||||||
|
@ -249,6 +290,36 @@ export default {
|
||||||
addDnsMapping () {
|
addDnsMapping () {
|
||||||
this.dnsMappings.unshift({ key: '', value: 'usa' })
|
this.dnsMappings.unshift({ key: '', value: 'usa' })
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// whiteList
|
||||||
|
initWhiteList () {
|
||||||
|
this.whiteList = []
|
||||||
|
for (const key in this.config.server.whiteList) {
|
||||||
|
const value = this.config.server.whiteList[key]
|
||||||
|
this.whiteList.push({
|
||||||
|
key, value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
submitWhiteList () {
|
||||||
|
const whiteList = {}
|
||||||
|
for (const item of this.whiteList) {
|
||||||
|
if (item.key) {
|
||||||
|
whiteList[item.key] = item.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.config.server.whiteList = whiteList
|
||||||
|
},
|
||||||
|
deleteWhiteList (item, index) {
|
||||||
|
this.whiteList.splice(index, 1)
|
||||||
|
},
|
||||||
|
restoreDefWhiteList (item, index) {
|
||||||
|
|
||||||
|
},
|
||||||
|
addWhiteList () {
|
||||||
|
this.whiteList.unshift({ key: '', value: true })
|
||||||
|
},
|
||||||
|
|
||||||
async openLog () {
|
async openLog () {
|
||||||
const dir = await this.$api.info.getConfigDir()
|
const dir = await this.$api.info.getConfigDir()
|
||||||
this.$api.ipc.openPath(dir + '/logs/')
|
this.$api.ipc.openPath(dir + '/logs/')
|
||||||
|
@ -308,12 +379,15 @@ export default {
|
||||||
.jsoneditor-vue {
|
.jsoneditor-vue {
|
||||||
height: 100%
|
height: 100%
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-tabs {
|
.ant-tabs {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-tabs-content {
|
.ant-tabs-content {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-tabs-tabpane-active {
|
.ant-tabs-tabpane-active {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|
Loading…
Reference in New Issue