aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-12-28 17:25:24 -0800
committerFuwn <[email protected]>2023-12-28 17:25:24 -0800
commitd59b5e92bc2de54d19413d4a21df6e761dac8c69 (patch)
tree332a803fdac2cc0ab8cbabd96a7dccfa2f68f061
parentfeat(html): update description and title (diff)
downloaddue.moe-d59b5e92bc2de54d19413d4a21df6e761dac8c69.tar.xz
due.moe-d59b5e92bc2de54d19413d4a21df6e761dac8c69.zip
chore(manga): no proxy dev
-rw-r--r--src/lib/Media/Manga/chapters.ts17
-rw-r--r--src/lib/Tools/Wrapped.svelte7
-rw-r--r--src/lib/Utility/proxy.ts8
3 files changed, 21 insertions, 11 deletions
diff --git a/src/lib/Media/Manga/chapters.ts b/src/lib/Media/Manga/chapters.ts
index 8d072559..203d7210 100644
--- a/src/lib/Media/Manga/chapters.ts
+++ b/src/lib/Media/Manga/chapters.ts
@@ -1,4 +1,5 @@
import { recentMediaActivities, type Media } from '$lib/AniList/media';
+import proxy from '$lib/Utility/proxy';
import settings from '../../../stores/settings';
import type { UserIdentity } from '../../AniList/identity';
import { database } from '../../Database/chapters';
@@ -41,9 +42,11 @@ const getManga = async (
try {
return await (
await fetch(
- `https://due-proxy.fuwn.workers.dev/?q=https://api.mangadex.org/manga?title=${encodeURIComponent(
- title
- )}&year=${year}&status[]=${status}`
+ proxy(
+ `https://api.mangadex.org/manga?title=${encodeURIComponent(
+ title
+ )}&year=${year}&status[]=${status}`
+ )
)
).json();
} catch {
@@ -124,7 +127,9 @@ export const chapterCount = async (
const mangadexId = mangadexDataJson['data'][0]['id'];
const lastChapterDataJson = await (
await fetch(
- `https://due-proxy.fuwn.workers.dev/?q=https://api.mangadex.org/manga/${mangadexId}/feed?order[chapter]=desc&translatedLanguage[]=en&limit=1&contentRating[]=safe&contentRating[]=suggestive&contentRating[]=erotica&contentRating[]=pornographic`
+ proxy(
+ `https://api.mangadex.org/manga/${mangadexId}/feed?order[chapter]=desc&translatedLanguage[]=en&limit=1&contentRating[]=safe&contentRating[]=suggestive&contentRating[]=erotica&contentRating[]=pornographic`
+ )
)
).json();
@@ -147,7 +152,9 @@ export const chapterCount = async (
if (!settings.get().calculateDisableOutOfDateVolumeWarning) {
const volumeOfChapterData = await (
await fetch(
- `https://due-proxy.fuwn.workers.dev/?q=https://api.mangadex.org/chapter?manga=${mangadexId}&chapter=${manga.mediaListEntry?.progress}&contentRating[]=safe&contentRating[]=suggestive&contentRating[]=erotica&contentRating[]=pornographic&limit=1`
+ proxy(
+ `https://api.mangadex.org/chapter?manga=${mangadexId}&chapter=${manga.mediaListEntry?.progress}&contentRating[]=safe&contentRating[]=suggestive&contentRating[]=erotica&contentRating[]=pornographic&limit=1`
+ )
)
).json();
let lastAvailableVolume = lastChapterDataJson['data'][0]['attributes']['volume'];
diff --git a/src/lib/Tools/Wrapped.svelte b/src/lib/Tools/Wrapped.svelte
index 41016753..fac156b0 100644
--- a/src/lib/Tools/Wrapped.svelte
+++ b/src/lib/Tools/Wrapped.svelte
@@ -20,12 +20,12 @@
import { page } from '$app/stores';
import { clearAllParameters } from '../Utility/parameters';
import { nbsp } from '../Utility/html';
- import { env } from '$env/dynamic/public';
import { estimatedDayReading } from '$lib/Media/Manga/time';
import ActivityHistoryGrid from './ActivityHistory/Grid.svelte';
import SettingHint from '$lib/Settings/SettingHint.svelte';
import { database } from '$lib/Database/activities';
import MediaTitleDisplay from '$lib/List/MediaTitleDisplay.svelte';
+ import proxy from '$lib/Utility/proxy';
export let user: AniListAuthorisation;
@@ -332,11 +332,6 @@
// return string.slice(0, maxLength - 3) + ' …';
// };
- const proxy = (url: string, disable = false) =>
- env.PUBLIC_ANILIST_REDIRECT_URI?.includes('192.168') && !disable
- ? url
- : `/api/proxy?url=${encodeURIComponent(url)}`;
-
const submitExcludedKeywords = () => {
if (excludedKeywordsInput.length <= 0 && excludedKeywords.length > 0) {
animeList = originalAnimeList;
diff --git a/src/lib/Utility/proxy.ts b/src/lib/Utility/proxy.ts
new file mode 100644
index 00000000..81d40a29
--- /dev/null
+++ b/src/lib/Utility/proxy.ts
@@ -0,0 +1,8 @@
+import { env } from '$env/dynamic/public';
+
+export const proxy = (url: string, disable = false) =>
+ env.PUBLIC_ANILIST_REDIRECT_URI?.includes('192.168') && !disable
+ ? url
+ : `https://due-proxy.fuwn.workers.dev/?q=${encodeURIComponent(url)}`;
+
+export default proxy;