parent
86ead431c3
commit
829deacb57
@ -1,59 +0,0 @@ |
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<title>no_mainnet</title> |
||||
</head> |
||||
<style> |
||||
*{ |
||||
padding: 0; |
||||
margin: 0; |
||||
box-sizing: border-box; |
||||
} |
||||
img{ |
||||
display: block; |
||||
} |
||||
html, body{ |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
width: 100%; |
||||
height: 100%; |
||||
} |
||||
@keyframes logoAmin{ |
||||
from {transform: scale(1);} |
||||
50%{transform: scale(1.1);} |
||||
to {transform: scale(1);} |
||||
} |
||||
.no_mainnet{ |
||||
width: 80%; |
||||
height: auto; |
||||
overflow: hidden; |
||||
padding: 10px; |
||||
} |
||||
.no_mainnet > img{ |
||||
margin: 0 auto 31px auto; |
||||
width: 136px; |
||||
height: auto; |
||||
animation: logoAmin 1s infinite linear; |
||||
} |
||||
.no_mainnet > h1{ |
||||
text-align: center; |
||||
font-family: Gotham; |
||||
font-size: 18px; |
||||
font-weight: 500; |
||||
font-style: normal; |
||||
font-stretch: normal; |
||||
line-height: normal; |
||||
letter-spacing: 1.3px; |
||||
color: #33559f; |
||||
} |
||||
|
||||
</style> |
||||
<body> |
||||
<div class="no_mainnet"> |
||||
<img src="./images/cancel.png" alt=""> |
||||
<h1>ENS resolver only support on Ethereum mainnet</h1> |
||||
</div> |
||||
</body> |
||||
</html> |
@ -0,0 +1,36 @@ |
||||
const extension = require('extensionizer') |
||||
const resolver = require('./resolver.js') |
||||
|
||||
module.exports = function (provider) { |
||||
extension.webRequest.onBeforeRequest.addListener(details => { |
||||
const name = details.url.substring(7, details.url.length - 1) |
||||
let clearTime = null |
||||
extension.tabs.getSelected(null, tab => { |
||||
extension.tabs.update(tab.id, { url: 'loading.html' }) |
||||
|
||||
clearTime = setTimeout(() => { |
||||
return extension.tabs.update(tab.id, { url: '404.html' }) |
||||
}, 60000) |
||||
|
||||
resolver.resolve(name, provider).then(ipfsHash => { |
||||
clearTimeout(clearTime) |
||||
let url = 'https://gateway.ipfs.io/ipfs/' + ipfsHash |
||||
return fetch(url, { method: 'HEAD' }).then(response => response.status).then(statusCode => { |
||||
if (statusCode !== 200) return 'Local' |
||||
extension.tabs.update(tab.id, { url: url }) |
||||
}) |
||||
.catch(err => { |
||||
url = 'https://gateway.ipfs.io/ipfs/' + ipfsHash |
||||
extension.tabs.update(tab.id, {url: url}) |
||||
return err |
||||
}) |
||||
}) |
||||
.catch(err => { |
||||
clearTimeout(clearTime) |
||||
const url = err === 'unsupport' ? 'unsupport' : 'error' |
||||
extension.tabs.update(tab.id, {url: `${url}.html?name=${name}`}) |
||||
}) |
||||
}) |
||||
return { cancel: true } |
||||
}, {urls: ['*://*.eth/']}) |
||||
} |
@ -1,36 +0,0 @@ |
||||
const extension = require('extensionizer') |
||||
const resolver = require('./resolver.js'); |
||||
module.exports = function (provider) { |
||||
extension.webRequest.onBeforeRequest.addListener(details => { |
||||
let name = details.url.substring(7, details.url.length - 1); |
||||
let clearTime = null; |
||||
extension.tabs.getSelected(null, tab => { |
||||
extension.tabs.update(tab.id, { url: "loading.html" }); |
||||
|
||||
clearTime = setTimeout(() => { |
||||
return extension.tabs.update(tab.id, { url: "404.html" }); |
||||
}, 60000); |
||||
|
||||
resolver.resolve(name, provider).then(ipfsHash => { |
||||
clearTimeout(clearTime); |
||||
let url = "https://gateway.ipfs.io/ipfs/" + ipfsHash; |
||||
return fetch(url, { method: "HEAD" }).then(response => response.status).then(statusCode => { |
||||
if (statusCode !== 200) return "Local" |
||||
extension.tabs.update(tab.id, { url: url }) |
||||
}) |
||||
.catch(err => { |
||||
url = "https://gateway.ipfs.io/ipfs/" + ipfsHash |
||||
extension.tabs.update(tab.id, {url: url}) |
||||
return err |
||||
}) |
||||
}) |
||||
.catch(err => { |
||||
clearTimeout(clearTime); |
||||
let nameWithoutTld = name.substring(0, name.lastIndexOf('.')) |
||||
let url = err === "no_mainnet" ? "no_mainnet" : "error" |
||||
extension.tabs.update(tab.id, {url: `${url}.html?name=${name}`}) |
||||
}) |
||||
}) |
||||
return { cancel: true } |
||||
}, {urls: ["*://*.eth/"]}) |
||||
} |
@ -0,0 +1,59 @@ |
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<title>MetaMask</title> |
||||
</head> |
||||
<style> |
||||
*{ |
||||
padding: 0; |
||||
margin: 0; |
||||
box-sizing: border-box; |
||||
} |
||||
img{ |
||||
display: block; |
||||
} |
||||
html, body{ |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
width: 100%; |
||||
height: 100%; |
||||
} |
||||
@keyframes logoAmin{ |
||||
from {transform: scale(1);} |
||||
50%{transform: scale(1.1);} |
||||
to {transform: scale(1);} |
||||
} |
||||
.unsupport{ |
||||
width: 80%; |
||||
height: auto; |
||||
overflow: hidden; |
||||
padding: 10px; |
||||
} |
||||
.unsupport > img{ |
||||
margin: 0 auto 31px auto; |
||||
width: 136px; |
||||
height: auto; |
||||
animation: logoAmin 1s infinite linear; |
||||
} |
||||
.unsupport > h1{ |
||||
text-align: center; |
||||
font-family: Gotham; |
||||
font-size: 18px; |
||||
font-weight: 500; |
||||
font-style: normal; |
||||
font-stretch: normal; |
||||
line-height: normal; |
||||
letter-spacing: 1.3px; |
||||
color: #33559f; |
||||
} |
||||
|
||||
</style> |
||||
<body> |
||||
<div class="unsupport"> |
||||
<img src="./images/cancel.png" alt=""> |
||||
<h1>ENS resolver only support on Ethereum mainnet</h1> |
||||
</div> |
||||
</body> |
||||
</html> |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue