直接启动原神

close #80
This commit is contained in:
目棃
2024-09-30 19:21:50 +08:00
parent 911aeed9ea
commit df3158f428
13 changed files with 541 additions and 4049 deletions

View File

@@ -1,13 +1,14 @@
/**
* @file web/request/TGRequest.ts
* @description 应用用到的请求函数
* @since Beta v0.5.3
* @since Beta v0.6.0
*/
import { genAuthkey, genAuthkey2 } from "./genAuthkey.js";
import { getAbyss } from "./getAbyss.js";
import { getActionTicketBySToken } from "./getActionTicket.js";
import { getAnnoContent, getAnnoList } from "./getAnno.js";
import getAuthTicket from "./getAuthTicket.js";
import { getAvatarList, getAvatarDetail } from "./getAvatarDetail.js";
import getCode from "./getCode.js";
import { getCookieTokenByGameToken, getCookieTokenBySToken } from "./getCookieToken.js";
@@ -35,6 +36,7 @@ const TGRequest = {
User: {
getAuthkey: genAuthkey,
getAuthkey2: genAuthkey2,
getAuthTicket,
getCollect: getUserCollect,
getGachaLog,
getRecord: getGameRecord,

View File

@@ -0,0 +1,41 @@
/**
* @files web/request/getAuthTicket.ts
* @description 获取登录 ticket
* @since Beta v0.6.0
*/
import TGHttp from "../../utils/TGHttp.js";
/**
* @description 获取登录ticket
* @since Beta v0.6.0
* @param {TGApp.Sqlite.Account.Game} account - 账户
* @param {TGApp.App.Account.Cookie} cookie - cookie
* @returns {Promise<TGApp.BBS.Response.Base|string>}
*/
async function getAuthTicket(
account: TGApp.Sqlite.Account.Game,
cookie: TGApp.App.Account.Cookie,
): Promise<TGApp.BBS.Response.Base | string> {
const url =
"https://passport-api.mihoyo.com/account/ma-cn-verifier/app/createAuthTicketByGameBiz";
const params = {
game_biz: account.gameBiz,
stoken: cookie.stoken,
uid: account.gameUid,
mid: cookie.mid,
};
const header = {
"x-rpc-client_type": "3",
"x-rpc-app_id": "ddxf5dufpuyo",
};
const resp = await TGHttp<TGApp.BBS.Response.getAuthTicketByGameBiz>(url, {
method: "POST",
headers: header,
query: params,
});
if (resp.retcode !== 0) return <TGApp.BBS.Response.Base>resp;
return resp.data.ticket;
}
export default getAuthTicket;