mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-09 01:36:57 +08:00
perf: Multiple Domain Validation for Embedded Systems #388
This commit is contained in:
committed by
fit2cloud-chenyw
parent
a5ba14275e
commit
c7693fc880
@@ -573,7 +573,9 @@
|
||||
"creating_advanced_applications": "Creating Advanced Applications",
|
||||
"configure_interface": "Configure interface",
|
||||
"interface_url": "Interface URL",
|
||||
"format_is_incorrect": "format is incorrect",
|
||||
"format_is_incorrect": "format is incorrect{msg}",
|
||||
"domain_format_incorrect": ",start with http/https, no trailing slash (/), multiple domains separated by half-width commas (,)",
|
||||
"interface_url_incorrect": ",enter a relative path starting with /",
|
||||
"aes_enable": "Enable AES encryption",
|
||||
"aes_enable_tips": "The fields (host, user, password, dataBase, schema) are all encrypted using the AES-CBC-PKCS5Padding encryption method",
|
||||
"bit": "bit",
|
||||
|
||||
@@ -572,7 +572,9 @@
|
||||
"private": "비공개",
|
||||
"configure_interface": "인터페이스 설정",
|
||||
"interface_url": "인터페이스 URL",
|
||||
"format_is_incorrect": "형식이 올바르지 않습니다",
|
||||
"format_is_incorrect": "형식이 올바르지 않습니다{msg}",
|
||||
"domain_format_incorrect": ", http/https로 시작, 슬래시(/)로 끝나지 않음, 여러 도메인은 반각 쉼표(,)로 구분",
|
||||
"interface_url_incorrect": ", 상대 경로를 입력해주세요. /로 시작합니다",
|
||||
"aes_enable": "AES 암호화 활성화",
|
||||
"aes_enable_tips": "암호화 필드 (host, user, password, dataBase, schema)는 모두 AES-CBC-PKCS5Padding 암호화 방식을 사용합니다",
|
||||
"bit": "비트",
|
||||
|
||||
@@ -572,7 +572,9 @@
|
||||
"private": "私有",
|
||||
"configure_interface": "配置接口",
|
||||
"interface_url": "接口 URL",
|
||||
"format_is_incorrect": "格式不对",
|
||||
"format_is_incorrect": "格式不对{msg}",
|
||||
"domain_format_incorrect": ",http或https开头,不能以 / 结尾,多个域名以逗号(半角)分隔",
|
||||
"interface_url_incorrect": ",请填写相对路径,以/开头",
|
||||
"aes_enable": "开启 AES 加密",
|
||||
"aes_enable_tips": "加密字段 (host, user, password, dataBase, schema) 均采用 AES-CBC-PKCS5Padding 加密方式",
|
||||
"bit": "位",
|
||||
|
||||
@@ -209,13 +209,20 @@ const validateUrl = (_: any, value: any, callback: any) => {
|
||||
)
|
||||
} else {
|
||||
// var Expression = /(https?:\/\/)?([\da-z\.-]+)\.([a-z]{2,6})(:\d{1,5})?([\/\w\.-]*)*\/?(#[\S]+)?/ // eslint-disable-line
|
||||
var Expression = /^https?:\/\/[^\s/?#]+(:\d+)?/i
|
||||
var objExp = new RegExp(Expression)
|
||||
if (objExp.test(value) && !value.endsWith('/')) {
|
||||
callback()
|
||||
} else {
|
||||
callback(t('embedded.format_is_incorrect'))
|
||||
}
|
||||
value
|
||||
.trim()
|
||||
.split(',')
|
||||
.forEach((tempVal: string) => {
|
||||
var Expression = /^https?:\/\/[^\s/?#]+(:\d+)?/i
|
||||
var objExp = new RegExp(Expression)
|
||||
if (objExp.test(tempVal) && !tempVal.endsWith('/')) {
|
||||
callback()
|
||||
} else {
|
||||
callback(
|
||||
t('embedded.format_is_incorrect', { msg: t('embedded.domain_format_incorrect') })
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
const rules = {
|
||||
|
||||
@@ -157,7 +157,16 @@ const handleBaseEmbedded = (row: any) => {
|
||||
const handleAdvancedEmbedded = (row: any) => {
|
||||
advancedApplication.value = true
|
||||
if (row) {
|
||||
Object.assign(urlForm, cloneDeep(JSON.parse(row.configuration)))
|
||||
const tempData = cloneDeep(JSON.parse(row.configuration))
|
||||
if (tempData?.endpoint.startsWith('http')) {
|
||||
row.domain
|
||||
.trim()
|
||||
.split(',')
|
||||
.forEach((domain: string) => {
|
||||
tempData.endpoint = tempData.endpoint.replace(domain, '')
|
||||
})
|
||||
}
|
||||
Object.assign(urlForm, tempData)
|
||||
}
|
||||
ruleConfigvVisible.value = true
|
||||
dialogTitle.value = row?.id
|
||||
@@ -265,13 +274,20 @@ const validateUrl = (_: any, value: any, callback: any) => {
|
||||
)
|
||||
} else {
|
||||
// var Expression = /(https?:\/\/)?([\da-z\.-]+)\.([a-z]{2,6})(:\d{1,5})?([\/\w\.-]*)*\/?(#[\S]+)?/ // eslint-disable-line
|
||||
var Expression = /^https?:\/\/[^\s/?#]+(:\d+)?/i
|
||||
var objExp = new RegExp(Expression)
|
||||
if (objExp.test(value) && !value.endsWith('/')) {
|
||||
callback()
|
||||
} else {
|
||||
callback(t('embedded.format_is_incorrect'))
|
||||
}
|
||||
value
|
||||
.trim()
|
||||
.split(',')
|
||||
.forEach((tempVal: string) => {
|
||||
var Expression = /^https?:\/\/[^\s/?#]+(:\d+)?/i
|
||||
var objExp = new RegExp(Expression)
|
||||
if (objExp.test(tempVal) && !tempVal.endsWith('/')) {
|
||||
callback()
|
||||
} else {
|
||||
callback(
|
||||
t('embedded.format_is_incorrect', { msg: t('embedded.domain_format_incorrect') })
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
const rules = {
|
||||
@@ -307,12 +323,13 @@ const validatePass = (_: any, value: any, callback: any) => {
|
||||
)
|
||||
} else {
|
||||
// var Expression = /(https?:\/\/)?([\da-z\.-]+)\.([a-z]{2,6})(:\d{1,5})?([\/\w\.-]*)*\/?(#[\S]+)?/ // eslint-disable-line
|
||||
var Expression = /^https?:\/\/[^\s/?#]+(:\d+)?/i
|
||||
// var Expression = /^https?:\/\/[^\s/?#]+(:\d+)?/i
|
||||
var Expression = /^\/([a-zA-Z0-9_-]+\/)*[a-zA-Z0-9_-]+(\?[a-zA-Z0-9_=&-]+)?$/
|
||||
var objExp = new RegExp(Expression)
|
||||
if (objExp.test(value) && value.startsWith(currentEmbedded.domain)) {
|
||||
if (objExp.test(value)) {
|
||||
callback()
|
||||
} else {
|
||||
callback(t('embedded.format_is_incorrect'))
|
||||
callback(t('embedded.format_is_incorrect', { msg: t('embedded.interface_url_incorrect') }))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user