fix: m3u emitter for safari
This commit is contained in:
1 parent
7b5420a989
commit
c34f8fd3d0
2 files changed
+19
No files matched your search
@@ -6,6 +6,7 @@ import { Button } from '@/components/ui/button';
|
|||||||
import { Modal } from '@/components/ui/dialog';
|
import { Modal } from '@/components/ui/dialog';
|
||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
import { useM3UUrl, useSetM3UUrl } from '@/hooks/useM3UStreamUrl';
|
import { useM3UUrl, useSetM3UUrl } from '@/hooks/useM3UStreamUrl';
|
||||||
|
import { useSession } from '@/hooks/useSession';
|
||||||
import { useSetStreamUrl, useStreamUrl } from '@/hooks/useStreamUrl';
|
import { useSetStreamUrl, useStreamUrl } from '@/hooks/useStreamUrl';
|
||||||
|
|
||||||
import { usePrefix, useSetPrefix } from '../../hooks/useMagnetHosts';
|
import { usePrefix, useSetPrefix } from '../../hooks/useMagnetHosts';
|
||||||
@@ -17,6 +18,7 @@ const showHostManagerModal = create<InstanceProps<string>>(({ onResolve, onRejec
|
|||||||
const submitStreamUrl = useSetStreamUrl();
|
const submitStreamUrl = useSetStreamUrl();
|
||||||
const [M3UUrl, setM3UUrl] = useState(useM3UUrl());
|
const [M3UUrl, setM3UUrl] = useState(useM3UUrl());
|
||||||
const submitM3UUrl = useSetM3UUrl();
|
const submitM3UUrl = useSetM3UUrl();
|
||||||
|
const [session, setSession] = useState(useSession);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal className='m-auto p-2' onClose={onReject}>
|
<Modal className='m-auto p-2' onClose={onReject}>
|
||||||
@@ -53,6 +55,13 @@ const showHostManagerModal = create<InstanceProps<string>>(({ onResolve, onRejec
|
|||||||
className='h-full'
|
className='h-full'
|
||||||
onChange={({ target: { value } }) => setM3UUrl(value)}
|
onChange={({ target: { value } }) => setM3UUrl(value)}
|
||||||
/>
|
/>
|
||||||
|
<Input
|
||||||
|
autoFocus
|
||||||
|
placeholder='Enter token of your session'
|
||||||
|
value={session}
|
||||||
|
className='h-full'
|
||||||
|
onChange={({ target: { value } }) => setSession(value)}
|
||||||
|
/>
|
||||||
<Button
|
<Button
|
||||||
type='submit'
|
type='submit'
|
||||||
className='h-full !px-3 transition-all duration-200 hover:bg-secondary-foreground hover:shadow-lg hover:shadow-secondary-foreground/60'
|
className='h-full !px-3 transition-all duration-200 hover:bg-secondary-foreground hover:shadow-lg hover:shadow-secondary-foreground/60'
|
||||||
|
|||||||
+10
@@ -67,7 +67,17 @@ const Actions: FC<Props> = ({ torrent, title, provider, show }) => {
|
|||||||
runtime: show.runtime?.toString() ?? ''
|
runtime: show.runtime?.toString() ?? ''
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (isSafari) {
|
||||||
|
return fetch(`${M3UUrl}?${params}`, {
|
||||||
|
method: 'GET',
|
||||||
|
keepalive: true
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
.finally(() => setIsStreamPending(false));
|
||||||
|
}
|
||||||
|
|
||||||
const resolver = new Image();
|
const resolver = new Image();
|
||||||
|
|
||||||
resolver.src = `${M3UUrl}?${params}`;
|
resolver.src = `${M3UUrl}?${params}`;
|
||||||
resolver.onerror = resolver.onload = () => setIsStreamPending(false);
|
resolver.onerror = resolver.onload = () => setIsStreamPending(false);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user