-
Notifications
You must be signed in to change notification settings - Fork 0
/
url.ts
51 lines (49 loc) · 1.31 KB
/
url.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { shell } from 'electron'
const EXTERNALS_WHITELIST = [
'thorchain.net',
'testnet.thorchain.net',
'docs.thorchain.org',
'discord.gg',
'twitter.com',
'github.com',
'explorer.binance.org',
'testnet-explorer.binance.org',
'blockstream.info',
'dex.binance.org',
'testnet-dex.binance.org',
'thoryield.com',
'app.thoryield.com',
'etherscan.io',
'ropsten.etherscan.io',
'tltc.bitaps.com',
'ltc.bitaps.com',
'www.blockchain.com',
'api.blockcypher.com',
'blockchair.com',
'blockexplorer.one',
'testnet.thorswap.finance',
'stagenet.thorswap.finance',
'app.thorswap.finance',
'viewblock.io',
'testnet.midgard.thorchain.info',
'stagenet-midgard.ninerealms.com',
'testnet-rpc.ninerealms.com',
'stagenet-rpc.ninerealms.com',
'rpc.ninerealms.com',
'testnet.thornode.thorchain.info',
'stagenet-thornode.ninerealms.com',
'stagenet-rpc.ninerealms.com',
'cosmos.bigdipper.live',
'explorer.theta-testnet.polypore.xyz'
]
export const openExternal = (target: string) => {
try {
const hostname = new URL(target)?.hostname ?? ''
if (EXTERNALS_WHITELIST.includes(hostname)) {
return shell.openExternal(target)
}
return Promise.reject(`URL ${target} has been blocked by ASGARDEX`)
} catch (e) {
return Promise.reject(`URL ${target} could not be parsed`)
}
}