👽️ 增加 genshinnet 域名处理

This commit is contained in:
目棃
2024-11-13 13:16:04 +08:00
parent eaa07601a5
commit 857d99361a
5 changed files with 27 additions and 27 deletions

View File

@@ -78,12 +78,15 @@
}, },
{ {
"url": "https://*.mihoyo.com/*" "url": "https://*.mihoyo.com/*"
},
{
"url": "https://*.genshinnet.com/*"
} }
] ]
} }
], ],
"remote": { "remote": {
"urls": ["https://*.mihoyo.com/*", "https://*.miyoushe.com/*"] "urls": ["https://*.mihoyo.com/*", "https://*.miyoushe.com/*", "https://*.genshinnet.com/*"]
}, },
"platforms": ["windows", "macOS"] "platforms": ["windows", "macOS"]
} }

View File

@@ -78,6 +78,9 @@
}, },
{ {
"url": "https://*.hoyoverse.com/*" "url": "https://*.hoyoverse.com/*"
},
{
"url": "https://*.genshinnet.com/*"
} }
] ]
} }

View File

@@ -41,7 +41,9 @@
"Mys": { "Mys": {
"identifier": "Mys", "identifier": "Mys",
"description": "Capability for the mys client window", "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, "local": true,
"windows": ["mhy_client"], "windows": ["mhy_client"],
"permissions": [ "permissions": [
@@ -64,7 +66,11 @@
{ "identifier": "fs:allow-write-text-file", "allow": [{ "path": "**" }] }, { "identifier": "fs:allow-write-text-file", "allow": [{ "path": "**" }] },
{ {
"identifier": "http:default", "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"] "platforms": ["windows", "macOS"]
@@ -118,7 +124,8 @@
{ "url": "https://*.mihoyo.com/*" }, { "url": "https://*.mihoyo.com/*" },
{ "url": "https://*.mihoyogift.com/*" }, { "url": "https://*.mihoyogift.com/*" },
{ "url": "https://*.bilibili.com/*" }, { "url": "https://*.bilibili.com/*" },
{ "url": "https://*.hoyoverse.com/*" } { "url": "https://*.hoyoverse.com/*" },
{ "url": "https://*.genshinnet.com/*" }
] ]
} }
], ],

View File

@@ -80,12 +80,8 @@ function getTextStyle(): StyleValue {
if (data.attributes) { if (data.attributes) {
const ruleBold: StyleValue = "fontFamily: var(--font-title)"; const ruleBold: StyleValue = "fontFamily: var(--font-title)";
const ruleItalic: StyleValue = "fontStyle: italic"; const ruleItalic: StyleValue = "fontStyle: italic";
if (data.attributes.bold) { if (data.attributes.bold) style.push(ruleBold);
style.push(ruleBold); if (data.attributes.italic) style.push(ruleItalic);
}
if (data.attributes.italic) {
style.push(ruleItalic);
}
if (data.attributes.color) { if (data.attributes.color) {
let colorGet = data.attributes.color; let colorGet = data.attributes.color;
if (isColorSimilar("#000000", data.attributes.color)) { if (isColorSimilar("#000000", data.attributes.color)) {
@@ -111,11 +107,7 @@ async function toLink() {
const res = await parseLink(link); const res = await parseLink(link);
if (res === true) return; if (res === true) return;
if (res === false) { if (res === false) {
showSnackbar({ showSnackbar({ text: `未知链接:${link}`, color: "error", timeout: 3000 });
text: `未知链接:${link}`,
color: "error",
timeout: 3000,
});
return; return;
} }
window.open(res); window.open(res);
@@ -128,23 +120,17 @@ function getEmojiUrl(): string {
getEmojis().then((res) => { getEmojis().then((res) => {
if ("retcode" in res) { if ("retcode" in res) {
console.error(res); console.error(res);
showSnackbar({ showSnackbar({ text: "获取表情包失败!", color: "error" });
text: "获取表情包失败!",
color: "error",
});
mode.value = "text"; mode.value = "text";
return ""; 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 emojiName = getEmojiName();
const emojiMap: Record<string, string> = JSON.parse(<string>localEmojis.value); const emojiMap: Record<string, string> = JSON.parse(<string>localEmojis.value);
if (!Object.keys(emojiMap).includes(emojiName)) { if (!Object.keys(emojiMap).includes(emojiName)) mode.value = "text";
mode.value = "text";
}
return JSON.parse(<string>localEmojis.value)[emojiName]; return JSON.parse(<string>localEmojis.value)[emojiName];
} }

View File

@@ -1,7 +1,7 @@
/** /**
* @file src/utils/linkParser.ts * @file src/utils/linkParser.ts
* @description 处理链接 * @description 处理链接
* @since Beta v0.5.5 * @since Beta v0.6.3
*/ */
import { emit } from "@tauri-apps/api/event"; import { emit } from "@tauri-apps/api/event";
@@ -56,7 +56,7 @@ export async function parsePost(link: string): Promise<false | string> {
/** /**
* @function parseLink * @function parseLink
* @since Beta v0.5.5 * @since Beta v0.6.3
* @description 处理链接 * @description 处理链接
* @param {string} link - 链接 * @param {string} link - 链接
* @param {boolean} useInner - 是否采用内置 JSBridge 打开 * @param {boolean} useInner - 是否采用内置 JSBridge 打开
@@ -140,6 +140,7 @@ export async function parseLink(
"webstatic.miyoushe.com", "webstatic.miyoushe.com",
"bbs.mihoyo.com", "bbs.mihoyo.com",
"qaa.miyoushe.com", "qaa.miyoushe.com",
"mihoyo.genshinnet.com",
]; ];
if (prefix.includes(url.hostname) && !useInner) { if (prefix.includes(url.hostname) && !useInner) {
const openCheck = await showConfirm({ const openCheck = await showConfirm({