From 857d99361ac18d15cf8baf42d7364bd0036d4dab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=AE=E6=A3=83?= Date: Wed, 13 Nov 2024 13:16:04 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20=E5=A2=9E=E5=8A=A0=20ge?= =?UTF-8?q?nshinnet=20=E5=9F=9F=E5=90=8D=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/capabilities/Mys.json | 5 ++++- src-tauri/capabilities/SubWindow.json | 3 +++ src-tauri/gen/schemas/capabilities.json | 13 +++++++++--- src/components/post/tp-text.vue | 28 +++++++------------------ src/utils/linkParser.ts | 5 +++-- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src-tauri/capabilities/Mys.json b/src-tauri/capabilities/Mys.json index 2011b700..e72046a8 100644 --- a/src-tauri/capabilities/Mys.json +++ b/src-tauri/capabilities/Mys.json @@ -78,12 +78,15 @@ }, { "url": "https://*.mihoyo.com/*" + }, + { + "url": "https://*.genshinnet.com/*" } ] } ], "remote": { - "urls": ["https://*.mihoyo.com/*", "https://*.miyoushe.com/*"] + "urls": ["https://*.mihoyo.com/*", "https://*.miyoushe.com/*", "https://*.genshinnet.com/*"] }, "platforms": ["windows", "macOS"] } diff --git a/src-tauri/capabilities/SubWindow.json b/src-tauri/capabilities/SubWindow.json index e7c2aaa1..e4fa1bfe 100644 --- a/src-tauri/capabilities/SubWindow.json +++ b/src-tauri/capabilities/SubWindow.json @@ -78,6 +78,9 @@ }, { "url": "https://*.hoyoverse.com/*" + }, + { + "url": "https://*.genshinnet.com/*" } ] } diff --git a/src-tauri/gen/schemas/capabilities.json b/src-tauri/gen/schemas/capabilities.json index dc2a5820..49b4c401 100644 --- a/src-tauri/gen/schemas/capabilities.json +++ b/src-tauri/gen/schemas/capabilities.json @@ -41,7 +41,9 @@ "Mys": { "identifier": "Mys", "description": "Capability for the mys client window", - "remote": { "urls": ["https://*.mihoyo.com/*", "https://*.miyoushe.com/*"] }, + "remote": { + "urls": ["https://*.mihoyo.com/*", "https://*.miyoushe.com/*", "https://*.genshinnet.com/*"] + }, "local": true, "windows": ["mhy_client"], "permissions": [ @@ -64,7 +66,11 @@ { "identifier": "fs:allow-write-text-file", "allow": [{ "path": "**" }] }, { "identifier": "http:default", - "allow": [{ "url": "https://*.miyoushe.com/*" }, { "url": "https://*.mihoyo.com/*" }] + "allow": [ + { "url": "https://*.miyoushe.com/*" }, + { "url": "https://*.mihoyo.com/*" }, + { "url": "https://*.genshinnet.com/*" } + ] } ], "platforms": ["windows", "macOS"] @@ -118,7 +124,8 @@ { "url": "https://*.mihoyo.com/*" }, { "url": "https://*.mihoyogift.com/*" }, { "url": "https://*.bilibili.com/*" }, - { "url": "https://*.hoyoverse.com/*" } + { "url": "https://*.hoyoverse.com/*" }, + { "url": "https://*.genshinnet.com/*" } ] } ], diff --git a/src/components/post/tp-text.vue b/src/components/post/tp-text.vue index 0ba2de02..8ea47907 100644 --- a/src/components/post/tp-text.vue +++ b/src/components/post/tp-text.vue @@ -80,12 +80,8 @@ function getTextStyle(): StyleValue { if (data.attributes) { const ruleBold: StyleValue = "fontFamily: var(--font-title)"; const ruleItalic: StyleValue = "fontStyle: italic"; - if (data.attributes.bold) { - style.push(ruleBold); - } - if (data.attributes.italic) { - style.push(ruleItalic); - } + if (data.attributes.bold) style.push(ruleBold); + if (data.attributes.italic) style.push(ruleItalic); if (data.attributes.color) { let colorGet = data.attributes.color; if (isColorSimilar("#000000", data.attributes.color)) { @@ -111,11 +107,7 @@ async function toLink() { const res = await parseLink(link); if (res === true) return; if (res === false) { - showSnackbar({ - text: `未知链接:${link}`, - color: "error", - timeout: 3000, - }); + showSnackbar({ text: `未知链接:${link}`, color: "error", timeout: 3000 }); return; } window.open(res); @@ -128,23 +120,17 @@ function getEmojiUrl(): string { getEmojis().then((res) => { if ("retcode" in res) { console.error(res); - showSnackbar({ - text: "获取表情包失败!", - color: "error", - }); + showSnackbar({ text: "获取表情包失败!", color: "error" }); mode.value = "text"; return ""; - } else { - localEmojis.value = JSON.stringify(res); - localStorage.setItem("emojis", localEmojis.value); } + localEmojis.value = JSON.stringify(res); + localStorage.setItem("emojis", localEmojis.value); }); } const emojiName = getEmojiName(); const emojiMap: Record = JSON.parse(localEmojis.value); - if (!Object.keys(emojiMap).includes(emojiName)) { - mode.value = "text"; - } + if (!Object.keys(emojiMap).includes(emojiName)) mode.value = "text"; return JSON.parse(localEmojis.value)[emojiName]; } diff --git a/src/utils/linkParser.ts b/src/utils/linkParser.ts index 961e5a77..3097d9b0 100644 --- a/src/utils/linkParser.ts +++ b/src/utils/linkParser.ts @@ -1,7 +1,7 @@ /** * @file src/utils/linkParser.ts * @description 处理链接 - * @since Beta v0.5.5 + * @since Beta v0.6.3 */ import { emit } from "@tauri-apps/api/event"; @@ -56,7 +56,7 @@ export async function parsePost(link: string): Promise { /** * @function parseLink - * @since Beta v0.5.5 + * @since Beta v0.6.3 * @description 处理链接 * @param {string} link - 链接 * @param {boolean} useInner - 是否采用内置 JSBridge 打开 @@ -140,6 +140,7 @@ export async function parseLink( "webstatic.miyoushe.com", "bbs.mihoyo.com", "qaa.miyoushe.com", + "mihoyo.genshinnet.com", ]; if (prefix.includes(url.hostname) && !useInner) { const openCheck = await showConfirm({