tornado-classic-ui/plugins/detectIPFS.js

19 lines
569 B
JavaScript
Raw Permalink Normal View History

2022-04-22 05:05:56 +02:00
/* eslint-disable no-console */
export default ({ store, isHMR, app }, inject) => {
inject('isLoadedFromIPFS', main)
}
function main() {
2022-06-07 12:55:37 +02:00
const whiteListedDomains = ['localhost:3000', 'tornadocash.eth.link', 'tornadocash.eth.limo']
2022-04-22 05:05:56 +02:00
2022-07-05 12:15:45 +02:00
const NETLIFY_REGEXP = /deploy-preview-(\d+)--tornadocash\.netlify\.app/
2022-06-06 16:26:00 +02:00
if (NETLIFY_REGEXP.test(window.location.host)) {
2022-04-22 05:05:56 +02:00
return false
2022-06-06 16:26:00 +02:00
} else if (!whiteListedDomains.includes(window.location.host)) {
2022-04-22 05:05:56 +02:00
console.warn('The page has been loaded from ipfs.io. LocalStorage is disabled')
return true
}
return false
}