feat: translate blacklist

This commit is contained in:
Gabe Yuan
2023-11-24 17:07:29 +08:00
parent 7bc39dd1bc
commit 22c50e7765
8 changed files with 200 additions and 193 deletions

13
src/libs/blacklist.js Normal file
View File

@@ -0,0 +1,13 @@
import { isMatch } from "./utils";
import { DEFAULT_BLACKLIST } from "../config";
/**
* 检查是否在黑名单中
* @param {*} href
* @param {*} param1
* @returns
*/
export const isInBlacklist = (
href,
{ blacklist = DEFAULT_BLACKLIST.join(",\n") }
) => blacklist.split(",").some((url) => isMatch(href, url.trim()));