diff --git a/src/pages/callback.svelte b/src/pages/callback.svelte new file mode 100644 index 0000000..d9eb3ca --- /dev/null +++ b/src/pages/callback.svelte @@ -0,0 +1,12 @@ + + +{data} \ No newline at end of file diff --git a/src/pages/index.svelte b/src/pages/index.svelte index 43a9f67..0eb74d7 100644 --- a/src/pages/index.svelte +++ b/src/pages/index.svelte @@ -1,73 +1,9 @@ - + const anilistID = "8375"; + + let userDetails = getUserDetails(); + let userManga = getUserManga(); + Mangadex search & downloader @@ -106,26 +37,49 @@

miniMANGADEX

-
+ +
+ {#if isLogedIn()} + {#await userDetails then userDetails} + + Your ({userDetails.data.User.name}) avatar + + {/await} + {:else} + Login with AniList + {/if} Mangadex.org
+ {#if isLogedIn()} + {#await userManga then userManga} + {#each userManga.data.MediaListCollection.lists as list} +

{list.name}

+ +
+ {#each list.entries as entry} +
+ {entry.media.title} +
+ {/each} +
+ {/each} + {/await} + {/if} -

Wondering why this downgrade? My main site was taken down 3 times for copyright infringement because of this site, even though I wasn't hosting anything. I removed any link they reported, yet they still removed my site multiple times (I should always have 48 hour window to remove the link, but they removed my site right after sending email to me). Comeso (the company that was sending copyright infringement emails) didn't reply to my attempts to contact them using the email they provided or the website they sent. They also sent few invalid copyright infringement emails, yet my webhosting still took my site down for them.

-

I disabled search engine indexing, so google shouldn't show results of manga directly but just link to this page. Search functionality got removed and instead you need to send the URL itself, which should prevent automatic scanners.


This site works by using Mangadex API from your browser, and loading or downloading the manga directly from MD@H, without using my servers (so I don't host any content seen here, nor can I delete it). The whole site is client side only (it runs in your browser). I cannot delete any content (images or text), only hide it from this specific site - but there are tons of other sites, and anybody with decent coding skills can clone this page and remove the rule hiding the content (this page is open source).


-

DISCLAIMER: This site isn't distributing any content and is using mangadex.org API. All of the site's requests are done client side, my servers aren't sharing any manga data. Website is open source, and I don't claim any copyright on the publications.

+

DISCLAIMER: This site isn't distributing any content and is using mangadex.org API. All of the site's requests are done client side, my servers aren't sharing any manga data. Website is open source, and I don't claim any copyright on the publications. If you believe in good faith you're downloading copyrighted content, file a DMCA at yourself, your operating system (as it took a part in the download), your ISP, your browser and all the free libraries that are used in any of the previous (made by volunteers), and then here. /s


@@ -138,15 +92,40 @@

- Website's source code available on GitHub under GPLv3. Hosted using CloudFlare Pages. + Website's source code available on GitHub under GPLv3. Hosted on Cloudflare Pages, a static site hosting, where none of the images are stored.

diff --git a/src/util/anilist.js b/src/util/anilist.js new file mode 100644 index 0000000..296df32 --- /dev/null +++ b/src/util/anilist.js @@ -0,0 +1,106 @@ + +export function isLogedIn() { + const token = localStorage.getItem("token"); + const expiration = new Date(localStorage.getItem("expiration")); + + if(!token) return false; + if(expiration.getTime() < Date.now()) { + localStorage.removeItem("token"); + localStorage.removeItem("expiration"); + return false; + } + return true; +} + +export function getUserID() { + const token = localStorage.getItem("token"); + let data = JSON.parse(atob(token.substring(token.indexOf(".") + 1, token.lastIndexOf(".")))); + return data.sub; +} + +export function makeRequest(query, variables) { + let auth = {}; + if(isLogedIn()) { + auth.Authorization = "Bearer " + localStorage.getItem("token"); + } + return fetch("https://graphql.anilist.co", { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + ...auth + }, + body: JSON.stringify({ + query, + variables + }) + }).then(data => data.json()); +} + +export function getUserDetails() { + const id = getUserID(); + return makeRequest(` + query ($id: Int) { + User(id: $id) { + name + avatar { + medium + } + options { + titleLanguage + displayAdultContent + } + statistics { + manga { + count + chaptersRead + volumesRead + } + } + } + }`, { id }); +} + +export function getUserManga() { + const id = getUserID(); + return makeRequest(` + query($id: Int) { + MediaListCollection(userId: $id, type: MANGA) { + lists { + name + isCustomList + status + isSplitCompletedList + entries { + status + progress + progressVolumes + repeat + priority + private + notes + score(format: POINT_10_DECIMAL) + media { + id + title { + romaji + english + native + userPreferred + } + status + chapters + volumes + coverImage { + large + medium + color + } + isAdult + isFavourite + } + } + } + } + }`, { id }); +} \ No newline at end of file