From f49beac2759bd819c914aa58883366e1144f01a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=AE=E6=A3=83?= Date: Mon, 2 Sep 2024 20:23:27 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E5=AE=8C=E5=96=84=E5=B8=96?= =?UTF-8?q?=E5=AD=90=E9=93=BE=E6=8E=A5=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/linkParser.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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;