From ed767b92efdfb6b3084873f63f2e1db076bc104b Mon Sep 17 00:00:00 2001 From: Innei Date: Fri, 24 Jun 2022 16:04:36 +0800 Subject: [PATCH] fix: local ip cors --- src/bootstrap.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bootstrap.ts b/src/bootstrap.ts index 84d3d90b..6688a4f0 100644 --- a/src/bootstrap.ts +++ b/src/bootstrap.ts @@ -37,7 +37,12 @@ export async function bootstrap() { Origin ? { origin: (origin, callback) => { - const currentHost = new URL(origin).host + let currentHost: string + try { + currentHost = new URL(origin).host + } catch { + currentHost = origin + } const allow = Origin.some((host) => wcmatch(host)(currentHost)) callback(null, allow)