mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-14 09:38:13 +08:00
🗑️ 增加几个 callback 处理
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* @since Beta v0.3.6
|
||||
*/
|
||||
|
||||
import { genAuthkey } from "./genAuthkey";
|
||||
import { genAuthkey, genAuthkey2 } from "./genAuthkey";
|
||||
import { getAbyss } from "./getAbyss";
|
||||
import { getActionTicketBySToken } from "./getActionTicket";
|
||||
import { getAnnoContent, getAnnoList } from "./getAnno";
|
||||
@@ -33,6 +33,7 @@ const TGRequest = {
|
||||
},
|
||||
User: {
|
||||
getAuthkey: genAuthkey,
|
||||
getAuthkey2: genAuthkey2,
|
||||
getGachaLog,
|
||||
getRecord: getGameRecord,
|
||||
byLoginTicket: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file web/request/genAuthkey.ts
|
||||
* @description 生成 authkey
|
||||
* @since Beta v0.3.0
|
||||
* @since Beta v0.3.7
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
@@ -39,3 +39,25 @@ export async function genAuthkey(
|
||||
return res.data;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 生成 authkey
|
||||
* @since Beta v0.3.0
|
||||
* @param {Record<string, string>} cookie cookie // stoken_v2 & mid
|
||||
* @param {object} payload payload
|
||||
* @returns {Promise<string|TGApp.BBS.Response.Base>} authkey
|
||||
*/
|
||||
export async function genAuthkey2(
|
||||
cookie: Record<string, string>,
|
||||
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);
|
||||
return await http
|
||||
.fetch<TGApp.BBS.Response.Base>(url, {
|
||||
method: "POST",
|
||||
headers: header,
|
||||
body: http.Body.json(payload),
|
||||
})
|
||||
.then((res) => res.data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user