2022-04-21 23:05:56 -04:00
|
|
|
/* eslint-disable no-console */
|
|
|
|
export default ({ store, isHMR, app }, inject) => {
|
|
|
|
inject('isLoadedFromIPFS', main)
|
|
|
|
}
|
|
|
|
function main() {
|
2022-11-11 20:12:11 -05:00
|
|
|
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'
|
|
|
|
]
|
2022-04-21 23:05:56 -04:00
|
|
|
|
2022-11-11 20:12:11 -05:00
|
|
|
const IPFS_GATEWAY_REGEXP = /.ipfs./
|
|
|
|
const IPFS_LOCAL_REGEXP = /.ipfs.localhost:/
|
|
|
|
const IPFS_SOP_GATEWAY_REGEXP = /\/ipfs\//
|
2022-06-06 10:26:00 -04:00
|
|
|
|
2022-11-11 20:12:11 -05:00
|
|
|
if (IPFS_LOCAL_REGEXP.test(window.location.host)) {
|
2022-04-21 23:05:56 -04:00
|
|
|
return false
|
2022-11-11 20:12:11 -05:00
|
|
|
} else if (
|
|
|
|
IPFS_GATEWAY_REGEXP.test(window.location.host) ||
|
|
|
|
IPFS_SOP_GATEWAY_REGEXP.test(window.location.host) ||
|
|
|
|
whiteListedDomains.includes(window.location.host)
|
|
|
|
) {
|
2022-04-21 23:05:56 -04:00
|
|
|
console.warn('The page has been loaded from ipfs.io. LocalStorage is disabled')
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
|
|
|
}
|