mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
✏️ 继续修正 import
This commit is contained in:
@@ -5,9 +5,9 @@
|
||||
* @since Beta v0.3.2
|
||||
*/
|
||||
|
||||
import { BBSUserInfoApi } from "./BBS";
|
||||
import { ENKA_API } from "./ENKA";
|
||||
import { PassportTokenApi, PassportCookieTokenApi, PassportVerifyApi } from "./Passport";
|
||||
import { BBSUserInfoApi } from "./BBS.js";
|
||||
import { ENKA_API } from "./ENKA.js";
|
||||
import { PassportTokenApi, PassportCookieTokenApi, PassportVerifyApi } from "./Passport.js";
|
||||
import {
|
||||
TakumiTokensApi,
|
||||
TakumiRecordCardApi,
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
TakumiCookieBindingRolesApi,
|
||||
TakumiCalculateSyncAvatarListApi,
|
||||
TakumiCalculateSyncAvatarDetailApi,
|
||||
} from "./Takumi";
|
||||
} from "./Takumi.js";
|
||||
|
||||
// 应用 API
|
||||
const TGApi = {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* @since Beta v0.3.6
|
||||
*/
|
||||
|
||||
import { BBS_APP_ID, BBS_SALT, BBS_UA_MOBILE, BBS_UA_PC, BBS_VERSION } from "./bbs";
|
||||
import SERVER from "./server";
|
||||
import { GAME_BIZ } from "./utils";
|
||||
import { BBS_APP_ID, BBS_SALT, BBS_UA_MOBILE, BBS_UA_PC, BBS_VERSION } from "./bbs.js";
|
||||
import SERVER from "./server.js";
|
||||
import { GAME_BIZ } from "./utils.js";
|
||||
|
||||
const TGConstant = {
|
||||
BBS: {
|
||||
|
||||
@@ -4,25 +4,25 @@
|
||||
* @since Beta v0.4.5
|
||||
*/
|
||||
|
||||
import { genAuthkey, genAuthkey2 } from "./genAuthkey";
|
||||
import { getAbyss } from "./getAbyss";
|
||||
import { getActionTicketBySToken } from "./getActionTicket";
|
||||
import { getAnnoContent, getAnnoList } from "./getAnno";
|
||||
import { getCookieTokenByGameToken, getCookieTokenBySToken } from "./getCookieToken";
|
||||
import { getDeviceFp } from "./getDeviceFp";
|
||||
import { genAuthkey, genAuthkey2 } from "./genAuthkey.js";
|
||||
import { getAbyss } from "./getAbyss.js";
|
||||
import { getActionTicketBySToken } from "./getActionTicket.js";
|
||||
import { getAnnoContent, getAnnoList } from "./getAnno.js";
|
||||
import { getCookieTokenByGameToken, getCookieTokenBySToken } from "./getCookieToken.js";
|
||||
import { getDeviceFp } from "./getDeviceFp.js";
|
||||
// import * from "./getEnkaData.ts";
|
||||
import { getGachaLog } from "./getGachaLog";
|
||||
import { getGameAccountsByCookie, getGameAccountsBySToken } from "./getGameAccounts";
|
||||
import { getGameRecord } from "./getGameRecord";
|
||||
import { getLTokenBySToken } from "./getLToken";
|
||||
import { getGameRoleListByLToken } from "./getRoleList";
|
||||
import { getStokenByGameToken, getTokenBySToken } from "./getStoken";
|
||||
import getSyncAvatarDetail from "./getSyncAvatarDetail";
|
||||
import getSyncAvatarListAll from "./getSyncAvatarListAll";
|
||||
import { getTokensByLoginTicket } from "./getTokens";
|
||||
import { getUserCollect } from "./getUserCollect";
|
||||
import { getUserInfoByCookie } from "./getUserInfo";
|
||||
import { verifyLToken } from "./verifyLToken";
|
||||
import { getGachaLog } from "./getGachaLog.js";
|
||||
import { getGameAccountsByCookie, getGameAccountsBySToken } from "./getGameAccounts.js";
|
||||
import { getGameRecord } from "./getGameRecord.js";
|
||||
import { getLTokenBySToken } from "./getLToken.js";
|
||||
import { getGameRoleListByLToken } from "./getRoleList.js";
|
||||
import { getStokenByGameToken, getTokenBySToken } from "./getStoken.js";
|
||||
import getSyncAvatarDetail from "./getSyncAvatarDetail.js";
|
||||
import getSyncAvatarListAll from "./getSyncAvatarListAll.js";
|
||||
import { getTokensByLoginTicket } from "./getTokens.js";
|
||||
import { getUserCollect } from "./getUserCollect.js";
|
||||
import { getUserInfoByCookie } from "./getUserInfo.js";
|
||||
import { verifyLToken } from "./verifyLToken.js";
|
||||
|
||||
const TGRequest = {
|
||||
Anno: {
|
||||
|
||||
@@ -5,12 +5,13 @@
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
import { Response } from "@tauri-apps/api/http";
|
||||
|
||||
import TGApi from "../api/TGApi";
|
||||
import TGUtils from "../utils/TGUtils";
|
||||
import TGApi from "../api/TGApi.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
|
||||
/**
|
||||
* @description 根据 login_ticket 获取游戏 Token,包括 stoken 和 ltoken
|
||||
* @description 根据 login_ticket 获取游戏 Token,包括 sToken 和 lToken
|
||||
* @since Beta v0.4.3
|
||||
* @param {string} ticket 登录票证
|
||||
* @param {string} uid 登录用户 uid
|
||||
@@ -20,23 +21,15 @@ export async function getTokensByLoginTicket(
|
||||
ticket: string,
|
||||
uid: string,
|
||||
): Promise<TGApp.BBS.Response.getTokensRes[] | TGApp.BBS.Response.Base> {
|
||||
const cookie = {
|
||||
login_ticket: ticket,
|
||||
login_uid: uid,
|
||||
};
|
||||
const cookie = { login_ticket: ticket, login_uid: uid };
|
||||
const url = TGApi.GameTokens.getTokens;
|
||||
|
||||
const params = { login_ticket: ticket, token_types: "3", uid };
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||
return await http
|
||||
.fetch<TGApp.BBS.Response.getTokens | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
query: params,
|
||||
})
|
||||
.then((res) => {
|
||||
.fetch(url, { method: "GET", headers: header, query: params })
|
||||
.then((res: Response<TGApp.BBS.Response.getTokens | TGApp.BBS.Response.Base>) => {
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
import type { Response } from "@tauri-apps/api/http";
|
||||
|
||||
import TGApi from "../api/TGApi";
|
||||
import TGUtils from "../utils/TGUtils";
|
||||
import TGApi from "../api/TGApi.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
|
||||
/**
|
||||
* @description 根据 cookie 获取用户信息
|
||||
@@ -28,12 +29,8 @@ export async function getUserInfoByCookie(
|
||||
const params = { gids: "2" };
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common", true);
|
||||
return await http
|
||||
.fetch<TGApp.Plugins.Mys.User.HomeResponse | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
query: params,
|
||||
})
|
||||
.then((res) => {
|
||||
.fetch(url, { method: "GET", headers: header, query: params })
|
||||
.then((res: Response<TGApp.Plugins.Mys.User.HomeResponse | TGApp.BBS.Response.Base>) => {
|
||||
if (res.data.retcode !== 0) return res.data;
|
||||
return res.data.data.user_info;
|
||||
});
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
import type { Response } from "@tauri-apps/api/http";
|
||||
|
||||
import TGApi from "../api/TGApi";
|
||||
import TGUtils from "../utils/TGUtils";
|
||||
import TGApi from "../api/TGApi.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
|
||||
/**
|
||||
* @description 验证 ltoken 有效性,返回 mid
|
||||
@@ -21,20 +22,13 @@ export async function verifyLToken(
|
||||
ltuid: string,
|
||||
): Promise<string | TGApp.BBS.Response.Base> {
|
||||
const url = TGApi.GameTokens.verifyLToken;
|
||||
const cookie = {
|
||||
ltoken,
|
||||
ltuid,
|
||||
};
|
||||
const cookie = { ltoken, ltuid };
|
||||
const data = { ltoken };
|
||||
const header = TGUtils.User.getHeader(cookie, "POST", data, "common");
|
||||
return await http
|
||||
.fetch<TGApp.BBS.Response.verifyUserInfoBySToken | TGApp.BBS.Response.Base>(url, {
|
||||
method: "POST",
|
||||
headers: header,
|
||||
body: http.Body.json(data),
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.data.retcode !== 0) return res.data;
|
||||
.fetch(url, { method: "POST", headers: header, body: http.Body.json(data) })
|
||||
.then((res: Response<TGApp.BBS.Response.verifyUserInfoBySToken | TGApp.BBS.Response.Base>) => {
|
||||
if (res.data.retcode !== 0) return <TGApp.BBS.Response.Base>res.data;
|
||||
return res.data.data.user_info.mid;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* @since Beta v0.3.4
|
||||
*/
|
||||
|
||||
import { getAnnoCard } from "./getAnnoCard";
|
||||
import { getRequestHeader } from "./getRequestHeader";
|
||||
import { parseAnnoContent } from "./parseAnno";
|
||||
import { getServerByUid, transCookie } from "./tools";
|
||||
import { getAnnoCard } from "./getAnnoCard.js";
|
||||
import { getRequestHeader } from "./getRequestHeader.js";
|
||||
import { parseAnnoContent } from "./parseAnno.js";
|
||||
import { getServerByUid, transCookie } from "./tools.js";
|
||||
|
||||
const TGUtils = {
|
||||
Anno: {
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
import Md5 from "js-md5";
|
||||
|
||||
import { getDeviceInfo, getRandomString } from "../../utils/toolFunc";
|
||||
import TGConstant from "../constant/TGConstant";
|
||||
import { getDeviceInfo, getRandomString } from "../../utils/toolFunc.js";
|
||||
import TGConstant from "../constant/TGConstant.js";
|
||||
|
||||
import { transCookie, transParams } from "./tools";
|
||||
import { transCookie, transParams } from "./tools.js";
|
||||
|
||||
/**
|
||||
* @description 获取 salt
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* @since Beta v0.4.7
|
||||
*/
|
||||
|
||||
import { saveImgLocal } from "../../utils/TGShare";
|
||||
import { isColorSimilar } from "../../utils/toolFunc";
|
||||
import { saveImgLocal } from "../../utils/TGShare.js";
|
||||
import { isColorSimilar } from "../../utils/toolFunc.js";
|
||||
|
||||
import { decodeRegExp } from "./tools";
|
||||
import { decodeRegExp } from "./tools.js";
|
||||
|
||||
/**
|
||||
* @description 解析 a
|
||||
|
||||
Reference in New Issue
Block a user