chore: merge with main

This commit is contained in:
Hydra
2024-04-28 19:21:14 +01:00
16 changed files with 1567 additions and 1173 deletions

View File

@@ -1,13 +1,9 @@
import type { Repack } from "@main/entity";
import { repackRepository } from "@main/repository";
import type { GameRepack } from "@types";
import { QueryDeepPartialEntity } from "typeorm/query-builder/QueryPartialEntity";
export type GameRepackInput = Omit<
GameRepack,
"id" | "repackerFriendlyName" | "createdAt" | "updatedAt"
>;
export const savePage = async (repacks: GameRepackInput[]) =>
export const savePage = async (repacks: QueryDeepPartialEntity<Repack>[]) =>
Promise.all(
repacks.map((repack) => repackRepository.insert(repack).catch(() => {}))
);

View File

@@ -31,11 +31,12 @@ const formatXatabDownloadSize = (str: string) =>
const getXatabRepack = async (url: string) => {
const data = await requestWebPage(url);
const { window } = new JSDOM(data);
const { document } = window;
const $uploadDate = window.document.querySelector(".entry__date");
const $size = window.document.querySelector(".entry__info-size");
const $uploadDate = document.querySelector(".entry__date");
const $size = document.querySelector(".entry__info-size");
const $downloadButton = window.document.querySelector(
const $downloadButton = document.querySelector(
".download-torrent"
) as HTMLAnchorElement;
@@ -74,8 +75,10 @@ export const getNewRepacksFromXatab = async (
...repack,
page,
});
} catch (err) {
logger.error(err.message, { method: "getNewRepacksFromXatab" });
} catch (err: unknown) {
logger.error((err as Error).message, {
method: "getNewRepacksFromXatab",
});
}
}