Fix https stream proxies

This commit is contained in:
2026-03-11 17:03:03 +01:00
parent 8745a433dc
commit 9f2063d088
2 changed files with 5 additions and 20 deletions

View File

@@ -1,11 +1,5 @@
const APP_BASE_PATH = import.meta.env.BASE_URL ?? '/';
/** Returns whether a hostname belongs to Dropbox domains that often need proxy support. */
function isDropboxHost(hostname: string): boolean {
const host = hostname.toLowerCase();
return host.endsWith('dropbox.com') || host.endsWith('dropboxusercontent.com');
}
/** Returns whether the URL already points at the local media proxy. */
function isLocalMediaProxyUrl(parsed: URL): boolean {
return parsed.origin === window.location.origin && parsed.pathname.toLowerCase().endsWith('/media_proxy.php');
@@ -15,15 +9,12 @@ function isLocalMediaProxyUrl(parsed: URL): boolean {
export function shouldProxyRadioStreamUrl(streamUrl: string): boolean {
try {
const parsed = new URL(streamUrl);
if (isLocalMediaProxyUrl(parsed)) {
return false;
}
if (parsed.protocol === 'http:') return true;
if (parsed.protocol === 'https:' && isDropboxHost(parsed.hostname)) return true;
if (isLocalMediaProxyUrl(parsed)) return false;
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return false;
return parsed.origin !== window.location.origin;
} catch {
return false;
}
return false;
}
/** Returns whether an arbitrary external media URL should be proxied before Web Audio playback. */

View File

@@ -112,11 +112,6 @@ function connectRadioChannelSource(
}
/** Returns whether a hostname belongs to Dropbox domains that need proxy support. */
function isDropboxHost(hostname: string): boolean {
const host = hostname.toLowerCase();
return host.endsWith('dropbox.com') || host.endsWith('dropboxusercontent.com');
}
export function shouldProxyStreamUrl(streamUrl: string): boolean {
try {
const parsed = new URL(streamUrl);
@@ -126,12 +121,11 @@ export function shouldProxyStreamUrl(streamUrl: string): boolean {
) {
return false;
}
if (parsed.protocol === 'http:') return true;
if (parsed.protocol === 'https:' && isDropboxHost(parsed.hostname)) return true;
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return false;
return parsed.origin !== window.location.origin;
} catch {
return false;
}
return false;
}
export function getProxyUrlForStream(streamUrl: string): string {