forked from tornadocash/classic-ui
improve ipfs detection & update notifications
This commit is contained in:
parent
61c2865c46
commit
b2304b7008
@ -83,31 +83,6 @@
|
|||||||
</i18n>
|
</i18n>
|
||||||
</b-notification>
|
</b-notification>
|
||||||
|
|
||||||
<b-notification
|
|
||||||
v-if="isEthLink"
|
|
||||||
:active="isActiveNotification.ethLink"
|
|
||||||
class="main-notification"
|
|
||||||
type="is-warning"
|
|
||||||
icon-pack="icon"
|
|
||||||
has-icon
|
|
||||||
:aria-close-label="$t('closeNotification')"
|
|
||||||
@close="disableNotification({ key: 'ethLink' })"
|
|
||||||
>
|
|
||||||
<i18n path="ethLinkBanner.notification">
|
|
||||||
<template v-slot:issue>
|
|
||||||
<a
|
|
||||||
href="https://discuss.ens.domains/t/eth-link-expiry/13899"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
>{{ $t('ethLinkBanner.issue') }}</a
|
|
||||||
>
|
|
||||||
</template>
|
|
||||||
<template v-slot:alternative>
|
|
||||||
<a href="https://tornado.cash/">{{ $t('ethLinkBanner.alternative') }}</a>
|
|
||||||
</template>
|
|
||||||
</i18n>
|
|
||||||
</b-notification>
|
|
||||||
|
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column is-half">
|
<div class="column is-half">
|
||||||
<b-tabs v-model="activeTab" class="is-tornado" :animated="false" @input="tabChanged">
|
<b-tabs v-model="activeTab" class="is-tornado" :animated="false" @input="tabChanged">
|
||||||
@ -140,8 +115,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
activeTab: 0,
|
activeTab: 0,
|
||||||
isActive: false,
|
isActive: false
|
||||||
isEthLink: window.location.host === 'tornadocash.eth.link'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -3,13 +3,28 @@ export default ({ store, isHMR, app }, inject) => {
|
|||||||
inject('isLoadedFromIPFS', main)
|
inject('isLoadedFromIPFS', main)
|
||||||
}
|
}
|
||||||
function main() {
|
function main() {
|
||||||
const whiteListedDomains = ['localhost:3000', 'tornadocash.eth.link', 'tornadocash.eth.limo']
|
const whiteListedDomains = [
|
||||||
|
'tornadocash.3th.li',
|
||||||
|
'tornadocash.3th.ws',
|
||||||
|
'tornadocash.eth.link',
|
||||||
|
'tornadocash.eth.limo',
|
||||||
|
'tornadocashcommunity.3th.li',
|
||||||
|
'tornadocashcommunity.3th.ws',
|
||||||
|
'tornadocashcommunity.eth.link',
|
||||||
|
'tornadocashcommunity.eth.limo'
|
||||||
|
]
|
||||||
|
|
||||||
const NETLIFY_REGEXP = /deploy-preview-(\d+)--tornadocash\.netlify\.app/
|
const IPFS_GATEWAY_REGEXP = /.ipfs./
|
||||||
|
const IPFS_LOCAL_REGEXP = /.ipfs.localhost:/
|
||||||
|
const IPFS_SOP_GATEWAY_REGEXP = /\/ipfs\//
|
||||||
|
|
||||||
if (NETLIFY_REGEXP.test(window.location.host)) {
|
if (IPFS_LOCAL_REGEXP.test(window.location.host)) {
|
||||||
return false
|
return false
|
||||||
} else if (!whiteListedDomains.includes(window.location.host)) {
|
} else if (
|
||||||
|
IPFS_GATEWAY_REGEXP.test(window.location.host) ||
|
||||||
|
IPFS_SOP_GATEWAY_REGEXP.test(window.location.host) ||
|
||||||
|
whiteListedDomains.includes(window.location.host)
|
||||||
|
) {
|
||||||
console.warn('The page has been loaded from ipfs.io. LocalStorage is disabled')
|
console.warn('The page has been loaded from ipfs.io. LocalStorage is disabled')
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user