fix: SITE_URL

This commit is contained in:
ner committed 2024-10-28 17:20:05 +02:00
1 parent 1fe912f4bd
commit dfdfb79169
66 files changed
+1352 -240

No files matched your search

@@ -1,6 +1,6 @@
import { useQuery } from '@tanstack/react-query';
import creditsQuery, { CreditsQueryProps } from '@/api/queries/credits';
import creditsQuery, { CreditsQueryProps } from '@/data/queries/credits';
const useCredits = ({ showId, showType }: CreditsQueryProps) => {
return useQuery(creditsQuery({ showId, showType }));
@@ -1,16 +1,15 @@
import { useQuery } from '@tanstack/react-query';
import { STREAM_URL as BASE_STREAM_URL } from '../../constants';
import { STREAM_URL } from '@/env';
export type Source = { name: string; src: string; type: string };
type Sources = { subtitles: Source[]; videos: Source[] };
const useFiles = (magnet: string) => {
const STREAM_URL = `${BASE_STREAM_URL}${encodeURIComponent(magnet)}`;
const streamUrl = `${STREAM_URL}?link=${encodeURIComponent(magnet)}`;
const query = useQuery<Stream>({
queryKey: ['files', magnet],
queryFn: () => fetch(`${STREAM_URL}&stat`).then((response) => response.json())
queryFn: () => fetch(`${streamUrl}&stat`).then((response) => response.json())
});
return {
@@ -18,11 +17,11 @@ const useFiles = (magnet: string) => {
data: (query.data?.file_stats || []).reduce<Sources>(
(sources, file) => {
if (file.path.endsWith('.mp4')) {
sources.videos.push({ src: `${STREAM_URL}&index=${file.id}&play`, name: file.path, type: 'video/mp4' });
sources.videos.push({ src: `${streamUrl}&index=${file.id}&play`, name: file.path, type: 'video/mp4' });
}
if (file.path.endsWith('.srt')) {
sources.subtitles.push({ src: `${STREAM_URL}&index=${file.id}&play`, name: file.path, type: 'srt' });
sources.subtitles.push({ src: `${streamUrl}&index=${file.id}&play`, name: file.path, type: 'srt' });
}
return sources;
@@ -1,8 +1,8 @@
import { FC } from 'react';
import { ArrowDownIcon } from 'lucide-react';
import { Sort } from '@/api/parsers';
import { TableHead } from '@/components/ui/table';
import { Sort } from '@/data/parsers';
import { cn } from '@/lib/utils';
interface Props {
@@ -1,9 +1,10 @@
import { FC } from 'react';
import { Cast, Download, ListVideo, Loader, Magnet, Play } from 'lucide-react';
import { Quality } from '@/api/parsers/yts/models';
import { Button } from '@/components/ui/button';
import ButtonsGroup from '@/components/ui/buttons-group';
import { Quality } from '@/data/parsers/yts/models';
import { STREAM_URL } from '@/env';
import { cn } from '@/lib/utils';
import { providers } from '../../../../constants';
@@ -55,7 +56,7 @@ const Actions: FC<Props> = ({ torrent, backdrop, title, provider }) => {
<Button variant='outline' className='relative grow-0 px-3' title='Download m3u playlist'>
<a
className='absolute left-0 top-0 size-full'
href={`${process.env.NEXT_PUBLIC_TORRENT_PROXY}/stream?m3u&link=${encodeURIComponent(magnet)}`}
href={`${STREAM_URL}?m3u&link=${encodeURIComponent(magnet)}`}
/>
<ListVideo size={20} />
</Button>
@@ -1,7 +1,7 @@
import { FC, Fragment } from 'react';
import { Sort } from '@/api/parsers';
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
import { Sort } from '@/data/parsers';
import showHostManagerModal from '../HostManager';
import TableHeadSortable from '../TableHeadSortable';
@@ -1,6 +1,4 @@
import { Sort } from '@/api/parsers';
export const STREAM_URL = `${process.env.NEXT_PUBLIC_TORRENT_PROXY}/stream?link=`;
import { Sort } from '@/data/parsers';
type Options = { query: string; sort: Sort; imdbID: string };
@@ -3,10 +3,10 @@ import { create, InstanceProps } from 'react-modal-promise';
import { TabsContent } from '@radix-ui/react-tabs';
import { Loader } from 'lucide-react';
import { Sort } from '@/api/parsers';
import { Button } from '@/components/ui/button';
import { Modal } from '@/components/ui/dialog';
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { Sort } from '@/data/parsers';
import TorrentsTable from './components/TorrentsTable';
import { providers } from './constants';
@@ -1,6 +1,6 @@
import { useQuery } from '@tanstack/react-query';
import { Sort } from '@/api/parsers';
import { Sort } from '@/data/parsers';
const useTorrents = ({
query,
+1 -1
View File
@@ -1,6 +1,6 @@
import { useQuery } from '@tanstack/react-query';
import detailsQuery from '@/api/queries/details';
import detailsQuery from '@/data/queries/details';
interface Props {
showId?: Show['id'];