mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 13:05:48 +00:00
Merge pull request #1139 from Stremio/fix/correct-allowed-hosts-logic
Some checks are pending
Build / build (push) Waiting to run
Some checks are pending
Build / build (push) Waiting to run
Dev: Fix host whitelist logic
This commit is contained in:
commit
b49eb516fd
1 changed files with 3 additions and 1 deletions
|
|
@ -18,7 +18,9 @@ const PlatformProvider = ({ children }: Props) => {
|
|||
const openExternal = (url: string) => {
|
||||
try {
|
||||
const { hostname } = new URL(url);
|
||||
const isWhitelisted = WHITELISTED_HOSTS.some((host: string) => hostname.endsWith(host));
|
||||
const isWhitelisted = WHITELISTED_HOSTS.some((host: string) =>
|
||||
hostname === host || hostname.endsWith('.' + host)
|
||||
);
|
||||
const finalUrl = !isWhitelisted ? `https://www.stremio.com/warning#${encodeURIComponent(url)}` : url;
|
||||
|
||||
window.open(finalUrl, '_blank');
|
||||
|
|
|
|||
Loading…
Reference in a new issue