mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-03-14 01:34:47 +08:00
fix: 防火墙端口校验规则修改 (#560)
This commit is contained in:
parent
47d090d481
commit
2bd289defa
@ -168,6 +168,9 @@ export function checkIp(value: string): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function checkPort(value: string): boolean {
|
export function checkPort(value: string): boolean {
|
||||||
|
if (Number(value) <= 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
const reg = /^([0-9]|[1-9]\d{1,3}|[1-5]\d{4}|6[0-5]{2}[0-3][0-5])$/;
|
const reg = /^([0-9]|[1-9]\d{1,3}|[1-5]\d{4}|6[0-5]{2}[0-3][0-5])$/;
|
||||||
if (!reg.test(value) && value !== '') {
|
if (!reg.test(value) && value !== '') {
|
||||||
return true;
|
return true;
|
||||||
|
@ -123,9 +123,12 @@ const onSubmit = async (formEl: FormInstance | undefined) => {
|
|||||||
dialogData.value.rowData.address = '';
|
dialogData.value.rowData.address = '';
|
||||||
}
|
}
|
||||||
let ports = [];
|
let ports = [];
|
||||||
if (dialogData.value.rowData.port.indexOf('-') !== -1) {
|
if (dialogData.value.rowData.port.indexOf('-') !== -1 && !dialogData.value.rowData.port.startsWith('-')) {
|
||||||
ports = dialogData.value.rowData.port.split('-');
|
ports = dialogData.value.rowData.port.split('-');
|
||||||
} else if (dialogData.value.rowData.port.indexOf(',') !== -1) {
|
} else if (
|
||||||
|
dialogData.value.rowData.port.indexOf(',') !== -1 &&
|
||||||
|
!dialogData.value.rowData.port.startsWith(',')
|
||||||
|
) {
|
||||||
ports = dialogData.value.rowData.port.split(',');
|
ports = dialogData.value.rowData.port.split(',');
|
||||||
} else {
|
} else {
|
||||||
ports.push(dialogData.value.rowData.port);
|
ports.push(dialogData.value.rowData.port);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user