Merge pull request #1139 from Stremio/fix/correct-allowed-hosts-logic
Some checks are pending
Build / build (push) Waiting to run

Dev: Fix host whitelist logic
This commit is contained in:
Timothy Z. 2026-02-23 16:12:41 +03:00 committed by GitHub
commit b49eb516fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,7 +18,9 @@ const PlatformProvider = ({ children }: Props) => {
const openExternal = (url: string) => { const openExternal = (url: string) => {
try { try {
const { hostname } = new URL(url); 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; const finalUrl = !isWhitelisted ? `https://www.stremio.com/warning#${encodeURIComponent(url)}` : url;
window.open(finalUrl, '_blank'); window.open(finalUrl, '_blank');