feat: removing sentry

This commit is contained in:
Chubby Granny Chaser
2024-05-14 16:54:14 +01:00
parent 59b1f2d5a5
commit dc7591ee28
77 changed files with 161 additions and 7545 deletions

View File

@@ -9,6 +9,7 @@ import { toMagnetURI } from "parse-torrent";
import type { Instance } from "parse-torrent";
import { QueryDeepPartialEntity } from "typeorm/query-builder/QueryPartialEntity";
import { formatBytes } from "@shared";
import { getFileBuffer } from "@main/helpers";
const worker = createWorker({});
@@ -27,7 +28,7 @@ const formatXatabDate = (str: string) => {
const getXatabRepack = (
url: string
): Promise<{ fileSize: string; magnet: string; uploadDate: Date }> => {
): Promise<{ fileSize: string; magnet: string; uploadDate: Date } | null> => {
return new Promise((resolve) => {
(async () => {
const data = await requestWebPage(url);
@@ -40,15 +41,20 @@ const getXatabRepack = (
".download-torrent"
) as HTMLAnchorElement;
if (!$downloadButton) throw new Error("Download button not found");
if (!$downloadButton) return resolve(null);
worker.once("message", (torrent: Instance | null) => {
if (!torrent) return resolve(null);
worker.once("message", (torrent: Instance) => {
resolve({
fileSize: formatBytes(torrent.length ?? 0),
magnet: toMagnetURI(torrent),
uploadDate: formatXatabDate($uploadDate!.textContent!),
});
});
const buffer = await getFileBuffer($downloadButton.href);
worker.postMessage(buffer);
})();
});
};
@@ -69,12 +75,14 @@ export const getNewRepacksFromXatab = async (
try {
const repack = await getXatabRepack(($a as HTMLAnchorElement).href);
repacks.push({
title: $a.textContent!,
repacker: "Xatab",
...repack,
page,
});
if (repack) {
repacks.push({
title: $a.textContent!,
repacker: "Xatab",
...repack,
page,
});
}
} catch (err: unknown) {
logger.error((err as Error).message, {
method: "getNewRepacksFromXatab",