From 2d58cfc7a0768a5d635a12811ed2632b640eca24 Mon Sep 17 00:00:00 2001 From: pldespaigne Date: Sat, 4 May 2019 18:57:19 +0200 Subject: refactor & change html pages --- app/404.html | 52 -------------------------- app/error.html | 79 --------------------------------------- app/images/enslogo.svg | 1 + app/loading.html | 13 ++----- app/scripts/lib/ens-ipfs/setup.js | 20 +++------- 5 files changed, 11 insertions(+), 154 deletions(-) delete mode 100644 app/404.html delete mode 100644 app/error.html create mode 100644 app/images/enslogo.svg diff --git a/app/404.html b/app/404.html deleted file mode 100644 index 8a6df9d7a..000000000 --- a/app/404.html +++ /dev/null @@ -1,52 +0,0 @@ - - - MetaMask - - - -
- -

Powered by Portal Network

-
- - diff --git a/app/error.html b/app/error.html deleted file mode 100644 index 366b3d94a..000000000 --- a/app/error.html +++ /dev/null @@ -1,79 +0,0 @@ - - - MetaMask Error - - - - -
- -

not found

-

Powered by Portal Network

-
- - - diff --git a/app/images/enslogo.svg b/app/images/enslogo.svg new file mode 100644 index 000000000..20d94c0b1 --- /dev/null +++ b/app/images/enslogo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/loading.html b/app/loading.html index 71403a5ac..3b896b718 100644 --- a/app/loading.html +++ b/app/loading.html @@ -11,10 +11,10 @@ top: 50%; left: 50%; transform: translate(-50%, -50%); - width: 256px; + text-align: center; } #logo { - width: 100%; + width: 256px; animation: pulse 1s ease-in-out infinite; } @keyframes pulse { @@ -33,13 +33,8 @@ - diff --git a/app/scripts/lib/ens-ipfs/setup.js b/app/scripts/lib/ens-ipfs/setup.js index 43194afbd..82679db5d 100644 --- a/app/scripts/lib/ens-ipfs/setup.js +++ b/app/scripts/lib/ens-ipfs/setup.js @@ -37,33 +37,25 @@ function setupEnsIpfsResolver ({ provider }) { async function attemptResolve ({ tabId, name, path, search }) { extension.tabs.update(tabId, { url: `loading.html` }) + let url = `https://manager.ens.domains/name/${name}` try { - let url = '400.html' const {type, hash} = await resolveEnsToIpfsContentId({ provider, name }) if (type === 'ipfs-ns') { - url = `https://gateway.ipfs.io/ipfs/${hash}${path}${search || ''}` + const resolvedUrl = `https://gateway.ipfs.io/ipfs/${hash}${path}${search || ''}` try { // check if ipfs gateway has result - const response = await fetch(url, { method: 'HEAD' }) - // if failure, redirect to 404 page - if (response.status !== 200) { - extension.tabs.update(tabId, { url: '404.html' }) - return - } - // otherwise redirect to the correct page - extension.tabs.update(tabId, { url }) + const response = await fetch(resolvedUrl, { method: 'HEAD' }) + if (response.status === 200) url = resolvedUrl } catch (err) { console.warn(err) - // if HEAD fetch failed, redirect so user can see relevant error page - extension.tabs.update(tabId, { url }) } } else if (type === 'swarm-ns') { url = `https://swarm-gateways.net/bzz:/${hash}${path}${search || ''}` } - extension.tabs.update(tabId, { url }) } catch (err) { console.warn(err) - extension.tabs.update(tabId, { url: `error.html?name=${name}` }) + } finally { + extension.tabs.update(tabId, { url }) } } } -- cgit v1.2.3