🎨 打个补丁

This commit is contained in:
BTMuli
2023-05-20 13:44:22 +08:00
parent 4899879b02
commit 371570d7cc

View File

@@ -65,17 +65,23 @@ function getDS (method: string, data: string, saltType: string): string {
* @since Alpha v0.2.0 * @since Alpha v0.2.0
* @param {Record<string, string>} cookie cookie * @param {Record<string, string>} cookie cookie
* @param {string} method 请求方法 * @param {string} method 请求方法
* @param {Record<string, string|number>} data 请求数据 * @param {Record<string, string|number>|string} data 请求数据
* @param {string} saltType salt 类型 * @param {string} saltType salt 类型
* @returns {Record<string, string>} 请求头 * @returns {Record<string, string>} 请求头
*/ */
export function getRequestHeader (cookie: Record<string, string>, method: string, data: Record<string, string | number>, saltType: string): Record<string, string> { export function getRequestHeader (cookie: Record<string, string>, method: string, data: Record<string, string | number> | string, saltType: string): Record<string, string> {
let ds;
if (typeof data === "string") {
ds = getDS(method, data, saltType);
} else {
ds = getDS(method, transParams(data), saltType);
}
return { return {
"User-Agent": TGConstant.BBS.USER_AGENT, "User-Agent": TGConstant.BBS.USER_AGENT,
"x-rpc-app_version": TGConstant.BBS.VERSION, "x-rpc-app_version": TGConstant.BBS.VERSION,
"x-rpc-client_type": "5", "x-rpc-client_type": "5",
Referer: "https://webstatic.mihoyo.com/", Referer: "https://webstatic.mihoyo.com/",
DS: getDS(method, transParams(data), saltType), DS: ds,
Cookie: transCookie(cookie), Cookie: transCookie(cookie),
}; };
} }