fix: audit

This commit is contained in:
Pasha8914 2022-06-07 00:26:00 +10:00
parent 9f8aad114c
commit b91b81f5c9
21 changed files with 140 additions and 53 deletions

View file

@ -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
}

View file

@ -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)
}