feat: 存储管理S3存储配置填充默认域名 (#21)

This commit is contained in:
kils
2024-05-23 15:12:22 +08:00
committed by GitHub
parent 56b1fdd755
commit 5897bde0c4
2 changed files with 63 additions and 33 deletions

View File

@@ -8,3 +8,9 @@ export const isExternal = (path: string) => {
export function isHttp(url: string) {
return url.includes('http://') || url.includes('https://')
}
/** 判断 字符串 是否是 ipv4 */
export function isIPv4(ip: string): boolean {
const ipv4Pattern = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
return ipv4Pattern.test(ip)
}