mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-03-26 05:39:45 +08:00
✨ 存储分区信息
This commit is contained in:
@@ -4,35 +4,29 @@
|
||||
* @since Beta v0.7.3
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description salt 类型
|
||||
* @since Beta v0.7.3
|
||||
*/
|
||||
export type SaltKey = "K2" | "LK2" | "X4" | "X6" | "PROD";
|
||||
|
||||
const BBS_VERSION: Readonly<string> = "2.85.1";
|
||||
const BBS_UA_MOBILE: Readonly<string> = `Mozilla/5.0 (Linux; Android 12) Mobile miHoYoBBS/${BBS_VERSION}`;
|
||||
const BBS_UA_PC: Readonly<string> = `Mozilla/5.0 (Windows NT 10.0; Win64; x64) miHoYoBBS/${BBS_VERSION}`;
|
||||
|
||||
/**
|
||||
* @description 频道列表
|
||||
* @since Beta v0.6.8
|
||||
* @interface ChannelItem
|
||||
* @property {string} title - 频道名称
|
||||
* @property {number} gid - 频道 gid
|
||||
* @property {string} mini - 频道简称
|
||||
* @return ToChannelItem
|
||||
* @description salt 值
|
||||
* @version 2.85.1
|
||||
* @since Beta v0.7.3
|
||||
*/
|
||||
type ChannelItem = { title: string; gid: number; mini: string };
|
||||
const BBS_SALT: Readonly<Record<SaltKey, string>> = {
|
||||
K2: "ss6ZUzUlaWv6iDe0SHPSdCZYr0RSKPdi",
|
||||
LK2: "gW20AtTxpc0V5GR3SmsytCLhVBgXtW6I",
|
||||
X4: "xV8v4Qu54lUKrEYFZkJhB8cuOh9Asafs",
|
||||
X6: "t0qEgfub6cvueAPgR5m9aQWWVciEer7v",
|
||||
PROD: "t0qEgfub6cvueAPgR5m9aQWWVciEer7v",
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 渠道列表
|
||||
* @since Beta v0.6.8
|
||||
* @type {Array<ChannelItem>}
|
||||
*/
|
||||
const CHANNEL_LIST: Readonly<Array<ChannelItem>> = [
|
||||
{ title: "原神", gid: 2, mini: "ys" },
|
||||
{ title: "崩坏:星穹铁道", gid: 6, mini: "sr" },
|
||||
{ title: "绝区零", gid: 8, mini: "zzz" },
|
||||
{ title: "崩坏3", gid: 1, mini: "bh3" },
|
||||
{ title: "崩坏2", gid: 3, mini: "bh2" },
|
||||
{ title: "未定事件簿", gid: 4, mini: "wd" },
|
||||
{ title: "大别野", gid: 5, mini: "dby" },
|
||||
];
|
||||
|
||||
const TGBbs = { version: BBS_VERSION, ua: BBS_UA_MOBILE, channels: CHANNEL_LIST };
|
||||
const TGBbs = { version: BBS_VERSION, ua: BBS_UA_MOBILE, uap: BBS_UA_PC, salt: BBS_SALT };
|
||||
|
||||
export default TGBbs;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file src/utils/linkParser.ts
|
||||
* @description 处理链接
|
||||
* @since Beta v0.7.2
|
||||
* @since Beta v0.7.3
|
||||
*/
|
||||
|
||||
import showDialog from "@comp/func/dialog.js";
|
||||
@@ -11,8 +11,6 @@ import { emit } from "@tauri-apps/api/event";
|
||||
import TGClient from "./TGClient.js";
|
||||
import { createPost } from "./TGWindow.js";
|
||||
|
||||
import TGBbs from "@/utils/TGBbs.js";
|
||||
|
||||
/**
|
||||
* @function parsePost
|
||||
* @since Beta v0.6.9
|
||||
@@ -114,17 +112,19 @@ export async function parseLink(
|
||||
if (url.pathname.includes("/article/")) {
|
||||
const postId = url.pathname.split("/").pop();
|
||||
if (typeof postId !== "string") return false;
|
||||
if (!useInner) {
|
||||
return "post";
|
||||
}
|
||||
if (!useInner) return "post";
|
||||
await createPost(postId);
|
||||
return true;
|
||||
} else if (url.pathname.includes("/topicDetail/")) {
|
||||
}
|
||||
if (url.pathname.includes("/topicDetail/")) {
|
||||
const regex = /\/(\w+)\/topicDetail\/(\d+)/;
|
||||
const result = url.pathname.match(regex);
|
||||
if (!result) return false;
|
||||
const [, game, topicId] = result;
|
||||
const id = TGBbs.channels.find((item) => item.mini === game)?.gid;
|
||||
const bbsStore = localStorage.getItem("bbs");
|
||||
if (!bbsStore) return false;
|
||||
const gameList: Array<TGApp.BBS.Game.Item> = JSON.parse(bbsStore)["gameList"];
|
||||
const id = gameList.find((item) => item.en_name === game)?.id;
|
||||
await emit("active_deep_link", `router?path=/posts/topic/${id}/${topicId}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user