mirror of
https://github.com/p-stream/p-stream.git
synced 2026-03-11 17:55:33 +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;
|
||||
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 (
|
||||
<div className="flex mb-2">
|
||||
|
|
|
|||
Loading…
Reference in a new issue