commit
cad5b9661f
|
@ -1,2 +1,8 @@
|
||||||
# gateway-checker
|
# public-gateway-checker
|
||||||
> Checks which public gateways are online or not
|
> Checks which public gateways are online or not
|
||||||
|
|
||||||
|
A small little utility website for checking if some public gateways are still up and running.
|
||||||
|
|
||||||
|
NOTE: All of these (except gateway.ipfs.io and ipfs.io) are hosted by third-parties and should be treated as such.
|
||||||
|
|
||||||
|
You can view the website via Github Pages: https://ipfs.github.io/public-gateway-checker/
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
const hashToTest = 'Qmaisz6NMhDB51cCvNWa1GMS7LU1pAxdF4Ld6Ft9kZEP2a'
|
||||||
|
const hashString = 'Hello from IPFS Gateway Checker'
|
||||||
|
|
||||||
|
const $results = document.querySelector('#results')
|
||||||
|
|
||||||
|
function addNode (gateway, online, title) {
|
||||||
|
const para = document.createElement('div')
|
||||||
|
let node
|
||||||
|
if (online) {
|
||||||
|
node = document.createElement('strong')
|
||||||
|
node.innerText = '✅ - Online - ' + gateway
|
||||||
|
} else {
|
||||||
|
node = document.createElement('div')
|
||||||
|
node.innerText = '❌ - Offline - ' + gateway
|
||||||
|
}
|
||||||
|
node.setAttribute('title', title)
|
||||||
|
para.appendChild(node)
|
||||||
|
$results.appendChild(para)
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateStats (total, checked) {
|
||||||
|
document.getElementById('stats').innerText = checked + '/' + total + ' gateways checked'
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkGateways (gateways) {
|
||||||
|
const total = gateways.length
|
||||||
|
let checked = 0
|
||||||
|
gateways.forEach((gateway) => {
|
||||||
|
const gatewayAndHash = gateway.replace(':hash', hashToTest)
|
||||||
|
fetch(gatewayAndHash)
|
||||||
|
.then(res => res.text())
|
||||||
|
.then((text) => {
|
||||||
|
const matched = text.trim() === hashString.trim()
|
||||||
|
addNode(gatewayAndHash, matched, matched ? 'All good' : 'Output did not match expected output')
|
||||||
|
checked++
|
||||||
|
updateStats(total, checked)
|
||||||
|
}).catch((err) => {
|
||||||
|
window.err = err
|
||||||
|
addNode(gatewayAndHash, false, err)
|
||||||
|
checked++
|
||||||
|
updateStats(total, checked)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fetch('./gateways.json')
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(gateways => checkGateways(gateways))
|
|
@ -0,0 +1,16 @@
|
||||||
|
[
|
||||||
|
"https://ipfs.io/ipfs/:hash",
|
||||||
|
"https://gateway.ipfs.io/ipfs/:hash",
|
||||||
|
"https://ipfs.infura.io/ipfs/:hash",
|
||||||
|
"http://rx14.co.uk/ipfs/:hash",
|
||||||
|
"https://xmine128.tk/ipfs/:hash",
|
||||||
|
"https://upload.global/ipfs/:hash",
|
||||||
|
"https://ipfs.jes.xxx/ipfs/:hash",
|
||||||
|
"https://catalunya.network/ipfs/:hash",
|
||||||
|
"https://siderus.io/ipfs/:hash",
|
||||||
|
"https://eternum.io/ipfs/:hash",
|
||||||
|
"https://hardbin.com/ipfs/:hash",
|
||||||
|
"https://ipfs.macholibre.org/ipfs/:hash",
|
||||||
|
"https://ipfs.works/ipfs/:hash",
|
||||||
|
"https://ipfs.work/ipfs/:hash"
|
||||||
|
]
|
82
index.html
82
index.html
|
@ -2,70 +2,28 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title></title>
|
<title>Public IPFS Gateways</title>
|
||||||
|
<style>
|
||||||
|
body, html {
|
||||||
|
font-family: Verdana, sans-serif;
|
||||||
|
color: #121212;
|
||||||
|
background-color: #FAFAFA;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h3 {
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
#results {
|
||||||
|
font-family: "SourceCodePro", monospace;
|
||||||
|
white-space: pre;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Public IPFS Gateways</h1>
|
<h1>Public IPFS Gateways</h1>
|
||||||
<h3 id='stats'></h3>
|
<h3 id="stats"></h3>
|
||||||
|
<div id="results"></div>
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script src="./app.js"></script>
|
||||||
const gateways = [
|
|
||||||
'https://ipfs.io/ipfs/:hash',
|
|
||||||
'https://gateway.ipfs.io/ipfs/:hash',
|
|
||||||
'https://ipfs.infura.io/ipfs/:hash',
|
|
||||||
'http://rx14.co.uk/ipfs/:hash',
|
|
||||||
'https://xmine128.tk/ipfs/:hash',
|
|
||||||
'https://upload.global/ipfs/:hash',
|
|
||||||
'https://ipfs.jes.xxx/ipfs/:hash',
|
|
||||||
'https://catalunya.network/ipfs/:hash',
|
|
||||||
'https://siderus.io/ipfs/:hash',
|
|
||||||
'https://eternum.io/ipfs/:hash',
|
|
||||||
'https://hardbin.com/ipfs/:hash',
|
|
||||||
'https://ipfs.macholibre.org/ipfs/:hash',
|
|
||||||
'https://ipfs.works/ipfs/:hash',
|
|
||||||
'https://ipfs.work/ipfs/:hash'
|
|
||||||
]
|
|
||||||
|
|
||||||
const hashToTest = 'Qmaisz6NMhDB51cCvNWa1GMS7LU1pAxdF4Ld6Ft9kZEP2a'
|
|
||||||
const hashString = 'Hello from IPFS Gateway Checker'
|
|
||||||
|
|
||||||
function addNode (gateway, online, title) {
|
|
||||||
const para = document.createElement('div')
|
|
||||||
let node
|
|
||||||
if (online) {
|
|
||||||
node = document.createElement('strong')
|
|
||||||
node.innerText = '✅ - Online - ' + gateway
|
|
||||||
} else {
|
|
||||||
node = document.createElement('div')
|
|
||||||
node.innerText = '❌ - Offline - ' + gateway
|
|
||||||
}
|
|
||||||
node.setAttribute('title', title)
|
|
||||||
para.appendChild(node)
|
|
||||||
document.body.appendChild(para)
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateStats (total, checked) {
|
|
||||||
document.getElementById('stats').innerText = checked + '/' + total + ' gateways checked'
|
|
||||||
}
|
|
||||||
|
|
||||||
const total = gateways.length
|
|
||||||
let checked = 0
|
|
||||||
gateways.forEach((gateway) => {
|
|
||||||
const gatewayAndHash = gateway.replace(':hash', hashToTest)
|
|
||||||
fetch(gatewayAndHash)
|
|
||||||
.then(res => res.text())
|
|
||||||
.then((text) => {
|
|
||||||
const matched = text.trim() === hashString.trim()
|
|
||||||
addNode(gatewayAndHash, matched, matched ? 'All good' : 'Output did not match expected output')
|
|
||||||
checked++
|
|
||||||
updateStats(total, checked)
|
|
||||||
}).catch((err) => {
|
|
||||||
window.err = err
|
|
||||||
addNode(gatewayAndHash, false, err)
|
|
||||||
checked++
|
|
||||||
updateStats(total, checked)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue