mirror of
https://github.com/certd/certd.git
synced 2026-04-25 05:07:25 +08:00
fix: 修复1:: 形式的ipv6校验失败的bug
This commit is contained in:
@@ -58,8 +58,13 @@ function isIpv6(d: string) {
|
|||||||
if (!d) {
|
if (!d) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const isIPv6Regex = /^([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})$/gm;
|
try {
|
||||||
return isIPv6Regex.test(d);
|
// 尝试构造URL,用IPv6作为hostname
|
||||||
|
new URL(`http://[${d}]`);
|
||||||
|
return true;
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isIp(d: string) {
|
function isIp(d: string) {
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ import { request } from "/@/api/service";
|
|||||||
import { Dicts } from "../lib/dicts";
|
import { Dicts } from "../lib/dicts";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { useDomainImport, useDomainImportManage } from "/@/views/certd/cert/domain/use";
|
import { useDomainImport, useDomainImportManage } from "/@/views/certd/cert/domain/use";
|
||||||
|
import { openRouteInNewWindow } from "/@/vben/utils";
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: "DomainSelector",
|
name: "DomainSelector",
|
||||||
@@ -190,7 +191,7 @@ const router = useRouter();
|
|||||||
function openDomainManager(e: any) {
|
function openDomainManager(e: any) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
// router.push("/certd/cert/domain");
|
// router.push("/certd/cert/domain");
|
||||||
window.open(`${window.location.origin}/#/certd/cert/domain`);
|
openRouteInNewWindow("/certd/cert/domain");
|
||||||
}
|
}
|
||||||
|
|
||||||
const openDomainImportManageDialog = useDomainImportManage();
|
const openDomainImportManageDialog = useDomainImportManage();
|
||||||
|
|||||||
@@ -4,8 +4,16 @@ function isIpv6(d: string) {
|
|||||||
if (!d) {
|
if (!d) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const isIPv6Regex = /^([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})$/gm;
|
// const isIPv6Regex = /^([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})$/gm;
|
||||||
return isIPv6Regex.test(d);
|
// return isIPv6Regex.test(d);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 尝试构造URL,用IPv6作为hostname
|
||||||
|
new URL(`http://[${d}]`);
|
||||||
|
return true;
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function isIpv4(d: string) {
|
function isIpv4(d: string) {
|
||||||
if (!d) {
|
if (!d) {
|
||||||
|
|||||||
@@ -167,7 +167,6 @@ function useMixedMenu() {
|
|||||||
* @param path 路由路径
|
* @param path 路由路径
|
||||||
*/
|
*/
|
||||||
function calcSideMenus(path: string = route.path) {
|
function calcSideMenus(path: string = route.path) {
|
||||||
debugger;
|
|
||||||
let { rootMenu } = findRootMenuByPath(menus.value, path);
|
let { rootMenu } = findRootMenuByPath(menus.value, path);
|
||||||
if (!rootMenu) {
|
if (!rootMenu) {
|
||||||
rootMenu = menus.value.find((item: any) => item.path === path);
|
rootMenu = menus.value.find((item: any) => item.path === path);
|
||||||
|
|||||||
@@ -27,8 +27,12 @@ function openWindow(url: string, options: OpenWindowOptions = {}): void {
|
|||||||
*/
|
*/
|
||||||
function openRouteInNewWindow(path: string) {
|
function openRouteInNewWindow(path: string) {
|
||||||
const { hash, origin } = location;
|
const { hash, origin } = location;
|
||||||
|
let pathname = location.pathname;
|
||||||
|
if (pathname.endsWith("/")) {
|
||||||
|
pathname = pathname.slice(0, -1);
|
||||||
|
}
|
||||||
const fullPath = path.startsWith("/") ? path : `/${path}`;
|
const fullPath = path.startsWith("/") ? path : `/${path}`;
|
||||||
const url = `${origin}${hash ? "/#" : ""}${fullPath}`;
|
const url = `${origin}${pathname}${hash ? "/#" : ""}${fullPath}`;
|
||||||
openWindow(url, { target: "_blank" });
|
openWindow(url, { target: "_blank" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,15 +19,16 @@ process.env.VITE_APP_VERSION = require("./package.json").version;
|
|||||||
process.env.VITE_APP_BUILD_TIME = require("dayjs")().format("YYYY-M-D HH:mm:ss");
|
process.env.VITE_APP_BUILD_TIME = require("dayjs")().format("YYYY-M-D HH:mm:ss");
|
||||||
import * as https from "node:https";
|
import * as https from "node:https";
|
||||||
|
|
||||||
export default ({ command, mode }) => {
|
export default (req: any) => {
|
||||||
|
const { command, mode } = req;
|
||||||
console.log("args", command, mode);
|
console.log("args", command, mode);
|
||||||
const env = loadEnv(mode, process.cwd());
|
const env = loadEnv(mode, process.cwd());
|
||||||
const devServerFs: any = {};
|
const devServerFs: any = {};
|
||||||
const devAlias: any[] = [];
|
const devAlias: any[] = [];
|
||||||
const base = "./";
|
let base = "./";
|
||||||
// if (mode.startsWith("dev")) {
|
if (mode.startsWith("dev")) {
|
||||||
// base = "./";
|
base = "/certd";
|
||||||
// }
|
}
|
||||||
return {
|
return {
|
||||||
base: base,
|
base: base,
|
||||||
plugins: [
|
plugins: [
|
||||||
@@ -96,6 +97,13 @@ export default ({ command, mode }) => {
|
|||||||
//忽略证书
|
//忽略证书
|
||||||
agent: new https.Agent({ rejectUnauthorized: false }),
|
agent: new https.Agent({ rejectUnauthorized: false }),
|
||||||
},
|
},
|
||||||
|
"/certd/api": {
|
||||||
|
//配套后端 https://github.com/fast-crud/fs-server-js
|
||||||
|
target: "https://127.0.0.1:7002/api",
|
||||||
|
rewrite: path => path.replace(/^\/certd\/api/, ""),
|
||||||
|
//忽略证书
|
||||||
|
agent: new https.Agent({ rejectUnauthorized: false }),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user