mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 14:08:06 +08:00
fix: 解决反代域名失败的问题 (#2821)
This commit is contained in:
parent
ce38ae2544
commit
8d9b21e4a2
@ -208,6 +208,18 @@ export function checkDomain(value: string): boolean {
|
||||
}
|
||||
}
|
||||
|
||||
export function isDomain(value: string): boolean {
|
||||
if (value === '') {
|
||||
return true;
|
||||
}
|
||||
const reg = /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$/i;
|
||||
if (value !== '' && reg.test(value)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function checkIpV4V6(value: string): boolean {
|
||||
if (value === '') {
|
||||
return true;
|
||||
|
@ -38,7 +38,11 @@
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('website.proxyPass')" prop="proxyPass">
|
||||
<el-input v-model.trim="proxy.proxyAddress" :placeholder="$t('website.proxyHelper')">
|
||||
<el-input
|
||||
v-model.trim="proxy.proxyAddress"
|
||||
:placeholder="$t('website.proxyHelper')"
|
||||
@blur="getProxyHost"
|
||||
>
|
||||
<template #prepend>
|
||||
<el-select v-model="proxy.proxyProtocol" class="pre-select">
|
||||
<el-option label="http" value="http://" />
|
||||
@ -116,6 +120,7 @@ import { ref } from 'vue';
|
||||
import { MsgError, MsgSuccess } from '@/utils/message';
|
||||
import { Website } from '@/api/interface/website';
|
||||
import { Units } from '@/global/mimetype';
|
||||
import { isDomain } from '@/utils/util';
|
||||
|
||||
const proxyForm = ref<FormInstance>();
|
||||
const rules = ref({
|
||||
@ -193,6 +198,14 @@ const removeReplace = (index: number) => {
|
||||
replaces.value.splice(index, 1);
|
||||
};
|
||||
|
||||
const getProxyHost = () => {
|
||||
if (isDomain(proxy.value.proxyAddress)) {
|
||||
proxy.value.proxyHost = proxy.value.proxyAddress;
|
||||
} else {
|
||||
proxy.value.proxyHost = '$host';
|
||||
}
|
||||
};
|
||||
|
||||
const submit = async (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return;
|
||||
await formEl.validate((valid) => {
|
||||
|
@ -2,7 +2,7 @@
|
||||
<el-row>
|
||||
<el-col :xs="24" :sm="18" :md="14" :lg="14" :xl="14">
|
||||
<el-form>
|
||||
<el-form-item prop="enable" :label="$t('website.enable')">
|
||||
<el-form-item prop="enable" :label="$t('website.enable')" v-if="rule != 'user_agent'">
|
||||
<el-switch v-model="enableUpdate.enable" @change="updateEnable"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.data')">
|
||||
|
Loading…
x
Reference in New Issue
Block a user