From b132acf4ad96e8802c9df48585fac552e4055a70 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 26 Mar 2021 15:53:26 -0400 Subject: [PATCH] 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