From 50a0f0240d7fef133eb5acc1bea2b1168b08e9db Mon Sep 17 00:00:00 2001 From: Factiven Date: Sun, 24 Dec 2023 13:03:54 +0700 Subject: migrate to typescript --- utils/imageUtils.js | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 utils/imageUtils.js (limited to 'utils/imageUtils.js') diff --git a/utils/imageUtils.js b/utils/imageUtils.js deleted file mode 100644 index 8025d5b..0000000 --- a/utils/imageUtils.js +++ /dev/null @@ -1,38 +0,0 @@ -export function getHeaders(providerId) { - switch (providerId) { - case "mangahere": - return { Referer: "https://mangahere.org" }; - case "mangadex": - return { Referer: "https://mangadex.org" }; - case "mangakakalot": - return { Referer: "https://mangakakalot.com" }; - case "mangapill": - return { Referer: "https://mangapill.com" }; - case "mangasee123": - return { Referer: "https://mangasee123.com" }; - case "comick": - return { Referer: "https://comick.app" }; - default: - return null; - } -} - -export function getRandomId() { - return Math.random().toString(36).substr(2, 9); -} - -export function truncateImgUrl(url) { - // Find the index of .png if not found find the index of .jpg - let index = - url?.indexOf(".png") !== -1 ? url?.indexOf(".png") : url?.indexOf(".jpg"); - - if (index !== -1) { - // If .png or .jpg is found - url = url?.slice(0, index + 4); // Slice the string from the start to the index of .png or .jpg plus 4 (the length of .png or .jpg) - } else { - // If .png or .jpg is not found - return url; // Return the original url string - } - - return url; -} -- cgit v1.2.3