1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Update ipfs to infura

This commit is contained in:
Yung chieh Tsai 2018-06-01 11:27:05 +08:00
parent 4e14313ba8
commit 77d17f2d55

View File

@ -14,13 +14,13 @@ module.exports = function (provider) {
resolver.resolve(name, provider).then(ipfsHash => {
clearTimeout(clearTime)
let url = 'https://gateway.ipfs.io/ipfs/' + ipfsHash
let url = 'https://ipfs.infura.io/ipfs/' + ipfsHash
return fetch(url, { method: 'HEAD' }).then(response => response.status).then(statusCode => {
if (statusCode !== 200) return extension.tabs.update(tab.id, { url: '404.html' })
extension.tabs.update(tab.id, { url: url })
})
.catch(err => {
url = 'https://gateway.ipfs.io/ipfs/' + ipfsHash
url = 'https://ipfs.infura.io/ipfs/' + ipfsHash
extension.tabs.update(tab.id, {url: url})
return err
})