diff --git a/components/Footer.vue b/components/Footer.vue
index 1072fb7..e232c50 100644
--- a/components/Footer.vue
+++ b/components/Footer.vue
@@ -12,7 +12,7 @@
class="footer-address__value"
target="_blank"
:href="addressExplorerUrl(donationsAddress)"
- rel="noreferrer"
+ rel="noopener noreferrer"
>{{ donationsAddress }}
@@ -31,7 +31,7 @@
type="is-icon"
:href="duneLink"
target="_blank"
- rel="noreferrer"
+ rel="noopener noreferrer"
icon-right="stats"
>
diff --git a/components/Job.vue b/components/Job.vue
index 3641553..d77466b 100644
--- a/components/Job.vue
+++ b/components/Job.vue
@@ -14,7 +14,12 @@
-
+
{{ job.txHash }}
diff --git a/components/MetamaskNavbarIcon.vue b/components/MetamaskNavbarIcon.vue
index 74dbb2f..64e66e6 100644
--- a/components/MetamaskNavbarIcon.vue
+++ b/components/MetamaskNavbarIcon.vue
@@ -3,7 +3,9 @@
{{ $t('web3connected') }}
- {{ shortAddress(ethAccount) }}
+ {{
+ shortAddress(ethAccount)
+ }}
{{ currency }}
diff --git a/components/Navbar.vue b/components/Navbar.vue
index ffb9cb4..4ff2aed 100644
--- a/components/Navbar.vue
+++ b/components/Navbar.vue
@@ -18,7 +18,12 @@
{{ $t('compliance') }}
-
+
{{ $t('docs') }}
diff --git a/components/Notices.vue b/components/Notices.vue
index bd5c1d3..12c3c80 100644
--- a/components/Notices.vue
+++ b/components/Notices.vue
@@ -18,10 +18,15 @@
{{ notice.description }}
-
+
Tornado Cash Nova
-
+
{{ $t('viewOnEtherscan') }}
diff --git a/components/Tx.vue b/components/Tx.vue
index f1b4063..4d6c3c3 100644
--- a/components/Tx.vue
+++ b/components/Tx.vue
@@ -22,7 +22,12 @@
-
+
{{ tx.txHash }}
diff --git a/components/governance/Proposal.vue b/components/governance/Proposal.vue
index eb75c09..410619a 100644
--- a/components/governance/Proposal.vue
+++ b/components/governance/Proposal.vue
@@ -123,7 +123,7 @@
{{ $t('proposalAddress') }}
diff --git a/components/governance/manage/tabs/DelegateTab.vue b/components/governance/manage/tabs/DelegateTab.vue
index 6bd1749..fcb9c8f 100644
--- a/components/governance/manage/tabs/DelegateTab.vue
+++ b/components/governance/manage/tabs/DelegateTab.vue
@@ -12,7 +12,9 @@
{
this.withdrawAddress = ''
this.withdrawNote = ''
diff --git a/langs/en.json b/langs/en.json
index f89753a..06b28ce 100644
--- a/langs/en.json
+++ b/langs/en.json
@@ -452,5 +452,9 @@
"name": "Name",
"fee": "Fee"
},
- "withdrawalQueueIsOverloaded": "Withdrawal queue is overloaded"
+ "withdrawalQueueIsOverloaded": "Withdrawal queue is overloaded",
+ "trustBanner": {
+ "trustLess": "You are using an public IPFS gateway. Tornado Cash dApp can not use all security features of your browser. Check out {link} for alternatives",
+ "link": "landing page"
+ }
}
diff --git a/layouts/default.vue b/layouts/default.vue
index bce19b5..68e62d0 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -69,6 +69,7 @@ export default {
},
mounted() {
this.$preventMultitabs()
+ window.addEventListener('focus', this.$preventMultitabs)
if (process.browser) {
window.onNuxtReady(() => {
@@ -108,6 +109,9 @@ export default {
})
}
},
+ beforeDestroy() {
+ window.removeEventListener('focus', this.$preventMultitabs)
+ },
methods: {
...mapActions('settings', ['checkCurrentRpc', 'preselectRpc']),
checkRecoveryKey() {
diff --git a/middleware/provider.js b/middleware/provider.js
index e73a573..32f7dfa 100644
--- a/middleware/provider.js
+++ b/middleware/provider.js
@@ -39,6 +39,12 @@ const providerMiddleware = async ({ store }) => {
const chainId = hexToNumber(await provider.request({ method: 'eth_chainId' }))
await checkProvider({ store, accounts, chainId, providerName })
+ } else {
+ const storedNetId = window.localStorage.getItem('netId')
+
+ if (networkConfig[`netId${storedNetId}`]) {
+ await store.dispatch('metamask/onNetworkChanged', { netId: Number(storedNetId) })
+ }
}
} catch (err) {
console.error(`Provider container has error: ${err.message}`)
diff --git a/nuxt.config.js b/nuxt.config.js
index 9023a8e..5ca190c 100644
--- a/nuxt.config.js
+++ b/nuxt.config.js
@@ -47,6 +47,27 @@ export default {
title: 'Tornado.cash',
meta: [
{ charset: 'utf-8' },
+ {
+ 'http-equiv': 'Content-Security-Policy',
+ content: ''
+ },
+ // move to req middlevare
+ // {
+ // 'http-equiv': 'Permissions-Policy',
+ // content: 'geolocation=()'
+ // },
+ // {
+ // 'http-equiv': 'Strict-Transport-Security',
+ // content: 'max-age=31536000;'
+ // },
+ // {
+ // 'http-equiv': 'X-Content-Type-Options',
+ // content: 'nosniff'
+ // },
+ {
+ name: 'Referer-Policy',
+ content: 'no-referrer'
+ },
{
name: 'viewport',
content: 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'
diff --git a/pages/compliance.vue b/pages/compliance.vue
index ff1cdde..9827049 100644
--- a/pages/compliance.vue
+++ b/pages/compliance.vue
@@ -69,6 +69,7 @@
v-if="txDepositInfo.txHash"
:href="txExplorerUrl(txDepositInfo.txHash)"
target="_blank"
+ rel="noopener noreferrer"
class="value"
:data-value="txDepositInfo.txHash"
>
@@ -82,6 +83,7 @@
v-if="txDepositInfo.txHash"
:href="addressExplorerUrl(txDepositInfo.from)"
target="_blank"
+ rel="noopener noreferrer"
class="value"
>
{{ txDepositInfo.from }}
@@ -155,6 +157,7 @@
v-if="txWithdrawalInfo.txHash"
:href="txExplorerUrl(txWithdrawalInfo.txHash)"
target="_blank"
+ rel="noopener noreferrer"
class="value"
:data-value="txWithdrawalInfo.txHash"
>
@@ -168,6 +171,7 @@
v-if="txWithdrawalInfo.to"
:href="addressExplorerUrl(txWithdrawalInfo.to)"
target="_blank"
+ rel="noopener noreferrer"
class="value"
>
{{ txWithdrawalInfo.to }}
diff --git a/pages/index.vue b/pages/index.vue
index c981668..d6fe9b9 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -13,6 +13,22 @@
+
+
+
+ {{ $t('trustBanner.link') }}
+
+
+
+
{{ $t('indexNotificationLinkText') }}
@@ -82,21 +98,20 @@ export default {
},
created() {
this.$store.dispatch('application/setNativeCurrency', { netId: this.netId })
- },
- mounted() {
- if (this.$route.query.note) {
- this.activeTab = 1
- }
+ this.checkIsTrustedUrl()
},
methods: {
...mapActions('settings', ['disableNotification']),
+ checkIsTrustedUrl() {
+ const isIpfs = this.$isLoadedFromIPFS()
+ if (!isIpfs) {
+ this.disableNotification({ key: 'third' })
+ }
+ },
onGetKey(fn) {
this.getKeys = fn
},
async tabChanged(tabIndex) {
- if (!this.$route.query.note) {
- this.$root.$emit('resetWithdraw')
- }
if (tabIndex === 1) {
this.$store.dispatch('relayer/pickRandomRelayer', { type: 'tornado' })
diff --git a/plugins/detectIPFS.js b/plugins/detectIPFS.js
index ecee982..0308a31 100644
--- a/plugins/detectIPFS.js
+++ b/plugins/detectIPFS.js
@@ -3,20 +3,17 @@ export default ({ store, isHMR, app }, inject) => {
inject('isLoadedFromIPFS', main)
}
function main() {
- const domainWhiteList = [
- 'tornado.cash',
- 'localhost:3000',
- 'stage.tornado.cash',
- 'tornadocash.eth',
+ const whiteListedDomains = [
+ // 'localhost:3000',
'tornadocash.eth.link',
- 'tornadocash.eth.limo',
- 'app.tornado.cash',
- 'donotshare.tornado.cash'
+ 'tornadocash.eth.limo'
]
- if (window.location.host.includes('tornadocash.netlify.app')) {
+ const NETLIFY_REGEXP = /https:\/\/deploy-preview-(\d+)--tornadocash\.netlify\.app/
+
+ if (NETLIFY_REGEXP.test(window.location.host)) {
return false
- } else if (!domainWhiteList.includes(window.location.host)) {
+ } else if (!whiteListedDomains.includes(window.location.host)) {
console.warn('The page has been loaded from ipfs.io. LocalStorage is disabled')
return true
}
diff --git a/plugins/localStorage.js b/plugins/localStorage.js
index 47aeb41..1a5b2ca 100644
--- a/plugins/localStorage.js
+++ b/plugins/localStorage.js
@@ -21,16 +21,23 @@ export default ({ store, isHMR }) => {
return
}
- const paths = ['metamask.netId', 'application.selectedStatistic', 'application.selectedInstance']
-
if (!store.$isLoadedFromIPFS()) {
- paths.push('txHashKeeper', 'settings', 'account', 'relayer.jobs', 'encryptedNote.ui')
+ const paths = [
+ 'metamask.netId',
+ 'application.selectedStatistic',
+ 'application.selectedInstance',
+ 'txHashKeeper',
+ 'settings',
+ 'account',
+ 'relayer.jobs',
+ 'encryptedNote.ui'
+ ]
+
+ migrate()
+
+ createPersistedState({
+ key: STORE_NAME,
+ paths
+ })(store)
}
-
- migrate()
-
- createPersistedState({
- key: STORE_NAME,
- paths
- })(store)
}
diff --git a/store/metamask.js b/store/metamask.js
index c03b1e8..c260e6a 100644
--- a/store/metamask.js
+++ b/store/metamask.js
@@ -82,6 +82,8 @@ const mutations = {
},
SET_NET_ID(state, netId) {
netId = parseInt(netId, 10)
+ window.localStorage.setItem('netId', netId)
+
state.netId = netId
},
SET_RECONNECTING(state, bool) {
diff --git a/store/relayer.js b/store/relayer.js
index 7683834..7f1048f 100644
--- a/store/relayer.js
+++ b/store/relayer.js
@@ -337,13 +337,15 @@ export const actions = {
async getCustomRelayerData({ rootState, state, getters, rootGetters, dispatch }, { url, name }) {
const provider = getters.ethProvider.eth
- if (!url.startsWith('https:') && !url.startsWith('http:')) {
- if (url.includes('.onion')) {
+ const PROTOCOL_REGEXP = /^(http(s?))/
+ if (!PROTOCOL_REGEXP.test(url)) {
+ if (url.endsWith('.onion')) {
url = `http://${url}`
} else {
url = `https://${url}`
}
}
+
const urlParser = new URL(url)
urlParser.href = url
let ensName = name
diff --git a/store/settings.js b/store/settings.js
index 07bd48b..94ebe80 100644
--- a/store/settings.js
+++ b/store/settings.js
@@ -20,7 +20,8 @@ export const state = () => {
...rpcData,
isActiveNotification: {
first: true,
- second: true
+ second: true,
+ third: true
}
}
}