From b132acf4ad96e8802c9df48585fac552e4055a70 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 26 Mar 2021 15:53:26 -0400 Subject: [PATCH 1/8] use public ipfs gateway, dynamic catalog, fix hrefs --- zhetic-poc/db.json | 3 +- .../img/{bokuyaba_cover.jpg => covers/0.jpg} | Bin .../{otoyomegatari_cover.jpg => covers/1.jpg} | Bin .../{spyxfamily_cover.jpg => covers/2.jpg} | Bin zhetic-poc/index.html | 3 -- zhetic-poc/js/catalog.js | 30 +++++++++++++ zhetic-poc/js/reader.js | 5 ++- zhetic-poc/manga.html | 41 +++--------------- 8 files changed, 40 insertions(+), 42 deletions(-) rename zhetic-poc/img/{bokuyaba_cover.jpg => covers/0.jpg} (100%) rename zhetic-poc/img/{otoyomegatari_cover.jpg => covers/1.jpg} (100%) rename zhetic-poc/img/{spyxfamily_cover.jpg => covers/2.jpg} (100%) create mode 100644 zhetic-poc/js/catalog.js diff --git a/zhetic-poc/db.json b/zhetic-poc/db.json index 2e4514f..9635fd7 100644 --- a/zhetic-poc/db.json +++ b/zhetic-poc/db.json @@ -2,5 +2,4 @@ { "id" : "0", "title" : "Boku no Kokoro no Yabai Yatsu", "cid" : "bafybeihnoou2av5w2bzmwkl6hi25scyzz6sjwdfqp4cwq2ikf6dfmev3ta", "pageNo" : "18" }, { "id" : "1", "title" : "Otoyomegatari", "cid" : "bafybeigfivshobq4h5x5qwmttgqimaufmcjl6hpjcrsedj7wxxduphp7g4", "pageNo" : "39" }, { "id" : "2", "title" : "Spy X Family", "cid" : "bafybeibgnpbredeofwp364qomqpth55a6ui3oiy2ucm35fo3eimquoeob4", "pageNo" : "71" } -] - +] \ No newline at end of file diff --git a/zhetic-poc/img/bokuyaba_cover.jpg b/zhetic-poc/img/covers/0.jpg similarity index 100% rename from zhetic-poc/img/bokuyaba_cover.jpg rename to zhetic-poc/img/covers/0.jpg diff --git a/zhetic-poc/img/otoyomegatari_cover.jpg b/zhetic-poc/img/covers/1.jpg similarity index 100% rename from zhetic-poc/img/otoyomegatari_cover.jpg rename to zhetic-poc/img/covers/1.jpg diff --git a/zhetic-poc/img/spyxfamily_cover.jpg b/zhetic-poc/img/covers/2.jpg similarity index 100% rename from zhetic-poc/img/spyxfamily_cover.jpg rename to zhetic-poc/img/covers/2.jpg diff --git a/zhetic-poc/index.html b/zhetic-poc/index.html index 649f967..1428002 100644 --- a/zhetic-poc/index.html +++ b/zhetic-poc/index.html @@ -13,9 +13,6 @@ | Contributing | Contact | -
-

This service requires an IPFS client

-

     This service is 99% distributed. This means you should start seeding before you start reading and accessing the content. Install an ipfs client and connect through the http gateway it provides for you. This website is just a list of files hosted on a distributed network, a tracker, if you will. For the best possible experience we also recommend that you install the ipfs-companion browser plugin. This does not mean you should rely on the public gateway, because this site would not be able to stay up.
