mirror of
https://github.com/p-stream/p-stream.git
synced 2026-04-21 02:42:26 +00:00
fix m3u8 proxy test error
This commit is contained in:
parent
00d0996b8f
commit
c6c916f293
1 changed files with 9 additions and 1 deletions
|
|
@ -20,7 +20,15 @@ export function M3U8ProxyItem(props: {
|
||||||
enabled?: boolean;
|
enabled?: boolean;
|
||||||
onToggle?: (enabled: boolean) => void;
|
onToggle?: (enabled: boolean) => void;
|
||||||
}) {
|
}) {
|
||||||
const urlWithoutProtocol = props.url ? new URL(props.url).host : null;
|
const urlWithoutProtocol = useMemo(() => {
|
||||||
|
if (!props.url) return null;
|
||||||
|
try {
|
||||||
|
return new URL(props.url).host;
|
||||||
|
} catch {
|
||||||
|
// Handle malformed URLs gracefully
|
||||||
|
return props.url;
|
||||||
|
}
|
||||||
|
}, [props.url]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex mb-2">
|
<div className="flex mb-2">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue