mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
✏️ 继续修正 import
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { http } from "@tauri-apps/api";
|
import { http } from "@tauri-apps/api";
|
||||||
|
import { Response } from "@tauri-apps/api/http";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Bili 插件导航请求
|
* @description Bili 插件导航请求
|
||||||
@@ -13,7 +14,7 @@ import { http } from "@tauri-apps/api";
|
|||||||
*/
|
*/
|
||||||
async function getNav(): Promise<TGApp.Plugins.Bili.Nav.NavData> {
|
async function getNav(): Promise<TGApp.Plugins.Bili.Nav.NavData> {
|
||||||
const url = "https://api.bilibili.com/x/web-interface/nav";
|
const url = "https://api.bilibili.com/x/web-interface/nav";
|
||||||
return await http.fetch<TGApp.Plugins.Bili.Nav.NavResponse>(url).then((res) => {
|
return await http.fetch(url).then((res: Response<TGApp.Plugins.Bili.Nav.NavResponse>) => {
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { http } from "@tauri-apps/api";
|
import { http } from "@tauri-apps/api";
|
||||||
|
import { Response } from "@tauri-apps/api/http";
|
||||||
|
|
||||||
import getWrid from "../utils/getWrid";
|
import getWrid from "../utils/getWrid.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取视频播放地址
|
* @description 获取视频播放地址
|
||||||
@@ -31,14 +32,14 @@ async function getVideoUrl(cid: number, bvid: string): Promise<TGApp.Plugins.Bil
|
|||||||
wrid: wridRes[1],
|
wrid: wridRes[1],
|
||||||
};
|
};
|
||||||
return await http
|
return await http
|
||||||
.fetch<TGApp.Plugins.Bili.Video.UrlResponse>(url, {
|
.fetch(url, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
query: params,
|
query: params,
|
||||||
headers: {
|
headers: {
|
||||||
referer: "https://www.bilibili.com/",
|
referer: "https://www.bilibili.com/",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res: Response<TGApp.Plugins.Bili.Video.UrlResponse>) => {
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { http } from "@tauri-apps/api";
|
import { http } from "@tauri-apps/api";
|
||||||
|
import type { Response } from "@tauri-apps/api/http";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取视频基本信息
|
* @description 获取视频基本信息
|
||||||
@@ -26,10 +27,8 @@ async function getVideoView(
|
|||||||
throw new Error("参数错误");
|
throw new Error("参数错误");
|
||||||
}
|
}
|
||||||
return await http
|
return await http
|
||||||
.fetch<TGApp.Plugins.Bili.Video.ViewResponse>(url, {
|
.fetch(url, { method: "GET" })
|
||||||
method: "GET",
|
.then((res: Response<TGApp.Plugins.Bili.Video.ViewResponse>) => {
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
import md5 from "js-md5";
|
import md5 from "js-md5";
|
||||||
|
|
||||||
import getNav from "../request/getNav";
|
import getNav from "../request/getNav.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取 key 值
|
* @description 获取 key 值
|
||||||
|
|||||||
@@ -5,15 +5,15 @@
|
|||||||
* @since Beta v0.3.0
|
* @since Beta v0.3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import getAvatarCollect from "./request/getAvatarCollect";
|
import getAvatarCollect from "./request/getAvatarCollect.js";
|
||||||
import getAvatarHoldRate from "./request/getAvatarHoldRate";
|
import getAvatarHoldRate from "./request/getAvatarHoldRate.js";
|
||||||
import getAvatarUpRate from "./request/getAvatarUpRate";
|
import getAvatarUpRate from "./request/getAvatarUpRate.js";
|
||||||
import getAvatarUseRate from "./request/getAvatarUseRate";
|
import getAvatarUseRate from "./request/getAvatarUseRate.js";
|
||||||
import getOverview from "./request/getOverview";
|
import getOverview from "./request/getOverview.js";
|
||||||
import getTeamCollect from "./request/getTeamCollect";
|
import getTeamCollect from "./request/getTeamCollect.js";
|
||||||
import getWeaponCollect from "./request/getWeaponCollect";
|
import getWeaponCollect from "./request/getWeaponCollect.js";
|
||||||
import uploadData from "./request/uploadData";
|
import uploadData from "./request/uploadData.js";
|
||||||
import { transAvatars, transLocal } from "./utils/transLocal";
|
import { transAvatars, transLocal } from "./utils/transLocal.js";
|
||||||
|
|
||||||
const Hutao = {
|
const Hutao = {
|
||||||
Abyss: {
|
Abyss: {
|
||||||
|
|||||||
@@ -5,8 +5,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { http } from "@tauri-apps/api";
|
import { http } from "@tauri-apps/api";
|
||||||
|
import { Response } from "@tauri-apps/api/http";
|
||||||
|
|
||||||
import HutaoApi from "../api";
|
import HutaoApi from "../api/index.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取角色搭配数据
|
* @description 获取角色搭配数据
|
||||||
@@ -16,10 +17,8 @@ import HutaoApi from "../api";
|
|||||||
async function getAvatarCollect(): Promise<TGApp.Plugins.Hutao.Abyss.AvatarCollocation[]> {
|
async function getAvatarCollect(): Promise<TGApp.Plugins.Hutao.Abyss.AvatarCollocation[]> {
|
||||||
const url = HutaoApi.Abyss.avatar.collect;
|
const url = HutaoApi.Abyss.avatar.collect;
|
||||||
return await http
|
return await http
|
||||||
.fetch<TGApp.Plugins.Hutao.Abyss.AvatarCollocationResponse>(url, {
|
.fetch(url, { method: "GET" })
|
||||||
method: "GET",
|
.then((res: Response<TGApp.Plugins.Hutao.Abyss.AvatarCollocationResponse>) => {
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { http } from "@tauri-apps/api";
|
import { http } from "@tauri-apps/api";
|
||||||
|
import { Response } from "@tauri-apps/api/http";
|
||||||
|
|
||||||
import HutaoApi from "../api";
|
import HutaoApi from "../api/index.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取角色持有率数据
|
* @description 获取角色持有率数据
|
||||||
@@ -16,10 +17,8 @@ import HutaoApi from "../api";
|
|||||||
async function getAvatarHoldRate(): Promise<TGApp.Plugins.Hutao.Abyss.AvatarHold[]> {
|
async function getAvatarHoldRate(): Promise<TGApp.Plugins.Hutao.Abyss.AvatarHold[]> {
|
||||||
const url = HutaoApi.Abyss.avatar.holdRate;
|
const url = HutaoApi.Abyss.avatar.holdRate;
|
||||||
return await http
|
return await http
|
||||||
.fetch<TGApp.Plugins.Hutao.Abyss.AvatarHoldResponse>(url, {
|
.fetch(url, { method: "GET" })
|
||||||
method: "GET",
|
.then((res: Response<TGApp.Plugins.Hutao.Abyss.AvatarHoldResponse>) => {
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { http } from "@tauri-apps/api";
|
import { http } from "@tauri-apps/api";
|
||||||
|
import { Response } from "@tauri-apps/api/http";
|
||||||
|
|
||||||
import HutaoApi from "../api";
|
import HutaoApi from "../api/index.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取角色上场率数据
|
* @description 获取角色上场率数据
|
||||||
@@ -16,10 +17,8 @@ import HutaoApi from "../api";
|
|||||||
async function getAvatarUpRate(): Promise<TGApp.Plugins.Hutao.Abyss.AvatarUp[]> {
|
async function getAvatarUpRate(): Promise<TGApp.Plugins.Hutao.Abyss.AvatarUp[]> {
|
||||||
const url = HutaoApi.Abyss.avatar.upRate;
|
const url = HutaoApi.Abyss.avatar.upRate;
|
||||||
return await http
|
return await http
|
||||||
.fetch<TGApp.Plugins.Hutao.Abyss.AvatarUpResponse>(url, {
|
.fetch(url, { method: "GET" })
|
||||||
method: "GET",
|
.then((res: Response<TGApp.Plugins.Hutao.Abyss.AvatarUpResponse>) => {
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { http } from "@tauri-apps/api";
|
import { http } from "@tauri-apps/api";
|
||||||
|
import { Response } from "@tauri-apps/api/http";
|
||||||
|
|
||||||
import HutaoApi from "../api";
|
import HutaoApi from "../api/index.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取角色使用率
|
* @description 获取角色使用率
|
||||||
@@ -16,10 +17,8 @@ import HutaoApi from "../api";
|
|||||||
async function getAvatarUseRate(): Promise<TGApp.Plugins.Hutao.Abyss.AvatarUse[]> {
|
async function getAvatarUseRate(): Promise<TGApp.Plugins.Hutao.Abyss.AvatarUse[]> {
|
||||||
const url = HutaoApi.Abyss.avatar.useRate;
|
const url = HutaoApi.Abyss.avatar.useRate;
|
||||||
return await http
|
return await http
|
||||||
.fetch<TGApp.Plugins.Hutao.Abyss.AvatarUseResponse>(url, {
|
.fetch(url, { method: "GET" })
|
||||||
method: "GET",
|
.then((res: Response<TGApp.Plugins.Hutao.Abyss.AvatarUseResponse>) => {
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { http } from "@tauri-apps/api";
|
import { http } from "@tauri-apps/api";
|
||||||
|
import { Response } from "@tauri-apps/api/http";
|
||||||
|
|
||||||
import HutaoApi from "../api";
|
import HutaoApi from "../api/index.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取深渊概览数据
|
* @description 获取深渊概览数据
|
||||||
@@ -16,10 +17,8 @@ import HutaoApi from "../api";
|
|||||||
async function getOverview(): Promise<TGApp.Plugins.Hutao.Abyss.OverviewData> {
|
async function getOverview(): Promise<TGApp.Plugins.Hutao.Abyss.OverviewData> {
|
||||||
const url = HutaoApi.Abyss.overview;
|
const url = HutaoApi.Abyss.overview;
|
||||||
return await http
|
return await http
|
||||||
.fetch<TGApp.Plugins.Hutao.Abyss.OverviewResponse>(url, {
|
.fetch(url, { method: "GET" })
|
||||||
method: "GET",
|
.then((res: Response<TGApp.Plugins.Hutao.Abyss.OverviewResponse>) => {
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { http } from "@tauri-apps/api";
|
import { http } from "@tauri-apps/api";
|
||||||
|
import type { Response } from "@tauri-apps/api/http";
|
||||||
|
|
||||||
import HutaoApi from "../api";
|
import HutaoApi from "../api/index.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取队伍搭配数据
|
* @description 获取队伍搭配数据
|
||||||
@@ -16,10 +17,8 @@ import HutaoApi from "../api";
|
|||||||
async function getTeamCollect(): Promise<TGApp.Plugins.Hutao.Abyss.TeamCombination[]> {
|
async function getTeamCollect(): Promise<TGApp.Plugins.Hutao.Abyss.TeamCombination[]> {
|
||||||
const url = HutaoApi.Abyss.team;
|
const url = HutaoApi.Abyss.team;
|
||||||
return await http
|
return await http
|
||||||
.fetch<TGApp.Plugins.Hutao.Abyss.TeamCombinationResponse>(url, {
|
.fetch(url, { method: "GET" })
|
||||||
method: "GET",
|
.then((res: Response<TGApp.Plugins.Hutao.Abyss.TeamCombinationResponse>) => {
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
/**
|
/**
|
||||||
* @file plugins Hutao request getWeaponCollect.ts
|
* @file plugins Hutao request getWeaponCollect.ts
|
||||||
* @description 获取武器搭配
|
* @description 获取武器搭配
|
||||||
* @author BTMuli <bt-muli@outlook.com>
|
|
||||||
* @since Alpha v0.2.0
|
* @since Alpha v0.2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { http } from "@tauri-apps/api";
|
import { http } from "@tauri-apps/api";
|
||||||
|
import type { Response } from "@tauri-apps/api/http";
|
||||||
|
|
||||||
import HutaoApi from "../api";
|
import HutaoApi from "../api/index.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取武器搭配
|
* @description 获取武器搭配
|
||||||
@@ -17,10 +17,8 @@ import HutaoApi from "../api";
|
|||||||
async function getWeaponCollect(): Promise<TGApp.Plugins.Hutao.Abyss.WeaponCollocation[]> {
|
async function getWeaponCollect(): Promise<TGApp.Plugins.Hutao.Abyss.WeaponCollocation[]> {
|
||||||
const url = HutaoApi.Abyss.weapon;
|
const url = HutaoApi.Abyss.weapon;
|
||||||
return await http
|
return await http
|
||||||
.fetch<TGApp.Plugins.Hutao.Abyss.WeaponCollocationResponse>(url, {
|
.fetch(url, { method: "GET" })
|
||||||
method: "GET",
|
.then((res: Response<TGApp.Plugins.Hutao.Abyss.WeaponCollocationResponse>) => {
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { http } from "@tauri-apps/api";
|
import { http } from "@tauri-apps/api";
|
||||||
|
import type { Response } from "@tauri-apps/api/http";
|
||||||
|
|
||||||
import HutaoApi from "../api";
|
import HutaoApi from "../api/index.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 上传用户数据
|
* @description 上传用户数据
|
||||||
@@ -19,11 +20,8 @@ async function uploadData(
|
|||||||
): Promise<TGApp.Plugins.Hutao.Abyss.UploadResponse> {
|
): Promise<TGApp.Plugins.Hutao.Abyss.UploadResponse> {
|
||||||
const url = HutaoApi.Abyss.upload;
|
const url = HutaoApi.Abyss.upload;
|
||||||
return await http
|
return await http
|
||||||
.fetch<TGApp.Plugins.Hutao.Abyss.UploadResponse>(url, {
|
.fetch(url, { method: "POST", body: http.Body.json(data) })
|
||||||
method: "POST",
|
.then((res: Response<TGApp.Plugins.Hutao.Abyss.UploadResponse>) => res.data);
|
||||||
body: http.Body.json(data),
|
|
||||||
})
|
|
||||||
.then((res) => res.data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default uploadData;
|
export default uploadData;
|
||||||
|
|||||||
@@ -86,11 +86,11 @@ function transLevel(data: TGApp.Sqlite.Abyss.Level): TGApp.Plugins.Hutao.Abyss.L
|
|||||||
const battles: Array<{ Index: number; Avatars: number[] }> = [];
|
const battles: Array<{ Index: number; Avatars: number[] }> = [];
|
||||||
battles.push({
|
battles.push({
|
||||||
Index: 1,
|
Index: 1,
|
||||||
Avatars: data.upBattle.characters.map((character) => character.id),
|
Avatars: data.upBattle!.characters.map((character) => character.id),
|
||||||
});
|
});
|
||||||
battles.push({
|
battles.push({
|
||||||
Index: 2,
|
Index: 2,
|
||||||
Avatars: data.downBattle.characters.map((character) => character.id),
|
Avatars: data.downBattle!.characters.map((character) => character.id),
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
Index: data.id,
|
Index: data.id,
|
||||||
|
|||||||
@@ -5,8 +5,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { http } from "@tauri-apps/api";
|
import { http } from "@tauri-apps/api";
|
||||||
|
import type { Response } from "@tauri-apps/api/http";
|
||||||
|
|
||||||
import MysApi from "../api";
|
import MysApi from "../api/index.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取投票信息
|
* @description 获取投票信息
|
||||||
@@ -17,20 +18,14 @@ import MysApi from "../api";
|
|||||||
*/
|
*/
|
||||||
export async function getVoteInfo(id: string, uid: string): Promise<TGApp.Plugins.Mys.Vote.Info> {
|
export async function getVoteInfo(id: string, uid: string): Promise<TGApp.Plugins.Mys.Vote.Info> {
|
||||||
const url = "https://bbs-api.miyoushe.com/apihub/api/getVotes";
|
const url = "https://bbs-api.miyoushe.com/apihub/api/getVotes";
|
||||||
const params = {
|
const params = { owner_uid: uid, vote_ids: id };
|
||||||
owner_uid: uid,
|
|
||||||
vote_ids: id,
|
|
||||||
};
|
|
||||||
return await http
|
return await http
|
||||||
.fetch<TGApp.Plugins.Mys.Vote.InfoResponse>(url, {
|
.fetch(url, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: { "Content-Type": "application/json", Referer: MysApi.PostReferer },
|
||||||
"Content-Type": "application/json",
|
|
||||||
Referer: MysApi.PostReferer,
|
|
||||||
},
|
|
||||||
query: params,
|
query: params,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res: Response<TGApp.Plugins.Mys.Vote.InfoResponse>) => {
|
||||||
return res.data.data.data[0];
|
return res.data.data.data[0];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -47,20 +42,14 @@ export async function getVoteResult(
|
|||||||
uid: string,
|
uid: string,
|
||||||
): Promise<TGApp.Plugins.Mys.Vote.Result> {
|
): Promise<TGApp.Plugins.Mys.Vote.Result> {
|
||||||
const url = "https://bbs-api.miyoushe.com/apihub/api/getVotesResult";
|
const url = "https://bbs-api.miyoushe.com/apihub/api/getVotesResult";
|
||||||
const params = {
|
const params = { owner_uid: uid, vote_ids: id };
|
||||||
owner_uid: uid,
|
|
||||||
vote_ids: id,
|
|
||||||
};
|
|
||||||
return await http
|
return await http
|
||||||
.fetch<TGApp.Plugins.Mys.Vote.ResultResponse>(url, {
|
.fetch(url, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: { "Content-Type": "application/json", Referer: MysApi.PostReferer },
|
||||||
"Content-Type": "application/json",
|
|
||||||
Referer: MysApi.PostReferer,
|
|
||||||
},
|
|
||||||
query: params,
|
query: params,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res: Response<TGApp.Plugins.Mys.Vote.ResultResponse>) => {
|
||||||
return res.data.data.data[0];
|
return res.data.data.data[0];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
* @since Beta v0.4.4
|
* @since Beta v0.4.4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { AppCharacterData } from "../../../data";
|
import { AppCharacterData } from "../../../data/index.js";
|
||||||
import getPostData from "../request/getPostData";
|
import getPostData from "../request/getPostData.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 根据单个卡池信息转为渲染用的卡池信息
|
* @description 根据单个卡池信息转为渲染用的卡池信息
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* @file plugins Mys utils getPositionCard.ts
|
* @file plugins/Mys/utils/getPositionCard.ts
|
||||||
* @description Mys 插件热点追踪工具
|
* @description Mys 插件热点追踪工具
|
||||||
* @author BTMuli <bt-muli@outlook.com>
|
* @since Beta v0.4.10
|
||||||
* @since Alpha v0.2.1
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 根据热点追踪信息转为渲染用的数据
|
* @description 根据热点追踪信息转为渲染用的数据
|
||||||
* @since Alpha v0.1.5
|
* @since Beta v0.4.10
|
||||||
* @param {TGApp.Plugins.Mys.Position.Data[]} positionData 列表
|
* @param {TGApp.Plugins.Mys.Position.Data[]} positionData 列表
|
||||||
* @returns {TGApp.Plugins.Mys.Position.RenderCard[]} 返回列表
|
* @returns {TGApp.Plugins.Mys.Position.RenderCard[]} 返回列表
|
||||||
*/
|
*/
|
||||||
@@ -15,14 +14,14 @@ function getPositionCard(
|
|||||||
positionData: TGApp.Plugins.Mys.Position.Data[],
|
positionData: TGApp.Plugins.Mys.Position.Data[],
|
||||||
): TGApp.Plugins.Mys.Position.RenderCard[] {
|
): TGApp.Plugins.Mys.Position.RenderCard[] {
|
||||||
const res: TGApp.Plugins.Mys.Position.RenderCard[] = [];
|
const res: TGApp.Plugins.Mys.Position.RenderCard[] = [];
|
||||||
positionData.map((position) => {
|
for (const position of positionData) {
|
||||||
let endStr: string;
|
let endStr: string;
|
||||||
if (position.end_time === "0") {
|
if (position.end_time === "0") {
|
||||||
endStr = "";
|
endStr = "";
|
||||||
} else {
|
} else {
|
||||||
endStr = new Date(Number(position.end_time)).toLocaleDateString().replace(/\//g, "-");
|
endStr = new Date(Number(position.end_time)).toLocaleDateString().replace(/\//g, "-");
|
||||||
}
|
}
|
||||||
return res.push<TGApp.Plugins.Mys.Position.RenderCard>({
|
const card: TGApp.Plugins.Mys.Position.RenderCard = {
|
||||||
title: position.title,
|
title: position.title,
|
||||||
postId: Number(position.url.split("/").pop()),
|
postId: Number(position.url.split("/").pop()),
|
||||||
icon: position.icon,
|
icon: position.icon,
|
||||||
@@ -33,8 +32,9 @@ function getPositionCard(
|
|||||||
end: endStr,
|
end: endStr,
|
||||||
endStamp: Number(position.end_time),
|
endStamp: Number(position.end_time),
|
||||||
},
|
},
|
||||||
});
|
};
|
||||||
});
|
res.push(card);
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { getUiafStatus } from "../../../utils/UIAF.js";
|
import { getUiafStatus } from "../../../utils/UIAF.js";
|
||||||
import TGSqlite from "../index";
|
import TGSqlite from "../index.js";
|
||||||
import { importUIAFData } from "../sql/updateData";
|
import { importUIAFData } from "../sql/updateData.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取成就概况
|
* @description 获取成就概况
|
||||||
@@ -15,7 +15,7 @@ import { importUIAFData } from "../sql/updateData";
|
|||||||
*/
|
*/
|
||||||
async function getOverview(): Promise<TGApp.Sqlite.Achievement.Overview> {
|
async function getOverview(): Promise<TGApp.Sqlite.Achievement.Overview> {
|
||||||
const db = await TGSqlite.getDB();
|
const db = await TGSqlite.getDB();
|
||||||
const res = await db.select<TGApp.Sqlite.Achievement.Overview>(
|
const res = await db.select<TGApp.Sqlite.Achievement.Overview[]>(
|
||||||
"SELECT SUM(totalCount) as total,SUM(finCount) AS fin From AchievementSeries",
|
"SELECT SUM(totalCount) as total,SUM(finCount) AS fin From AchievementSeries",
|
||||||
);
|
);
|
||||||
return res[0];
|
return res[0];
|
||||||
@@ -29,7 +29,7 @@ async function getOverview(): Promise<TGApp.Sqlite.Achievement.Overview> {
|
|||||||
async function getLatestAchiVersion(): Promise<string> {
|
async function getLatestAchiVersion(): Promise<string> {
|
||||||
const db = await TGSqlite.getDB();
|
const db = await TGSqlite.getDB();
|
||||||
type resType = { version: string };
|
type resType = { version: string };
|
||||||
const res = await db.select<resType>(
|
const res = await db.select<resType[]>(
|
||||||
"SELECT version FROM Achievements ORDER BY version DESC LIMIT 1;",
|
"SELECT version FROM Achievements ORDER BY version DESC LIMIT 1;",
|
||||||
);
|
);
|
||||||
return res[0].version;
|
return res[0].version;
|
||||||
@@ -45,11 +45,11 @@ async function getSeries(id?: number): Promise<TGApp.Sqlite.Achievement.SeriesTa
|
|||||||
const db = await TGSqlite.getDB();
|
const db = await TGSqlite.getDB();
|
||||||
let res: TGApp.Sqlite.Achievement.SeriesTable[];
|
let res: TGApp.Sqlite.Achievement.SeriesTable[];
|
||||||
if (id === undefined) {
|
if (id === undefined) {
|
||||||
res = await db.select<TGApp.Sqlite.Achievement.SeriesTable>(
|
res = await db.select<TGApp.Sqlite.Achievement.SeriesTable[]>(
|
||||||
"SELECT * FROM AchievementSeries ORDER BY `order`;",
|
"SELECT * FROM AchievementSeries ORDER BY `order`;",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
res = await db.select<TGApp.Sqlite.Achievement.SeriesTable>(
|
res = await db.select<TGApp.Sqlite.Achievement.SeriesTable[]>(
|
||||||
"SELECT * FROM AchievementSeries WHERE id = ?;",
|
"SELECT * FROM AchievementSeries WHERE id = ?;",
|
||||||
[id],
|
[id],
|
||||||
);
|
);
|
||||||
@@ -67,11 +67,11 @@ async function getAchievements(id?: string): Promise<TGApp.Sqlite.Achievement.Si
|
|||||||
const db = await TGSqlite.getDB();
|
const db = await TGSqlite.getDB();
|
||||||
let res: TGApp.Sqlite.Achievement.SingleTable[];
|
let res: TGApp.Sqlite.Achievement.SingleTable[];
|
||||||
if (id === undefined) {
|
if (id === undefined) {
|
||||||
res = await db.select<TGApp.Sqlite.Achievement.SingleTable>(
|
res = await db.select<TGApp.Sqlite.Achievement.SingleTable[]>(
|
||||||
"SELECT * FROM Achievements ORDER BY isCompleted,`order`;",
|
"SELECT * FROM Achievements ORDER BY isCompleted,`order`;",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
res = await db.select<TGApp.Sqlite.Achievement.SingleTable>(
|
res = await db.select<TGApp.Sqlite.Achievement.SingleTable[]>(
|
||||||
"SELECT * FROM Achievements WHERE series = ? ORDER BY isCompleted,`order`;",
|
"SELECT * FROM Achievements WHERE series = ? ORDER BY isCompleted,`order`;",
|
||||||
[id],
|
[id],
|
||||||
);
|
);
|
||||||
@@ -88,7 +88,7 @@ async function getAchievements(id?: string): Promise<TGApp.Sqlite.Achievement.Si
|
|||||||
async function getSeriesNameCard(id: string): Promise<string> {
|
async function getSeriesNameCard(id: string): Promise<string> {
|
||||||
const db = await TGSqlite.getDB();
|
const db = await TGSqlite.getDB();
|
||||||
type resType = { nameCard: string };
|
type resType = { nameCard: string };
|
||||||
const res = await db.select<resType>("SELECT nameCard FROM AchievementSeries WHERE id = ?;", [
|
const res = await db.select<resType[]>("SELECT nameCard FROM AchievementSeries WHERE id = ?;", [
|
||||||
id,
|
id,
|
||||||
]);
|
]);
|
||||||
return res[0].nameCard;
|
return res[0].nameCard;
|
||||||
@@ -108,12 +108,12 @@ async function searchAchievements(
|
|||||||
const versionReg = /^v\d+(\.\d+)?$/;
|
const versionReg = /^v\d+(\.\d+)?$/;
|
||||||
if (versionReg.test(keyword)) {
|
if (versionReg.test(keyword)) {
|
||||||
const version = keyword.replace("v", "");
|
const version = keyword.replace("v", "");
|
||||||
return await db.select<TGApp.Sqlite.Achievement.SingleTable>(
|
return await db.select<TGApp.Sqlite.Achievement.SingleTable[]>(
|
||||||
"SELECT * FROM Achievements WHERE version LIKE ? ORDER BY isCompleted,`order`;",
|
"SELECT * FROM Achievements WHERE version LIKE ? ORDER BY isCompleted,`order`;",
|
||||||
[`%${version}%`],
|
[`%${version}%`],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return await db.select<TGApp.Sqlite.Achievement.SingleTable>(
|
return await db.select<TGApp.Sqlite.Achievement.SingleTable[]>(
|
||||||
"SELECT * FROM Achievements WHERE name LIKE ? OR description LIKE ? ORDER BY isCompleted,`order`;",
|
"SELECT * FROM Achievements WHERE name LIKE ? OR description LIKE ? ORDER BY isCompleted,`order`;",
|
||||||
[`%${keyword}%`, `%${keyword}%`],
|
[`%${keyword}%`, `%${keyword}%`],
|
||||||
);
|
);
|
||||||
@@ -160,9 +160,11 @@ function transDb2Uiaf(data: TGApp.Sqlite.Achievement.SingleTable): TGApp.Plugins
|
|||||||
*/
|
*/
|
||||||
async function getUIAF(): Promise<TGApp.Plugins.UIAF.Achievement[]> {
|
async function getUIAF(): Promise<TGApp.Plugins.UIAF.Achievement[]> {
|
||||||
const db = await TGSqlite.getDB();
|
const db = await TGSqlite.getDB();
|
||||||
const data = await db.select<TGApp.Sqlite.Achievement.SingleTable>("SELECT * FROM Achievements;");
|
const data = await db.select<TGApp.Sqlite.Achievement.SingleTable[]>(
|
||||||
|
"SELECT * FROM Achievements;",
|
||||||
|
);
|
||||||
const res: TGApp.Plugins.UIAF.Achievement[] = [];
|
const res: TGApp.Plugins.UIAF.Achievement[] = [];
|
||||||
for (const item: TGApp.Sqlite.Achievement.SingleTable of data) {
|
for (const item of data) {
|
||||||
res.push(transDb2Uiaf(item));
|
res.push(transDb2Uiaf(item));
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* @since Beta v0.4.5
|
* @since Beta v0.4.5
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import TGSqlite from "../index";
|
import TGSqlite from "../index.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取单个帖子的收藏信息
|
* @description 获取单个帖子的收藏信息
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* @since Beta v0.4.9
|
* @since Beta v0.4.9
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import minifySql from "../../../utils/minifySql";
|
import minifySql from "../../../utils/minifySql.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 导入UIAF数据-单项
|
* @description 导入UIAF数据-单项
|
||||||
@@ -12,7 +12,7 @@ import minifySql from "../../../utils/minifySql";
|
|||||||
* @param {TGApp.Plugins.UIAF.Achievement} data
|
* @param {TGApp.Plugins.UIAF.Achievement} data
|
||||||
* @returns {string} sql
|
* @returns {string} sql
|
||||||
*/
|
*/
|
||||||
export function importUIAFData(data: TGApp.Plugins.UIAF.Achievement): string[] {
|
export function importUIAFData(data: TGApp.Plugins.UIAF.Achievement): string {
|
||||||
let sql;
|
let sql;
|
||||||
const isCompleted = data.status === 2 || data.status === 3;
|
const isCompleted = data.status === 2 || data.status === 3;
|
||||||
if (isCompleted) {
|
if (isCompleted) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
import { createRouter, createWebHistory } from "vue-router";
|
import { createRouter, createWebHistory } from "vue-router";
|
||||||
|
|
||||||
import routes from "./routes";
|
import routes from "./routes.js";
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(),
|
history: createWebHistory(),
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
* @since Beta v0.4.4
|
* @since Beta v0.4.4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import archiveRoutes from "./modules/archive";
|
import archiveRoutes from "./modules/archive.js";
|
||||||
import mainRoutes from "./modules/main";
|
import mainRoutes from "./modules/main.js";
|
||||||
import subRoutes from "./modules/sub";
|
import subRoutes from "./modules/sub.js";
|
||||||
import userRoutes from "./modules/user";
|
import userRoutes from "./modules/user.js";
|
||||||
import wikiRoutes from "./modules/wiki";
|
import wikiRoutes from "./modules/wiki.js";
|
||||||
|
|
||||||
// 合并路由
|
// 合并路由
|
||||||
const routes = [...mainRoutes, ...subRoutes, ...archiveRoutes, ...wikiRoutes, ...userRoutes];
|
const routes = [...mainRoutes, ...subRoutes, ...archiveRoutes, ...wikiRoutes, ...userRoutes];
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import { path } from "@tauri-apps/api";
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { reactive, ref } from "vue";
|
import { reactive, ref } from "vue";
|
||||||
|
|
||||||
import { getInitDeviceInfo } from "../../utils/toolFunc";
|
import { getInitDeviceInfo } from "../../utils/toolFunc.js";
|
||||||
import { type AnnoLang, AnnoServer } from "../../web/request/getAnno";
|
import { type AnnoLang, AnnoServer } from "../../web/request/getAnno.js";
|
||||||
|
|
||||||
// 用于存储用户数据的路径
|
// 用于存储用户数据的路径
|
||||||
const userDataDir = `${await path.appLocalDataDir()}userData`;
|
const userDataDir = `${await path.appLocalDataDir()}userData`;
|
||||||
|
|||||||
@@ -9,19 +9,19 @@ import type { Event } from "@tauri-apps/api/event";
|
|||||||
import type { UnlistenFn } from "@tauri-apps/api/helpers/event";
|
import type { UnlistenFn } from "@tauri-apps/api/helpers/event";
|
||||||
import { appWindow, WebviewWindow } from "@tauri-apps/api/window";
|
import { appWindow, WebviewWindow } from "@tauri-apps/api/window";
|
||||||
|
|
||||||
import showSnackbar from "../components/func/snackbar";
|
import showSnackbar from "../components/func/snackbar.js";
|
||||||
import TGSqlite from "../plugins/Sqlite";
|
import TGSqlite from "../plugins/Sqlite/index.js";
|
||||||
import { useAppStore } from "../store/modules/app";
|
import { useAppStore } from "../store/modules/app.js";
|
||||||
import { useUserStore } from "../store/modules/user";
|
import { useUserStore } from "../store/modules/user.js";
|
||||||
import TGConstant from "../web/constant/TGConstant";
|
import TGConstant from "../web/constant/TGConstant.js";
|
||||||
import { getCookieTokenBySToken } from "../web/request/getCookieToken";
|
import { getCookieTokenBySToken } from "../web/request/getCookieToken.js";
|
||||||
import TGRequest from "../web/request/TGRequest";
|
import TGRequest from "../web/request/TGRequest.js";
|
||||||
import { getDS4JS } from "../web/utils/getRequestHeader";
|
import { getDS4JS } from "../web/utils/getRequestHeader.js";
|
||||||
|
|
||||||
import { parseLink } from "./linkParser";
|
import { parseLink } from "./linkParser.js";
|
||||||
import TGLogger from "./TGLogger";
|
import TGLogger from "./TGLogger.js";
|
||||||
import { createPost } from "./TGWindow";
|
import { createPost } from "./TGWindow.js";
|
||||||
import { getDeviceInfo } from "./toolFunc";
|
import { getDeviceInfo } from "./toolFunc.js";
|
||||||
|
|
||||||
// invoke 参数
|
// invoke 参数
|
||||||
interface InvokeArg {
|
interface InvokeArg {
|
||||||
|
|||||||
@@ -7,11 +7,11 @@
|
|||||||
import { dialog, fs, http, path } from "@tauri-apps/api";
|
import { dialog, fs, http, path } from "@tauri-apps/api";
|
||||||
import html2canvas from "html2canvas";
|
import html2canvas from "html2canvas";
|
||||||
|
|
||||||
import showConfirm from "../components/func/confirm";
|
import showConfirm from "../components/func/confirm.js";
|
||||||
import showSnackbar from "../components/func/snackbar";
|
import showSnackbar from "../components/func/snackbar.js";
|
||||||
|
|
||||||
import TGLogger from "./TGLogger";
|
import TGLogger from "./TGLogger.js";
|
||||||
import { bytesToSize } from "./toolFunc";
|
import { bytesToSize } from "./toolFunc.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 保存图片-canvas
|
* @description 保存图片-canvas
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
import { invoke, window as TauriWindow } from "@tauri-apps/api";
|
import { invoke, window as TauriWindow } from "@tauri-apps/api";
|
||||||
import type { WindowOptions } from "@tauri-apps/api/window";
|
import type { WindowOptions } from "@tauri-apps/api/window";
|
||||||
|
|
||||||
import TGLogger from "./TGLogger";
|
import TGLogger from "./TGLogger.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 创建TG窗口
|
* @description 创建TG窗口
|
||||||
@@ -50,7 +50,7 @@ export function createTGWindow(
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
createTGWindow(url, label, title, width, height, resizable, visible);
|
createTGWindow(url, label, title, width, height, resizable, visible);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err: unknown) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -61,11 +61,11 @@ export function createTGWindow(
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
console.log(`[createTGWindow][${label}] ${title} created.`);
|
console.log(`[createTGWindow][${label}] ${title} created.`);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err: unknown) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err: unknown) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ export async function verifyUiafData(path: string): Promise<boolean> {
|
|||||||
try {
|
try {
|
||||||
const fileJson = JSON.parse(fileData);
|
const fileJson = JSON.parse(fileData);
|
||||||
if (!validate(fileJson)) {
|
if (!validate(fileJson)) {
|
||||||
|
if (validate.errors === undefined || validate.errors === null) return false;
|
||||||
const error: ErrorObject = validate.errors[0];
|
const error: ErrorObject = validate.errors[0];
|
||||||
showSnackbar({
|
showSnackbar({
|
||||||
text: `${error.instancePath || error.schemaPath} ${error.message}`,
|
text: `${error.instancePath || error.schemaPath} ${error.message}`,
|
||||||
@@ -89,6 +90,7 @@ export async function verifyUiafDataClipboard(): Promise<boolean> {
|
|||||||
try {
|
try {
|
||||||
const fileJson = JSON.parse(data);
|
const fileJson = JSON.parse(data);
|
||||||
if (!validate(fileJson)) {
|
if (!validate(fileJson)) {
|
||||||
|
if (validate.errors === undefined || validate.errors === null) return false;
|
||||||
const error: ErrorObject = validate.errors[0];
|
const error: ErrorObject = validate.errors[0];
|
||||||
showSnackbar({
|
showSnackbar({
|
||||||
text: `${error.instancePath || error.schemaPath} ${error.message}`,
|
text: `${error.instancePath || error.schemaPath} ${error.message}`,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import showSnackbar from "../components/func/snackbar.js";
|
|||||||
import { UigfSchema } from "../data/index.js";
|
import { UigfSchema } from "../data/index.js";
|
||||||
|
|
||||||
import TGLogger from "./TGLogger.js";
|
import TGLogger from "./TGLogger.js";
|
||||||
import { timestampToDate } from "./toolFunc";
|
import { timestampToDate } from "./toolFunc.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取 UIGF 时区
|
* @description 获取 UIGF 时区
|
||||||
@@ -83,6 +83,7 @@ export async function verifyUigfData(path: string): Promise<boolean> {
|
|||||||
try {
|
try {
|
||||||
const fileJson = JSON.parse(fileData);
|
const fileJson = JSON.parse(fileData);
|
||||||
if (!validate(fileJson)) {
|
if (!validate(fileJson)) {
|
||||||
|
if (!validate.errors || validate.errors.length === 0) return false;
|
||||||
const error: ErrorObject = validate.errors[0];
|
const error: ErrorObject = validate.errors[0];
|
||||||
showSnackbar({
|
showSnackbar({
|
||||||
text: `${error.instancePath || error.schemaPath} ${error.message}`,
|
text: `${error.instancePath || error.schemaPath} ${error.message}`,
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
|
|
||||||
import { emit } from "@tauri-apps/api/event";
|
import { emit } from "@tauri-apps/api/event";
|
||||||
|
|
||||||
import showConfirm from "../components/func/confirm";
|
import showConfirm from "../components/func/confirm.js";
|
||||||
import showSnackbar from "../components/func/snackbar";
|
import showSnackbar from "../components/func/snackbar.js";
|
||||||
|
|
||||||
import TGClient from "./TGClient";
|
import TGClient from "./TGClient.js";
|
||||||
import { createPost } from "./TGWindow";
|
import { createPost } from "./TGWindow.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @function parsePost
|
* @function parsePost
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
import { os, path } from "@tauri-apps/api";
|
import { os, path } from "@tauri-apps/api";
|
||||||
import colorConvert from "color-convert";
|
import colorConvert from "color-convert";
|
||||||
import type { KEYWORD } from "color-convert/conversions";
|
import type { KEYWORD } from "color-convert/conversions.js";
|
||||||
import { v4 } from "uuid";
|
import { v4 } from "uuid";
|
||||||
import { score } from "wcag-color";
|
import { score } from "wcag-color";
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ import { useRoute } from "vue-router";
|
|||||||
|
|
||||||
import TSwitchTheme from "../components/app/t-switchTheme.vue";
|
import TSwitchTheme from "../components/app/t-switchTheme.vue";
|
||||||
import ToLoading from "../components/overlay/to-loading.vue";
|
import ToLoading from "../components/overlay/to-loading.vue";
|
||||||
import { AnnoLang, AnnoServer } from "../web/request/getAnno";
|
import { AnnoLang, AnnoServer } from "../web/request/getAnno.js";
|
||||||
import TGRequest from "../web/request/TGRequest";
|
import TGRequest from "../web/request/TGRequest.js";
|
||||||
|
|
||||||
// loading
|
// loading
|
||||||
const loading = ref<boolean>(true);
|
const loading = ref<boolean>(true);
|
||||||
|
|||||||
@@ -30,13 +30,13 @@ import { useRoute } from "vue-router";
|
|||||||
import TSwitchTheme from "../components/app/t-switchTheme.vue";
|
import TSwitchTheme from "../components/app/t-switchTheme.vue";
|
||||||
import TShareBtn from "../components/main/t-shareBtn.vue";
|
import TShareBtn from "../components/main/t-shareBtn.vue";
|
||||||
import ToLoading from "../components/overlay/to-loading.vue";
|
import ToLoading from "../components/overlay/to-loading.vue";
|
||||||
import { useAppStore } from "../store/modules/app";
|
import { useAppStore } from "../store/modules/app.js";
|
||||||
import TGLogger from "../utils/TGLogger";
|
import TGLogger from "../utils/TGLogger.js";
|
||||||
import { saveImgLocal } from "../utils/TGShare";
|
import { saveImgLocal } from "../utils/TGShare.js";
|
||||||
import { createTGWindow } from "../utils/TGWindow";
|
import { createTGWindow } from "../utils/TGWindow.js";
|
||||||
import { AnnoLang, AnnoServer } from "../web/request/getAnno";
|
import { AnnoLang, AnnoServer } from "../web/request/getAnno.js";
|
||||||
import TGRequest from "../web/request/TGRequest";
|
import TGRequest from "../web/request/TGRequest.js";
|
||||||
import TGUtils from "../web/utils/TGUtils";
|
import TGUtils from "../web/utils/TGUtils.js";
|
||||||
|
|
||||||
// loading
|
// loading
|
||||||
const loading = ref<boolean>(true);
|
const loading = ref<boolean>(true);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import { useRoute } from "vue-router";
|
|||||||
|
|
||||||
import TSwitchTheme from "../components/app/t-switchTheme.vue";
|
import TSwitchTheme from "../components/app/t-switchTheme.vue";
|
||||||
import ToLoading from "../components/overlay/to-loading.vue";
|
import ToLoading from "../components/overlay/to-loading.vue";
|
||||||
import Mys from "../plugins/Mys";
|
import Mys from "../plugins/Mys/index.js";
|
||||||
|
|
||||||
// loading
|
// loading
|
||||||
const loading = ref<boolean>(true);
|
const loading = ref<boolean>(true);
|
||||||
|
|||||||
@@ -93,11 +93,11 @@ import TbCollect from "../components/post/tb-collect.vue";
|
|||||||
import TpAvatar from "../components/post/tp-avatar.vue";
|
import TpAvatar from "../components/post/tp-avatar.vue";
|
||||||
import TpParser from "../components/post/tp-parser.vue";
|
import TpParser from "../components/post/tp-parser.vue";
|
||||||
import TpoCollection from "../components/post/tpo-collection.vue";
|
import TpoCollection from "../components/post/tpo-collection.vue";
|
||||||
import Mys from "../plugins/Mys";
|
import Mys from "../plugins/Mys/index.js";
|
||||||
import { useAppStore } from "../store/modules/app";
|
import { useAppStore } from "../store/modules/app.js";
|
||||||
import TGClient from "../utils/TGClient";
|
import TGClient from "../utils/TGClient.js";
|
||||||
import TGLogger from "../utils/TGLogger";
|
import TGLogger from "../utils/TGLogger.js";
|
||||||
import { createTGWindow } from "../utils/TGWindow";
|
import { createTGWindow } from "../utils/TGWindow.js";
|
||||||
|
|
||||||
// loading
|
// loading
|
||||||
const loading = ref<boolean>(true);
|
const loading = ref<boolean>(true);
|
||||||
|
|||||||
1
src/vite-env.d.ts
vendored
1
src/vite-env.d.ts
vendored
@@ -47,5 +47,4 @@ interface ImportMetaEnv {
|
|||||||
|
|
||||||
declare interface ImportMeta {
|
declare interface ImportMeta {
|
||||||
readonly env: ImportMetaEnv;
|
readonly env: ImportMetaEnv;
|
||||||
readonly glob: (path: string) => Record<string, () => Promise<any>>;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
* @since Beta v0.3.2
|
* @since Beta v0.3.2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { BBSUserInfoApi } from "./BBS";
|
import { BBSUserInfoApi } from "./BBS.js";
|
||||||
import { ENKA_API } from "./ENKA";
|
import { ENKA_API } from "./ENKA.js";
|
||||||
import { PassportTokenApi, PassportCookieTokenApi, PassportVerifyApi } from "./Passport";
|
import { PassportTokenApi, PassportCookieTokenApi, PassportVerifyApi } from "./Passport.js";
|
||||||
import {
|
import {
|
||||||
TakumiTokensApi,
|
TakumiTokensApi,
|
||||||
TakumiRecordCardApi,
|
TakumiRecordCardApi,
|
||||||
@@ -19,7 +19,7 @@ import {
|
|||||||
TakumiCookieBindingRolesApi,
|
TakumiCookieBindingRolesApi,
|
||||||
TakumiCalculateSyncAvatarListApi,
|
TakumiCalculateSyncAvatarListApi,
|
||||||
TakumiCalculateSyncAvatarDetailApi,
|
TakumiCalculateSyncAvatarDetailApi,
|
||||||
} from "./Takumi";
|
} from "./Takumi.js";
|
||||||
|
|
||||||
// 应用 API
|
// 应用 API
|
||||||
const TGApi = {
|
const TGApi = {
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
* @since Beta v0.3.6
|
* @since Beta v0.3.6
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { BBS_APP_ID, BBS_SALT, BBS_UA_MOBILE, BBS_UA_PC, BBS_VERSION } from "./bbs";
|
import { BBS_APP_ID, BBS_SALT, BBS_UA_MOBILE, BBS_UA_PC, BBS_VERSION } from "./bbs.js";
|
||||||
import SERVER from "./server";
|
import SERVER from "./server.js";
|
||||||
import { GAME_BIZ } from "./utils";
|
import { GAME_BIZ } from "./utils.js";
|
||||||
|
|
||||||
const TGConstant = {
|
const TGConstant = {
|
||||||
BBS: {
|
BBS: {
|
||||||
|
|||||||
@@ -4,25 +4,25 @@
|
|||||||
* @since Beta v0.4.5
|
* @since Beta v0.4.5
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { genAuthkey, genAuthkey2 } from "./genAuthkey";
|
import { genAuthkey, genAuthkey2 } from "./genAuthkey.js";
|
||||||
import { getAbyss } from "./getAbyss";
|
import { getAbyss } from "./getAbyss.js";
|
||||||
import { getActionTicketBySToken } from "./getActionTicket";
|
import { getActionTicketBySToken } from "./getActionTicket.js";
|
||||||
import { getAnnoContent, getAnnoList } from "./getAnno";
|
import { getAnnoContent, getAnnoList } from "./getAnno.js";
|
||||||
import { getCookieTokenByGameToken, getCookieTokenBySToken } from "./getCookieToken";
|
import { getCookieTokenByGameToken, getCookieTokenBySToken } from "./getCookieToken.js";
|
||||||
import { getDeviceFp } from "./getDeviceFp";
|
import { getDeviceFp } from "./getDeviceFp.js";
|
||||||
// import * from "./getEnkaData.ts";
|
// import * from "./getEnkaData.ts";
|
||||||
import { getGachaLog } from "./getGachaLog";
|
import { getGachaLog } from "./getGachaLog.js";
|
||||||
import { getGameAccountsByCookie, getGameAccountsBySToken } from "./getGameAccounts";
|
import { getGameAccountsByCookie, getGameAccountsBySToken } from "./getGameAccounts.js";
|
||||||
import { getGameRecord } from "./getGameRecord";
|
import { getGameRecord } from "./getGameRecord.js";
|
||||||
import { getLTokenBySToken } from "./getLToken";
|
import { getLTokenBySToken } from "./getLToken.js";
|
||||||
import { getGameRoleListByLToken } from "./getRoleList";
|
import { getGameRoleListByLToken } from "./getRoleList.js";
|
||||||
import { getStokenByGameToken, getTokenBySToken } from "./getStoken";
|
import { getStokenByGameToken, getTokenBySToken } from "./getStoken.js";
|
||||||
import getSyncAvatarDetail from "./getSyncAvatarDetail";
|
import getSyncAvatarDetail from "./getSyncAvatarDetail.js";
|
||||||
import getSyncAvatarListAll from "./getSyncAvatarListAll";
|
import getSyncAvatarListAll from "./getSyncAvatarListAll.js";
|
||||||
import { getTokensByLoginTicket } from "./getTokens";
|
import { getTokensByLoginTicket } from "./getTokens.js";
|
||||||
import { getUserCollect } from "./getUserCollect";
|
import { getUserCollect } from "./getUserCollect.js";
|
||||||
import { getUserInfoByCookie } from "./getUserInfo";
|
import { getUserInfoByCookie } from "./getUserInfo.js";
|
||||||
import { verifyLToken } from "./verifyLToken";
|
import { verifyLToken } from "./verifyLToken.js";
|
||||||
|
|
||||||
const TGRequest = {
|
const TGRequest = {
|
||||||
Anno: {
|
Anno: {
|
||||||
|
|||||||
@@ -5,12 +5,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { http } from "@tauri-apps/api";
|
import { http } from "@tauri-apps/api";
|
||||||
|
import { Response } from "@tauri-apps/api/http";
|
||||||
|
|
||||||
import TGApi from "../api/TGApi";
|
import TGApi from "../api/TGApi.js";
|
||||||
import TGUtils from "../utils/TGUtils";
|
import TGUtils from "../utils/TGUtils.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 根据 login_ticket 获取游戏 Token,包括 stoken 和 ltoken
|
* @description 根据 login_ticket 获取游戏 Token,包括 sToken 和 lToken
|
||||||
* @since Beta v0.4.3
|
* @since Beta v0.4.3
|
||||||
* @param {string} ticket 登录票证
|
* @param {string} ticket 登录票证
|
||||||
* @param {string} uid 登录用户 uid
|
* @param {string} uid 登录用户 uid
|
||||||
@@ -20,23 +21,15 @@ export async function getTokensByLoginTicket(
|
|||||||
ticket: string,
|
ticket: string,
|
||||||
uid: string,
|
uid: string,
|
||||||
): Promise<TGApp.BBS.Response.getTokensRes[] | TGApp.BBS.Response.Base> {
|
): Promise<TGApp.BBS.Response.getTokensRes[] | TGApp.BBS.Response.Base> {
|
||||||
const cookie = {
|
const cookie = { login_ticket: ticket, login_uid: uid };
|
||||||
login_ticket: ticket,
|
|
||||||
login_uid: uid,
|
|
||||||
};
|
|
||||||
const url = TGApi.GameTokens.getTokens;
|
const url = TGApi.GameTokens.getTokens;
|
||||||
|
|
||||||
const params = { login_ticket: ticket, token_types: "3", uid };
|
const params = { login_ticket: ticket, token_types: "3", uid };
|
||||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||||
return await http
|
return await http
|
||||||
.fetch<TGApp.BBS.Response.getTokens | TGApp.BBS.Response.Base>(url, {
|
.fetch(url, { method: "GET", headers: header, query: params })
|
||||||
method: "GET",
|
.then((res: Response<TGApp.BBS.Response.getTokens | TGApp.BBS.Response.Base>) => {
|
||||||
headers: header,
|
|
||||||
query: params,
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
console.log(res);
|
console.log(res);
|
||||||
if (res.data.retcode !== 0) return <TGApp.BBS.Response.Base>res.data;
|
if (res.data.retcode !== 0) return res.data;
|
||||||
return res.data.data.list;
|
return res.data.data.list;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { http } from "@tauri-apps/api";
|
import { http } from "@tauri-apps/api";
|
||||||
|
import type { Response } from "@tauri-apps/api/http";
|
||||||
|
|
||||||
import TGApi from "../api/TGApi";
|
import TGApi from "../api/TGApi.js";
|
||||||
import TGUtils from "../utils/TGUtils";
|
import TGUtils from "../utils/TGUtils.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 根据 cookie 获取用户信息
|
* @description 根据 cookie 获取用户信息
|
||||||
@@ -28,12 +29,8 @@ export async function getUserInfoByCookie(
|
|||||||
const params = { gids: "2" };
|
const params = { gids: "2" };
|
||||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common", true);
|
const header = TGUtils.User.getHeader(cookie, "GET", params, "common", true);
|
||||||
return await http
|
return await http
|
||||||
.fetch<TGApp.Plugins.Mys.User.HomeResponse | TGApp.BBS.Response.Base>(url, {
|
.fetch(url, { method: "GET", headers: header, query: params })
|
||||||
method: "GET",
|
.then((res: Response<TGApp.Plugins.Mys.User.HomeResponse | TGApp.BBS.Response.Base>) => {
|
||||||
headers: header,
|
|
||||||
query: params,
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
if (res.data.retcode !== 0) return res.data;
|
if (res.data.retcode !== 0) return res.data;
|
||||||
return res.data.data.user_info;
|
return res.data.data.user_info;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,9 +5,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { http } from "@tauri-apps/api";
|
import { http } from "@tauri-apps/api";
|
||||||
|
import type { Response } from "@tauri-apps/api/http";
|
||||||
|
|
||||||
import TGApi from "../api/TGApi";
|
import TGApi from "../api/TGApi.js";
|
||||||
import TGUtils from "../utils/TGUtils";
|
import TGUtils from "../utils/TGUtils.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 验证 ltoken 有效性,返回 mid
|
* @description 验证 ltoken 有效性,返回 mid
|
||||||
@@ -21,20 +22,13 @@ export async function verifyLToken(
|
|||||||
ltuid: string,
|
ltuid: string,
|
||||||
): Promise<string | TGApp.BBS.Response.Base> {
|
): Promise<string | TGApp.BBS.Response.Base> {
|
||||||
const url = TGApi.GameTokens.verifyLToken;
|
const url = TGApi.GameTokens.verifyLToken;
|
||||||
const cookie = {
|
const cookie = { ltoken, ltuid };
|
||||||
ltoken,
|
|
||||||
ltuid,
|
|
||||||
};
|
|
||||||
const data = { ltoken };
|
const data = { ltoken };
|
||||||
const header = TGUtils.User.getHeader(cookie, "POST", data, "common");
|
const header = TGUtils.User.getHeader(cookie, "POST", data, "common");
|
||||||
return await http
|
return await http
|
||||||
.fetch<TGApp.BBS.Response.verifyUserInfoBySToken | TGApp.BBS.Response.Base>(url, {
|
.fetch(url, { method: "POST", headers: header, body: http.Body.json(data) })
|
||||||
method: "POST",
|
.then((res: Response<TGApp.BBS.Response.verifyUserInfoBySToken | TGApp.BBS.Response.Base>) => {
|
||||||
headers: header,
|
if (res.data.retcode !== 0) return <TGApp.BBS.Response.Base>res.data;
|
||||||
body: http.Body.json(data),
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
if (res.data.retcode !== 0) return res.data;
|
|
||||||
return res.data.data.user_info.mid;
|
return res.data.data.user_info.mid;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
* @since Beta v0.3.4
|
* @since Beta v0.3.4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { getAnnoCard } from "./getAnnoCard";
|
import { getAnnoCard } from "./getAnnoCard.js";
|
||||||
import { getRequestHeader } from "./getRequestHeader";
|
import { getRequestHeader } from "./getRequestHeader.js";
|
||||||
import { parseAnnoContent } from "./parseAnno";
|
import { parseAnnoContent } from "./parseAnno.js";
|
||||||
import { getServerByUid, transCookie } from "./tools";
|
import { getServerByUid, transCookie } from "./tools.js";
|
||||||
|
|
||||||
const TGUtils = {
|
const TGUtils = {
|
||||||
Anno: {
|
Anno: {
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
import Md5 from "js-md5";
|
import Md5 from "js-md5";
|
||||||
|
|
||||||
import { getDeviceInfo, getRandomString } from "../../utils/toolFunc";
|
import { getDeviceInfo, getRandomString } from "../../utils/toolFunc.js";
|
||||||
import TGConstant from "../constant/TGConstant";
|
import TGConstant from "../constant/TGConstant.js";
|
||||||
|
|
||||||
import { transCookie, transParams } from "./tools";
|
import { transCookie, transParams } from "./tools.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取 salt
|
* @description 获取 salt
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
* @since Beta v0.4.7
|
* @since Beta v0.4.7
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { saveImgLocal } from "../../utils/TGShare";
|
import { saveImgLocal } from "../../utils/TGShare.js";
|
||||||
import { isColorSimilar } from "../../utils/toolFunc";
|
import { isColorSimilar } from "../../utils/toolFunc.js";
|
||||||
|
|
||||||
import { decodeRegExp } from "./tools";
|
import { decodeRegExp } from "./tools.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 解析 a
|
* @description 解析 a
|
||||||
|
|||||||
Reference in New Issue
Block a user