improve ipfs detection & update notifications
This commit is contained in:
parent
61c2865c46
commit
b2304b7008
2 changed files with 20 additions and 31 deletions
|
@ -3,13 +3,28 @@ export default ({ store, isHMR, app }, inject) => {
|
|||
inject('isLoadedFromIPFS', 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
|
||||
} 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')
|
||||
return true
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue