From d6fc309d29fe5d08cc682858ffd4b8e4c4f87b4f Mon Sep 17 00:00:00 2001 From: Nato Boram Date: Wed, 10 Apr 2019 00:37:39 -0400 Subject: [PATCH] add ipns --- index.html | 11 +++++++++-- javascript/app.js | 21 +++++++++++++++++++-- public-gateway-cacher.ipfs | 2 +- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index c72834e..8b188b5 100644 --- a/index.html +++ b/index.html @@ -17,8 +17,15 @@

IPFS Hash : - - + + +

+ + +

+ IPNS Hash : + +

diff --git a/javascript/app.js b/javascript/app.js index 6cb45ff..291e9dc 100644 --- a/javascript/app.js +++ b/javascript/app.js @@ -1,4 +1,5 @@ var hashToTest = ""; +var protocol = ""; const $results = document.querySelector('#results'); function returnHtmlLink(gateway) { @@ -29,6 +30,7 @@ function checkGateways(gateways) { const total = gateways.length; let checked = 0; gateways.forEach((gateway) => { + gateway = gateway.replace('/ipfs/', protocol); const gatewayAndHash = gateway.replace(':hash', hashToTest); // opt-out from gateway redirects done by browser extension const testUrl = gatewayAndHash + '#x-ipfs-companion-no-redirect'; @@ -48,13 +50,28 @@ function checkGateways(gateways) { }); } -function start() { +function start_ipfs() { while ($results.lastChild) { $results.removeChild($results.lastChild); } - hashToTest = document.querySelector("#input").value; + hashToTest = document.querySelector("#input_ipfs").value; + protocol = "/ipfs/"; + + fetch('./json/gateways.json') + .then(res => res.json()) + .then(gateways => checkGateways(gateways)); +} + +function start_ipns() { + + while ($results.lastChild) { + $results.removeChild($results.lastChild); + } + + hashToTest = document.querySelector("#input_ipns").value; + protocol = "/ipns/"; fetch('./json/gateways.json') .then(res => res.json()) diff --git a/public-gateway-cacher.ipfs b/public-gateway-cacher.ipfs index 15e6e49..5ddba16 100644 --- a/public-gateway-cacher.ipfs +++ b/public-gateway-cacher.ipfs @@ -1 +1 @@ -QmRvQrZ5Vb3Hpqg7iQBrawmbdnyi6cpgQUVXMu1DHq8yAk +QmYSBFMAo7NFcapLoW4UTAnnPnwBGNB944HrENgrXbkg5k