mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
🚨 修复 qodana 报错
This commit is contained in:
@@ -331,7 +331,7 @@ class TGClient {
|
||||
async getDS(dsType: 2, callback: string, payload: any): Promise<void>;
|
||||
async getDS(dsType: 1 | 2, callback: string, payload?: any): Promise<void> {
|
||||
const saltType = dsType === 1 ? "lk2" : "common";
|
||||
let ds = "";
|
||||
let ds: string;
|
||||
if (dsType === 2) {
|
||||
const { body, query } = payload;
|
||||
ds = getDS4JS(saltType, dsType, body, query);
|
||||
|
||||
@@ -142,8 +142,7 @@ export function getDS4JS(
|
||||
const salt = getSalt(saltType);
|
||||
const time = Math.floor(Date.now() / 1000).toString();
|
||||
let random = getRandomNumber(100000, 200000).toString();
|
||||
let hashStr = "";
|
||||
let md5Str = "";
|
||||
let hashStr: string;
|
||||
if (dsType === 1) {
|
||||
random = getRandomString(6);
|
||||
hashStr = `salt=${salt}&t=${time}&r=${random}`;
|
||||
@@ -154,6 +153,6 @@ export function getDS4JS(
|
||||
const queryStr = typeof query === "string" ? query : transParams(query);
|
||||
hashStr = `salt=${salt}&t=${time}&r=${random}&b=${bodyStr}&q=${queryStr}`;
|
||||
}
|
||||
md5Str = Md5.md5.update(hashStr).hex();
|
||||
const md5Str = Md5.md5.update(hashStr).hex();
|
||||
return `${time},${random},${md5Str}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user