diff --git a/src/utils/linkParser.ts b/src/utils/linkParser.ts index c70c8da0..6c9c9f6e 100644 --- a/src/utils/linkParser.ts +++ b/src/utils/linkParser.ts @@ -14,7 +14,7 @@ import { createPost } from "./TGWindow.js"; /** * @function parsePost - * @since Beta v0.3.8 + * @since Beta v0.5.5 * @description 处理帖子 * @param {string} link * @returns {Promise} - 处理情况,或者转换后的链接 @@ -40,11 +40,15 @@ export async function parsePost(link: string): Promise { } return false; } - if (url.hostname === "bbs.mihoyo.com" || url.hostname === "www.miyoushe.com") { + if (url.hostname.endsWith(".mihoyo.com") || url.hostname.endsWith(".miyoushe.com")) { if (url.pathname.includes("/article/")) { const postId = url.pathname.split("/").pop(); if (typeof postId !== "string") return false; return postId; + } else if (url.hash.startsWith("#/article/")) { + const postId = url.hash.split("/").pop(); + if (typeof postId !== "string") return false; + return postId; } } return false;