diff --git a/zhetic-poc/js/catalog.js b/zhetic-poc/js/catalog.js new file mode 100644 index 0000000..8a210a5 --- /dev/null +++ b/zhetic-poc/js/catalog.js @@ -0,0 +1,30 @@ +$(document).ready(function () { + $.ajax({ + dataType: "json", + url: "http://"+window.location.hostname+"/db.json", + headers: { "Accept": "application/json"}, + success: function (res) { + let strCatalog = ""; + res.forEach(manga => { + strCatalog += '\ + \ + \ + \ + \ +

'+manga["title"]+'

\ +

Scanlation: ?

\ +

Status: ?

\ +

Chapters: ?

\ +

Last update: ?

\ +

\ + Link:\ + reader\ +

\ + \ + '; + }); + document.getElementById("titles").innerHTML = strCatalog; + } + }); +}); + diff --git a/zhetic-poc/js/reader.js b/zhetic-poc/js/reader.js index 1d41be5..fe6a08a 100644 --- a/zhetic-poc/js/reader.js +++ b/zhetic-poc/js/reader.js @@ -97,9 +97,10 @@ $(document).ready(function () { let url = new URL(window.location.href); let id = url.searchParams.get("id"); + let domain = window.location.hostname; $.ajax({ dataType: "json", - url: "https://amangathing.ddns.net/db.json", + url: "http://"+domain+"/db.json", headers: { "Accept": "application/json"}, success: function (res) { pageNo = res[id]["pageNo"]; @@ -109,7 +110,7 @@ $(document).ready(function () { $("#titlebarText").html(`${title}`); $("title").html(`${title}`); for (let i = 1; i <= pageNo; i++) { - $("#pageView").append(``); + $("#pageView").append(``); $(`#image${i}`).hide(); } loadPage(); diff --git a/zhetic-poc/manga.html b/zhetic-poc/manga.html index cafcc78..ad27da7 100644 --- a/zhetic-poc/manga.html +++ b/zhetic-poc/manga.html @@ -3,6 +3,8 @@ /a/ manga thing + +
@@ -13,19 +15,16 @@ | Contributing | Contact |
-
-

This service requires an IPFS client

-

     - This part could be js driven and pull the metadata from some kind of database, alternatively from ipfs through the public gateway at ipfs.io. The manga pages would be pulled from localhost and displayed in a built-in manga reader.

+ Generated from /db.json
- +
- - - - - - - -
- +

Boku no Kokoro no Yabai Yatsu

@@ -34,35 +33,7 @@

Chapters: x

Last update: recently

Link: - QmeKZdHoERmKUekcRxb3ao4ZuLDcF9qNbjYr3ZmeKAjC2s

-
- - -

Otoyomegatari

-

Scanlation: idgaf

-

Status: ongoing

-

Chapters: x

-

Last update: recently

-

Link: - QmbciPyqhjrbkrJVAkWFaUMSS9BXS7MH34ibhErnzzKEtN

-
- - -

Spy x Family

-

Scanlation: idgaf

-

Status: ongoing

-

Chapters: x

-

Last update: recently

-

Link: - QmQvdWNqGU8q5c2DyqwxhVfYZt8Cw8PFxAQD6zHfR49ojc

+ reader

From 18ea0dc37cd35c99c84f7121f33a04f6cf048135 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 26 Mar 2021 16:14:02 -0400 Subject: [PATCH 2/8] search function --- zhetic-poc/js/catalog.js | 9 +++++++-- zhetic-poc/manga.html | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/zhetic-poc/js/catalog.js b/zhetic-poc/js/catalog.js index 8a210a5..1bd92fb 100644 --- a/zhetic-poc/js/catalog.js +++ b/zhetic-poc/js/catalog.js @@ -1,11 +1,14 @@ -$(document).ready(function () { +function load() { $.ajax({ dataType: "json", url: "http://"+window.location.hostname+"/db.json", headers: { "Accept": "application/json"}, success: function (res) { let strCatalog = ""; + let strSearch = document.getElementById("search").value; res.forEach(manga => { + if (strSearch != "" && !manga["title"].toLowerCase().includes(strSearch.toLowerCase())) + return; strCatalog += '\ \ \ @@ -26,5 +29,7 @@ $(document).ready(function () { document.getElementById("titles").innerHTML = strCatalog; } }); +} +$(document).ready(function () { + load(); }); - diff --git a/zhetic-poc/manga.html b/zhetic-poc/manga.html index ad27da7..62a38a3 100644 --- a/zhetic-poc/manga.html +++ b/zhetic-poc/manga.html @@ -20,6 +20,7 @@ Generated from /db.json
+
From 1513bffa55301be7c40197f91118bcb26958a9c5 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 26 Mar 2021 16:21:52 -0400 Subject: [PATCH 3/8] query the db over https --- zhetic-poc/js/catalog.js | 2 +- zhetic-poc/js/reader.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zhetic-poc/js/catalog.js b/zhetic-poc/js/catalog.js index 1bd92fb..b7b938f 100644 --- a/zhetic-poc/js/catalog.js +++ b/zhetic-poc/js/catalog.js @@ -1,7 +1,7 @@ function load() { $.ajax({ dataType: "json", - url: "http://"+window.location.hostname+"/db.json", + url: "https://"+window.location.hostname+"/db.json", headers: { "Accept": "application/json"}, success: function (res) { let strCatalog = ""; diff --git a/zhetic-poc/js/reader.js b/zhetic-poc/js/reader.js index fe6a08a..d3f299a 100644 --- a/zhetic-poc/js/reader.js +++ b/zhetic-poc/js/reader.js @@ -100,7 +100,7 @@ $(document).ready(function () { let domain = window.location.hostname; $.ajax({ dataType: "json", - url: "http://"+domain+"/db.json", + url: "https://"+domain+"/db.json", headers: { "Accept": "application/json"}, success: function (res) { pageNo = res[id]["pageNo"]; From 5e88ec282eb7c6561e51711c8f1abc2b26493769 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 26 Mar 2021 16:24:26 -0400 Subject: [PATCH 4/8] remove stray catalog entry --- zhetic-poc/manga.html | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/zhetic-poc/manga.html b/zhetic-poc/manga.html index 62a38a3..2589ef6 100644 --- a/zhetic-poc/manga.html +++ b/zhetic-poc/manga.html @@ -23,20 +23,6 @@
- - - -
- - -

Boku no Kokoro no Yabai Yatsu

-

Scanlation: idgaf

-

Status: ongoing

-

Chapters: x

-

Last update: recently

-

Link: - reader

-
From 9404b85e77d13fa131518d8de4ad539650500468 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 26 Mar 2021 16:31:08 -0400 Subject: [PATCH 5/8] remove pages --- zhetic-poc/contact.html | 2 -- zhetic-poc/contributing.html | 2 -- zhetic-poc/index.html | 6 ------ 3 files changed, 10 deletions(-) diff --git a/zhetic-poc/contact.html b/zhetic-poc/contact.html index 31a17aa..d884301 100644 --- a/zhetic-poc/contact.html +++ b/zhetic-poc/contact.html @@ -14,8 +14,6 @@ | Contact |

-      - The project lives on irc.rizon.net#a-manga-thing

diff --git a/zhetic-poc/contributing.html b/zhetic-poc/contributing.html index 6c8e8be..1e00b25 100644 --- a/zhetic-poc/contributing.html +++ b/zhetic-poc/contributing.html @@ -14,8 +14,6 @@ | Contact |

-      - This service relies on a distributed network of hosts to serve content. The easiest way to help is to keep your ipfs daemon on in the background and use the dashboard on port 5001 to pin content you are interested in. If you have bandwidth to spare, consider consolidating your config files with ours and become a more permanent part of the network.

diff --git a/zhetic-poc/index.html b/zhetic-poc/index.html index 1428002..1e00b25 100644 --- a/zhetic-poc/index.html +++ b/zhetic-poc/index.html @@ -14,12 +14,6 @@ | Contact |

-      - This service is 99% distributed. This means you should start seeding before you start reading and accessing the content. Install an ipfs client and connect through the http gateway it provides for you. This website is just a list of files hosted on a distributed network, a tracker, if you will. For the best possible experience we also recommend that you install the ipfs-companion browser plugin. This does not mean you should rely on the public gateway, because this site would not be able to stay up.
-      - You have the option of either a GUI client or an assortment of other CLI-based tools. Once you have the service running in the background it will translate the content and allow you to view it in your browser.
-      - Make sure to pin your favorite manga to make sure that it sticks around. This tells ipfs to always keep a local copy and help out with content distribution.

From af3c3e6623a4c0f0876d6c9d1b97ec120e8c61d3 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 26 Mar 2021 17:00:52 -0400 Subject: [PATCH 6/8] bypass CORS --- zhetic-poc/js/catalog.js | 2 +- zhetic-poc/js/reader.js | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/zhetic-poc/js/catalog.js b/zhetic-poc/js/catalog.js index b7b938f..137988f 100644 --- a/zhetic-poc/js/catalog.js +++ b/zhetic-poc/js/catalog.js @@ -1,7 +1,7 @@ function load() { $.ajax({ dataType: "json", - url: "https://"+window.location.hostname+"/db.json", + url: "/db.json", headers: { "Accept": "application/json"}, success: function (res) { let strCatalog = ""; diff --git a/zhetic-poc/js/reader.js b/zhetic-poc/js/reader.js index d3f299a..c2b6f45 100644 --- a/zhetic-poc/js/reader.js +++ b/zhetic-poc/js/reader.js @@ -100,9 +100,16 @@ $(document).ready(function () { let domain = window.location.hostname; $.ajax({ dataType: "json", - url: "https://"+domain+"/db.json", + url: "/db.json", headers: { "Accept": "application/json"}, success: function (res) { + $.ajax({ + dataType: "json", + url: "https://"+domain+"/db.json", + headers: { "Accept": "application/json"}, + success: function (res) { + } + }); pageNo = res[id]["pageNo"]; title = res[id]["title"]; cid = res[id]["cid"]; From ce6db9fdbc408a2562f4da260b6f0aa45068514a Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 26 Mar 2021 17:18:17 -0400 Subject: [PATCH 7/8] get page number dynamically --- zhetic-poc/db.json | 6 +++--- zhetic-poc/js/reader.js | 27 ++++++++++++++------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/zhetic-poc/db.json b/zhetic-poc/db.json index 9635fd7..24d4416 100644 --- a/zhetic-poc/db.json +++ b/zhetic-poc/db.json @@ -1,5 +1,5 @@ [ - { "id" : "0", "title" : "Boku no Kokoro no Yabai Yatsu", "cid" : "bafybeihnoou2av5w2bzmwkl6hi25scyzz6sjwdfqp4cwq2ikf6dfmev3ta", "pageNo" : "18" }, - { "id" : "1", "title" : "Otoyomegatari", "cid" : "bafybeigfivshobq4h5x5qwmttgqimaufmcjl6hpjcrsedj7wxxduphp7g4", "pageNo" : "39" }, - { "id" : "2", "title" : "Spy X Family", "cid" : "bafybeibgnpbredeofwp364qomqpth55a6ui3oiy2ucm35fo3eimquoeob4", "pageNo" : "71" } + { "id" : "0", "title" : "Boku no Kokoro no Yabai Yatsu", "cid" : "bafybeihnoou2av5w2bzmwkl6hi25scyzz6sjwdfqp4cwq2ikf6dfmev3ta"}, + { "id" : "1", "title" : "Otoyomegatari", "cid" : "bafybeigfivshobq4h5x5qwmttgqimaufmcjl6hpjcrsedj7wxxduphp7g4"}, + { "id" : "2", "title" : "Spy X Family", "cid" : "bafybeibgnpbredeofwp364qomqpth55a6ui3oiy2ucm35fo3eimquoeob4"} ] \ No newline at end of file diff --git a/zhetic-poc/js/reader.js b/zhetic-poc/js/reader.js index c2b6f45..6090fd1 100644 --- a/zhetic-poc/js/reader.js +++ b/zhetic-poc/js/reader.js @@ -103,24 +103,25 @@ $(document).ready(function () { url: "/db.json", headers: { "Accept": "application/json"}, success: function (res) { + pageNo = 0; $.ajax({ dataType: "json", - url: "https://"+domain+"/db.json", + url: "http://ipfs.io/api/v0/ls/"+res[id]["cid"], headers: { "Accept": "application/json"}, - success: function (res) { + success: function (r) { + pageNo = r["Objects"][0]["Links"].length; + title = res[id]["title"]; + cid = res[id]["cid"]; + $("#pageCounter").html(`${pageCurrent}/${pageNo}`); + $("#titlebarText").html(`${title}`); + $("title").html(`${title}`); + for (let i = 1; i <= pageNo; i++) { + $("#pageView").append(``); + $(`#image${i}`).hide(); + } + loadPage(); } }); - pageNo = res[id]["pageNo"]; - title = res[id]["title"]; - cid = res[id]["cid"]; - $("#pageCounter").html(`${pageCurrent}/${pageNo}`); - $("#titlebarText").html(`${title}`); - $("title").html(`${title}`); - for (let i = 1; i <= pageNo; i++) { - $("#pageView").append(``); - $(`#image${i}`).hide(); - } - loadPage(); } }); From 1179e2d48ce33ecc20c74c65098e0b0a632e60cb Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 26 Mar 2021 17:20:01 -0400 Subject: [PATCH 8/8] make api req https --- zhetic-poc/js/reader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zhetic-poc/js/reader.js b/zhetic-poc/js/reader.js index 6090fd1..c0ff32d 100644 --- a/zhetic-poc/js/reader.js +++ b/zhetic-poc/js/reader.js @@ -106,7 +106,7 @@ $(document).ready(function () { pageNo = 0; $.ajax({ dataType: "json", - url: "http://ipfs.io/api/v0/ls/"+res[id]["cid"], + url: "https://ipfs.io/api/v0/ls/"+res[id]["cid"], headers: { "Accept": "application/json"}, success: function (r) { pageNo = r["Objects"][0]["Links"].length;