Skip to content

Commit

Permalink
fix: types for latest utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexcited committed Nov 3, 2024
1 parent 9a45ad5 commit 3d23e86
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/models/Authenticator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export class Authenticator {
const params = new URLSearchParams();
params.set("user", username);

const pid = findValueBetween(html, "<input type=\"hidden\" name=\"pid\" value=\"", "\" />");
const challenge = findValueBetween(html, "<input type=\"hidden\" name=\"challenge\" value=\"", "\" />");
const pid = findValueBetween(html, "<input type=\"hidden\" name=\"pid\" value=\"", "\" />")!;
const challenge = findValueBetween(html, "<input type=\"hidden\" name=\"challenge\" value=\"", "\" />")!;

let hashed_password = md5(password);
hashed_password = md5(username + ":" + hashed_password + ":" + challenge);
Expand Down
4 changes: 2 additions & 2 deletions src/models/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export class Client {
}

public static fromAPI (html: string, cookies: string[] = [], pid = "") {
const schoolID = findValueBetween(html, ARD_BASE_ENDPOINT.slice(1) + "/", "/accueil.html");
const [schoolImagePath, , schoolName] = findValueBetween(html, "<img src=\"", "\" />").split("\"");
const schoolID = findValueBetween(html, ARD_BASE_ENDPOINT.slice(1) + "/", "/accueil.html")!;
const [schoolImagePath, , schoolName] = findValueBetween(html, "<img src=\"", "\" />")!.split("\"");
const schoolImageURL = ARD_HOST + "/" + schoolImagePath;

return new Client(pid, schoolID, schoolName, schoolImageURL, cookies);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/finders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { findValueBetween } from "@literate.ink/utilities";
* variable in a script tag. Content is encoded in JSON, as a string.
*/
export const findAndReadGecData = <T extends {} = {}>(html: string): T => {
const value = findValueBetween(html, "var gecData = ", "</script");
const value = findValueBetween(html, "var gecData = ", "</script")!;
return JSON.parse(value);
};

0 comments on commit 3d23e86

Please sign in to comment.