File tree Expand file tree Collapse file tree 3 files changed +27
-2
lines changed
views/website/website/config Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -208,6 +208,18 @@ export function checkDomain(value: string): boolean {
208208 }
209209}
210210
211+ export function isDomain ( value : string ) : boolean {
212+ if ( value === '' ) {
213+ return true ;
214+ }
215+ const reg = / ^ (?: [ a - z 0 - 9 ] (?: [ a - z 0 - 9 - ] { 0 , 61 } [ a - z 0 - 9 ] ) ? \. ) + [ a - z 0 - 9 ] [ a - z 0 - 9 - ] { 0 , 61 } [ a - z 0 - 9 ] $ / i;
216+ if ( value !== '' && reg . test ( value ) ) {
217+ return true ;
218+ } else {
219+ return false ;
220+ }
221+ }
222+
211223export function checkIpV4V6 ( value : string ) : boolean {
212224 if ( value === '' ) {
213225 return true ;
Original file line number Diff line number Diff line change 3838 <el-row :gutter =" 10" >
3939 <el-col :span =" 12" >
4040 <el-form-item :label =" $t('website.proxyPass')" prop =" proxyPass" >
41- <el-input v-model.trim =" proxy.proxyAddress" :placeholder =" $t('website.proxyHelper')" >
41+ <el-input
42+ v-model.trim =" proxy.proxyAddress"
43+ :placeholder =" $t('website.proxyHelper')"
44+ @blur =" getProxyHost"
45+ >
4246 <template #prepend >
4347 <el-select v-model =" proxy.proxyProtocol" class =" pre-select" >
4448 <el-option label =" http" value =" http://" />
@@ -116,6 +120,7 @@ import { ref } from 'vue';
116120import { MsgError , MsgSuccess } from ' @/utils/message' ;
117121import { Website } from ' @/api/interface/website' ;
118122import { Units } from ' @/global/mimetype' ;
123+ import { isDomain } from ' @/utils/util' ;
119124
120125const proxyForm = ref <FormInstance >();
121126const rules = ref ({
@@ -193,6 +198,14 @@ const removeReplace = (index: number) => {
193198 replaces .value .splice (index , 1 );
194199};
195200
201+ const getProxyHost = () => {
202+ if (isDomain (proxy .value .proxyAddress )) {
203+ proxy .value .proxyHost = proxy .value .proxyAddress ;
204+ } else {
205+ proxy .value .proxyHost = ' $host' ;
206+ }
207+ };
208+
196209const submit = async (formEl : FormInstance | undefined ) => {
197210 if (! formEl ) return ;
198211 await formEl .validate ((valid ) => {
Original file line number Diff line number Diff line change 22 <el-row >
33 <el-col :xs =" 24" :sm =" 18" :md =" 14" :lg =" 14" :xl =" 14" >
44 <el-form >
5- <el-form-item prop =" enable" :label =" $t('website.enable')" >
5+ <el-form-item prop =" enable" :label =" $t('website.enable')" v-if = " rule != 'user_agent' " >
66 <el-switch v-model =" enableUpdate.enable" @change =" updateEnable" ></el-switch >
77 </el-form-item >
88 <el-form-item :label =" $t('website.data')" >
You can’t perform that action at this time.
0 commit comments