2017-09-25 15:48:50 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<title></title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1>Public IPFS Gateways</h1>
|
|
|
|
<h3 id='stats'></h3>
|
|
|
|
</body>
|
|
|
|
<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://example.com/ipfs/:hash',
|
|
|
|
'https://catalunya.network/ipfs/:hash',
|
|
|
|
'https://siderus.io/ipfs/:hash',
|
|
|
|
'https://eternum.io/ipfs/:hash',
|
2017-09-26 21:03:33 +00:00
|
|
|
'https://hardbin.com/ipfs/:hash',
|
|
|
|
'https://ipfs.macholibre.org/ipfs/:hash'
|
2017-09-25 15:48:50 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
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>
|