Skip to content

Commit d167c96

Browse files
committed
fix: 修复 host 获取失败
1 parent 86ecbd0 commit d167c96

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

response-protect/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ export const ResponseProtect = (
1818
const Referer = request.headers.get("Referer");
1919
if (!Referer && !config.allowRefererVoid)
2020
throw new Error("Referer 不能为空");
21-
const host = new URL(Referer!).host;
21+
const getHost = () => new URL(Referer!).host;
2222
if (
2323
Referer &&
2424
config.Referer.some((i) =>
25-
typeof i === "string" ? host === i : i.test(host)
25+
typeof i === "string" ? getHost() === i : i.test(getHost())
2626
)
2727
)
2828
throw new Error("您的网站已经被禁止使用服务");

0 commit comments

Comments
 (0)