mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-14 09:38:13 +08:00
🎨 一些代码调整
This commit is contained in:
@@ -11,7 +11,7 @@ import TGHttp from "../../../utils/TGHttp.js";
|
||||
import { getDeviceInfo } from "../../../utils/toolFunc.js";
|
||||
import TGConstant from "../../../web/constant/TGConstant.js";
|
||||
|
||||
const PUB_KEY_STR = `-----BEGIN PUBLIC KEY-----
|
||||
const PUB_KEY_STR: Readonly<string> = `-----BEGIN PUBLIC KEY-----
|
||||
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDvekdPMHN3AYhm/vktJT+YJr7cI5DcsNKqdsx5DZX0gDuWFuIjzdwButrIYPNmRJ1G8ybDIF7oDW2eEpm5sMbL9zs
|
||||
9ExXCdvqrn51qELbqj0XxtMTIpaCHFSI50PfPpTFV9Xt/hmyVwokoOXFlAEgCn+Q
|
||||
CgGs52bFoYMtyi+xEQIDAQAB
|
||||
@@ -55,7 +55,7 @@ export async function getCaptcha(
|
||||
"x-rpc-aigis": aigis || "",
|
||||
"x-rpc-app_version": TGConstant.BBS.VERSION,
|
||||
"x-rpc-client_type": "2",
|
||||
"x-rpc-app_id": TGConstant.BBS.APP_ID,
|
||||
"x-rpc-app_id": "bll8iq97cem8",
|
||||
"x-rpc-device_fp": device_fp,
|
||||
"x-rpc-device_name": device_name,
|
||||
"x-rpc-device_id": device_id,
|
||||
@@ -63,7 +63,7 @@ export async function getCaptcha(
|
||||
"user-agent": TGConstant.BBS.UA_MOBILE,
|
||||
"content-type": "application/json",
|
||||
referer: "https://user.miyoushe.com/",
|
||||
"x-rpc-game_biz": TGConstant.GAME_BIZ,
|
||||
"x-rpc-game_biz": "hk4e_cn",
|
||||
};
|
||||
const resp = await TGHttp<
|
||||
TGApp.Plugins.Mys.CaptchaLogin.CaptchaResponse | TGApp.BBS.Response.Base
|
||||
@@ -117,7 +117,7 @@ export async function doCaptchaLogin(
|
||||
"x-rpc-aigis": aigis || "",
|
||||
"x-rpc-app_version": TGConstant.BBS.VERSION,
|
||||
"x-rpc-client_type": "2",
|
||||
"x-rpc-app_id": TGConstant.BBS.APP_ID,
|
||||
"x-rpc-app_id": "bll8iq97cem8",
|
||||
"x-rpc-device_fp": device_fp,
|
||||
"x-rpc-device_name": device_name,
|
||||
"x-rpc-device_id": device_id,
|
||||
|
||||
@@ -18,15 +18,15 @@ const APP_ID = 8;
|
||||
export async function getLoginQr(): Promise<
|
||||
TGApp.Plugins.Mys.GameLogin.GetLoginQrData | TGApp.BBS.Response.Base
|
||||
> {
|
||||
const url = "https://hk4e-sdk.mihoyo.com/hk4e_cn/combo/panda/qrcode/fetch";
|
||||
const device = getDeviceInfo("device_id");
|
||||
const data = { app_id: APP_ID, device };
|
||||
const header = getRequestHeader({}, "POST", data, "common");
|
||||
const data: Record<string, string | number> = {
|
||||
app_id: APP_ID,
|
||||
device: getDeviceInfo("device_id"),
|
||||
};
|
||||
const resp = await TGHttp<
|
||||
TGApp.Plugins.Mys.GameLogin.GetLoginQrResponse | TGApp.BBS.Response.Base
|
||||
>(url, {
|
||||
>("https://hk4e-sdk.mihoyo.com/hk4e_cn/combo/panda/qrcode/fetch", {
|
||||
method: "POST",
|
||||
headers: header,
|
||||
headers: getRequestHeader({}, "POST", data),
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
if (resp.retcode !== 0) return <TGApp.BBS.Response.Base>resp;
|
||||
@@ -42,15 +42,16 @@ export async function getLoginQr(): Promise<
|
||||
export async function getLoginStatus(
|
||||
ticket: string,
|
||||
): Promise<TGApp.Plugins.Mys.GameLogin.GetLoginStatusData | TGApp.BBS.Response.Base> {
|
||||
const url = "https://hk4e-sdk.mihoyo.com/hk4e_cn/combo/panda/qrcode/query";
|
||||
const device = getDeviceInfo("device_id");
|
||||
const data = { app_id: APP_ID, device, ticket };
|
||||
const header = getRequestHeader({}, "POST", data, "common");
|
||||
const data: Record<string, string | number> = {
|
||||
app_id: APP_ID,
|
||||
device: getDeviceInfo("device_id"),
|
||||
ticket,
|
||||
};
|
||||
const resp = await TGHttp<
|
||||
TGApp.Plugins.Mys.GameLogin.GetLoginStatusResponse | TGApp.BBS.Response.Base
|
||||
>(url, {
|
||||
>("https://hk4e-sdk.mihoyo.com/hk4e_cn/combo/panda/qrcode/query", {
|
||||
method: "POST",
|
||||
headers: header,
|
||||
headers: getRequestHeader({}, "POST", data),
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
if (resp.retcode !== 0) return <TGApp.BBS.Response.Base>resp;
|
||||
|
||||
Reference in New Issue
Block a user