mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
👔 完善对于链接的判断逻辑
This commit is contained in:
@@ -167,13 +167,13 @@ async function toLink() {
|
||||
}
|
||||
|
||||
function isMysAct(url: string): boolean {
|
||||
const prefix = ["https://act.mihoyo.com/", "https://mhyurl.cn"];
|
||||
// link.startsWith("https://webstatic.mihoyo.com/ys/event/e20220303-birthday/")
|
||||
for (const pre of prefix) {
|
||||
if (url.startsWith(pre)) return true;
|
||||
}
|
||||
if (url.startsWith("https://webstatic.mihoyo.com")) {
|
||||
return url.includes("event");
|
||||
const link = new URL(url);
|
||||
const prefix = ["https://act.mihoyo.com/", "https://mhyurl.cn", "https://webstatic.mihoyo.com"];
|
||||
if (prefix.includes(link.origin)) {
|
||||
if (link.origin == "https://webstatic.mihoyo.com") {
|
||||
return link.pathname.includes("event");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user