mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-15 09:48:14 +08:00
🎨 一些优化
* 优化公告解析逻辑 * 咨讯页loading显示版块名称 * 移除无用文件
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
import TGHttp from "../../utils/TGHttp.js";
|
||||
import TGConstant from "../constant/TGConstant.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
import { getRequestHeader } from "../utils/getRequestHeader.js";
|
||||
|
||||
/**
|
||||
* @description 生成 authkey
|
||||
@@ -23,11 +23,11 @@ export async function genAuthkey(
|
||||
const ck = { stoken: cookie.stoken, mid: cookie.mid };
|
||||
const data = {
|
||||
auth_appid: "webview_gacha",
|
||||
game_biz: TGConstant.Utils.GAME_BIZ,
|
||||
game_biz: TGConstant.GAME_BIZ,
|
||||
game_uid: account.gameUid,
|
||||
region: account.region,
|
||||
};
|
||||
const header = TGUtils.User.getHeader(ck, "POST", JSON.stringify(data), "lk2", true);
|
||||
const header = getRequestHeader(ck, "POST", JSON.stringify(data), "lk2", true);
|
||||
const resp = await TGHttp<TGApp.Game.Gacha.AuthkeyResponse | TGApp.BBS.Response.Base>(url, {
|
||||
method: "POST",
|
||||
headers: header,
|
||||
@@ -49,7 +49,7 @@ export async function genAuthkey2(
|
||||
payload: Record<string, string>,
|
||||
): Promise<TGApp.BBS.Response.Base> {
|
||||
const url = "https://api-takumi.mihoyo.com/binding/api/genAuthKey";
|
||||
const header = TGUtils.User.getHeader(cookie, "POST", JSON.stringify(payload), "lk2", true);
|
||||
const header = getRequestHeader(cookie, "POST", JSON.stringify(payload), "lk2", true);
|
||||
return await TGHttp<TGApp.BBS.Response.Base>(url, {
|
||||
method: "POST",
|
||||
headers: header,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import TGHttp from "../../utils/TGHttp.js";
|
||||
import TGApi from "../api/TGApi.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
import { getRequestHeader } from "../utils/getRequestHeader.js";
|
||||
|
||||
/**
|
||||
* @description 获取深渊信息
|
||||
@@ -29,7 +29,7 @@ export async function getAbyss(
|
||||
ltoken: cookie.ltoken,
|
||||
ltuid: cookie.ltuid,
|
||||
};
|
||||
const header = TGUtils.User.getHeader(ck, "GET", params, "common");
|
||||
const header = getRequestHeader(ck, "GET", params, "common");
|
||||
const resp = await TGHttp<TGApp.Game.Abyss.Response | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import TGHttp from "../../utils/TGHttp.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
import { getRequestHeader } from "../utils/getRequestHeader.js";
|
||||
|
||||
/**
|
||||
* @description 通过 stoken 获取 ActionTicket
|
||||
@@ -25,7 +25,7 @@ export async function getActionTicketBySToken(
|
||||
const url = "https://api-takumi.mihoyo.com/auth/api/getActionTicketBySToken";
|
||||
const params = { action_type: ActionType, stoken: SToken, uid: UID };
|
||||
const cookie = { mid: MID, stoken: SToken };
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "k2");
|
||||
const header = getRequestHeader(cookie, "GET", params, "k2");
|
||||
return await TGHttp<TGApp.BBS.Response.getActionTicketBySToken>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import TGHttp from "../../utils/TGHttp.js";
|
||||
import TGApi from "../api/TGApi.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
import { getRequestHeader } from "../utils/getRequestHeader.js";
|
||||
|
||||
/**
|
||||
* @description 手动刷新角色数据
|
||||
@@ -22,7 +22,7 @@ export async function getAvatarIndex(
|
||||
const url = TGApi.GameData.getUserBase;
|
||||
const params = { avatar_list_type: 1, role_id: user.gameUid, server: user.region };
|
||||
const ck = { cookie_token: cookie.cookie_token, account_id: cookie.account_id };
|
||||
const header = TGUtils.User.getHeader(ck, "GET", params, "common");
|
||||
const header = getRequestHeader(ck, "GET", params, "common");
|
||||
return await TGHttp<TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
@@ -44,7 +44,7 @@ export async function getAvatarList(
|
||||
const url = TGApi.GameData.byCookie.getAvatarList;
|
||||
const data = { role_id: user.gameUid, server: user.region };
|
||||
const ck = { cookie_token: cookie.cookie_token, account_id: cookie.account_id };
|
||||
const header = TGUtils.User.getHeader(ck, "POST", data, "common");
|
||||
const header = getRequestHeader(ck, "POST", data, "common");
|
||||
const resp = await TGHttp<TGApp.Game.Avatar.ListResponse | TGApp.BBS.Response.Base>(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(data),
|
||||
@@ -70,7 +70,7 @@ export async function getAvatarDetail(
|
||||
const url = TGApi.GameData.byCookie.getAvatarDetail;
|
||||
const data = { role_id: user.gameUid, server: user.region, character_ids: avatarIds };
|
||||
const ck = { cookie_token: cookie.cookie_token, account_id: cookie.account_id };
|
||||
const header = TGUtils.User.getHeader(ck, "POST", data, "common");
|
||||
const header = getRequestHeader(ck, "POST", data, "common");
|
||||
const resp = await TGHttp<TGApp.Game.Avatar.DetailResponse | TGApp.BBS.Response.Base>(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(data),
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import TGHttp from "../../utils/TGHttp.js";
|
||||
import TGApi from "../api/TGApi.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
import { getRequestHeader } from "../utils/getRequestHeader.js";
|
||||
|
||||
/**
|
||||
* @description 根据 stoken 获取 cookie_token
|
||||
@@ -22,7 +22,7 @@ export async function getCookieTokenBySToken(
|
||||
const url = TGApi.GameTokens.getCookieToken;
|
||||
const cookie = { mid: Mid, stoken: Stoken };
|
||||
const params = { stoken: Stoken };
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||
const header = getRequestHeader(cookie, "GET", params, "common");
|
||||
const resp = await TGHttp<TGApp.BBS.Response.getCookieTokenBySToken | TGApp.BBS.Response.Base>(
|
||||
url,
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import TGHttp from "../../utils/TGHttp.js";
|
||||
import TGApi from "../api/TGApi.js";
|
||||
import TGConstant from "../constant/TGConstant.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
import { getRequestHeader } from "../utils/getRequestHeader.js";
|
||||
|
||||
/**
|
||||
* @description 通过 stoken 获取游戏账号
|
||||
@@ -22,7 +22,7 @@ export async function getGameAccountsBySToken(
|
||||
): Promise<TGApp.BBS.Account.GameAccount[] | TGApp.BBS.Response.Base> {
|
||||
const url = TGApi.GameData.bySToken.getAccounts;
|
||||
const cookie = { stuid, stoken };
|
||||
const params = { stoken, stuid, game_biz: TGConstant.Utils.GAME_BIZ };
|
||||
const params = { stoken, stuid, game_biz: TGConstant.GAME_BIZ };
|
||||
return await getGameAccounts(url, cookie, params);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ export async function getGameAccountsByCookie(
|
||||
): Promise<TGApp.BBS.Account.GameAccount[] | TGApp.BBS.Response.Base> {
|
||||
const url = TGApi.GameData.byCookie.getAccounts;
|
||||
const cookie = { account_id, cookie_token };
|
||||
const params = { game_biz: TGConstant.Utils.GAME_BIZ };
|
||||
const params = { game_biz: TGConstant.GAME_BIZ };
|
||||
return await getGameAccounts(url, cookie, params);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ async function getGameAccounts(
|
||||
cookie: Record<string, string>,
|
||||
params: Record<string, string>,
|
||||
): Promise<TGApp.BBS.Response.Base | TGApp.BBS.Account.GameAccount[]> {
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||
const header = getRequestHeader(cookie, "GET", params, "common");
|
||||
const resp = await TGHttp<TGApp.BBS.Response.getGameAccounts | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import TGHttp from "../../utils/TGHttp.js";
|
||||
import TGApi from "../api/TGApi.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
import { getRequestHeader } from "../utils/getRequestHeader.js";
|
||||
|
||||
/**
|
||||
* @description 获取用户游戏数据
|
||||
@@ -23,7 +23,7 @@ export async function getGameRecord(
|
||||
): Promise<TGApp.Game.Record.FullData | TGApp.BBS.Response.Base> {
|
||||
const url = TGApi.GameData.getUserBase;
|
||||
const params = { role_id: user.gameUid, server: user.region };
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||
const header = getRequestHeader(cookie, "GET", params, "common");
|
||||
const resp = await TGHttp<TGApp.Game.Record.Response | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import TGHttp from "../../utils/TGHttp.js";
|
||||
import TGApi from "../api/TGApi.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
import { getRequestHeader } from "../utils/getRequestHeader.js";
|
||||
|
||||
/**
|
||||
* @description 根据 stoken_v2 获取 ltoken
|
||||
@@ -22,7 +22,7 @@ export async function getLTokenBySToken(
|
||||
const url = TGApi.GameTokens.getLToken;
|
||||
const cookie = { mid: Mid, stoken: Stoken };
|
||||
const params = { stoken: Stoken };
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||
const header = getRequestHeader(cookie, "GET", params, "common");
|
||||
const resp = await TGHttp<TGApp.BBS.Response.getLTokenBySToken | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import TGHttp from "../../utils/TGHttp.js";
|
||||
import TGApi from "../api/TGApi.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
import { getRequestHeader } from "../utils/getRequestHeader.js";
|
||||
|
||||
/**
|
||||
* @description 获取剧诗信息
|
||||
@@ -27,7 +27,7 @@ export async function getRoleCombat(
|
||||
ltoken: cookie.ltoken,
|
||||
ltuid: cookie.ltuid,
|
||||
};
|
||||
const header = TGUtils.User.getHeader(ck, "GET", params, "common");
|
||||
const header = getRequestHeader(ck, "GET", params, "common");
|
||||
const resp = await TGHttp<TGApp.Game.Combat.Response | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import TGHttp from "../../utils/TGHttp.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
import { getRequestHeader } from "../utils/getRequestHeader.js";
|
||||
|
||||
/**
|
||||
* @description 获取用户收藏帖子
|
||||
@@ -22,7 +22,7 @@ export async function getUserCollect(
|
||||
): Promise<TGApp.BBS.Collection.PostRespData | TGApp.BBS.Response.Base> {
|
||||
const url = "https://bbs-api.miyoushe.com/post/wapi/userFavouritePost";
|
||||
const params = { size: "20", uid, offset };
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||
const header = getRequestHeader(cookie, "GET", params, "common");
|
||||
const resp = await TGHttp<TGApp.BBS.Collection.PostResponse | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import TGHttp from "../../utils/TGHttp.js";
|
||||
import TGApi from "../api/TGApi.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
import { getRequestHeader } from "../utils/getRequestHeader.js";
|
||||
|
||||
/**
|
||||
* @description 根据 cookie 获取用户信息
|
||||
@@ -25,7 +25,7 @@ export async function getUserInfoByCookie(
|
||||
};
|
||||
const url = TGApi.GameData.byCookie.getUserInfo;
|
||||
const params = { gids: "2" };
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common", true);
|
||||
const header = getRequestHeader(cookie, "GET", params, "common", true);
|
||||
const resp = await TGHttp<TGApp.Plugins.Mys.User.HomeResponse | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import TGHttp from "../../utils/TGHttp.js";
|
||||
import TGApi from "../api/TGApi.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
import { getRequestHeader } from "../utils/getRequestHeader.js";
|
||||
|
||||
/**
|
||||
* @description 验证 ltoken 有效性,返回 mid
|
||||
@@ -22,7 +22,7 @@ export async function verifyLToken(
|
||||
const url = TGApi.GameTokens.verifyLToken;
|
||||
const cookie = { ltoken, ltuid };
|
||||
const data = { ltoken };
|
||||
const header = TGUtils.User.getHeader(cookie, "POST", data, "common");
|
||||
const header = getRequestHeader(cookie, "POST", data, "common");
|
||||
const resp = await TGHttp<TGApp.BBS.Response.verifyUserInfoBySToken | TGApp.BBS.Response.Base>(
|
||||
url,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user