Skip to content

Commit 95ad828

Browse files
committed
chore: eslint warnings
1 parent cede1fc commit 95ad828

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

src/client.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,14 @@ export class EverybodyCodesClient {
9696
quest: string | number,
9797
) {
9898
const url = this.makeUrl(type, event, "quest", quest);
99-
const data = await http<any>(url, { headers: this.cookieHeader() });
99+
100+
type KeyResponse = {
101+
key1?: string;
102+
key2?: string;
103+
key3?: string;
104+
};
105+
106+
const data = await http<KeyResponse>(url, { headers: this.cookieHeader() });
100107

101108
const out: Partial<Record<"1" | "2" | "3", string>> = {};
102109
for (const p of ["1", "2", "3"] as const) {

src/crypto/encryptionHelper.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import crypto from "crypto";
22

3-
const key = "1234567890123456";
4-
53
export const createEncryptedHex = (key: string, input: string) => {
64
const iv = Buffer.from(key.substring(0, 16), "utf8");
75
const cipher = crypto.createCipheriv(

src/helper/http.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ export async function http<T = unknown>(
1616
`HTTP ${res.status} ${res.statusText} :: ${url} :: ${body}`,
1717
);
1818
}
19-
const ct = res.headers.get("content-type") || "";
20-
return (
21-
ct.includes("application/json")
22-
? await res.json()
23-
: ((await res.text()) as any)
24-
) as T;
19+
const ct = res.headers.get("content-type") || "";
20+
if (ct.includes("application/json")) {
21+
return (await res.json()) as T;
22+
}
23+
return (await res.text()) as unknown as T;
2524
}

0 commit comments

Comments
 (0)