mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-15 09:48:14 +08:00
⚡️ 链接解析调整
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file src/utils/linkParser.ts
|
* @file src/utils/linkParser.ts
|
||||||
* @description 处理链接
|
* @description 处理链接
|
||||||
* @since Beta v0.4.7
|
* @since Beta v0.5.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { emit } from "@tauri-apps/api/event";
|
import { emit } from "@tauri-apps/api/event";
|
||||||
@@ -52,7 +52,7 @@ export async function parsePost(link: string): Promise<false | string> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @function parseLink
|
* @function parseLink
|
||||||
* @since Beta v0.4.7
|
* @since Beta v0.5.0
|
||||||
* @description 处理链接
|
* @description 处理链接
|
||||||
* @param {string} link - 链接
|
* @param {string} link - 链接
|
||||||
* @param {boolean} useInner - 是否采用内置 JSBridge 打开
|
* @param {boolean} useInner - 是否采用内置 JSBridge 打开
|
||||||
@@ -68,7 +68,7 @@ export async function parseLink(
|
|||||||
if (url.pathname.startsWith("//article/")) {
|
if (url.pathname.startsWith("//article/")) {
|
||||||
const postId = url.pathname.split("/").pop();
|
const postId = url.pathname.split("/").pop();
|
||||||
if (!postId) return false;
|
if (!postId) return false;
|
||||||
createPost(postId);
|
await createPost(postId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (url.pathname === "//webview" && url.search.startsWith("?link=")) {
|
if (url.pathname === "//webview" && url.search.startsWith("?link=")) {
|
||||||
@@ -104,7 +104,7 @@ export async function parseLink(
|
|||||||
if (!useInner) {
|
if (!useInner) {
|
||||||
return "post";
|
return "post";
|
||||||
}
|
}
|
||||||
createPost(postId);
|
await createPost(postId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user