From 7a9976f4ec728c8b7b72dfb79c70fe154b39f042 Mon Sep 17 00:00:00 2001 From: BTMuli Date: Fri, 29 Dec 2023 17:06:15 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E5=BE=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/linkParser.ts | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/utils/linkParser.ts b/src/utils/linkParser.ts index 4fd953ec..22f31381 100644 --- a/src/utils/linkParser.ts +++ b/src/utils/linkParser.ts @@ -1,7 +1,7 @@ /** * @file src/utils/linkParser.ts * @description 处理链接 - * @since Beta v0.3.8 + * @since Beta v0.3.9 */ import TGClient from "./TGClient"; @@ -48,7 +48,7 @@ export async function parsePost(link: string): Promise { /** * @function parseLink - * @since Beta v0.3.8 + * @since Beta v0.3.9 * @description 处理链接 * @param {string} link - 链接 * @param {boolean} useInner - 是否采用内置 JSBridge 打开 @@ -110,24 +110,22 @@ export async function parseLink( "bbs.mihoyo.com", "qaa.miyoushe.com", ]; - if (prefix.includes(url.hostname)) { - if (!useInner) { - const openCheck = await showConfirm({ - title: "采用内置 JSBridge?", - text: "取消则使用外部浏览器打开", - }); - if (!openCheck) return url.href; - const typeCheck = await showConfirm({ - title: "采用宽屏模式?", - text: "取消则使用默认竖屏", - }); - if (typeCheck) { - await TGClient.open("web_act", link); - } else { - await TGClient.open("web_act_thin", link); - } - return true; + if (prefix.includes(url.hostname) && !useInner) { + const openCheck = await showConfirm({ + title: "采用内置 JSBridge?", + text: "取消则使用外部浏览器打开", + }); + if (!openCheck) return url.href; + const typeCheck = await showConfirm({ + title: "采用宽屏模式?", + text: "取消则使用默认竖屏", + }); + if (typeCheck) { + await TGClient.open("web_act", link); + } else { + await TGClient.open("web_act_thin", link); } + return true; } return url.href.toString(); }