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 { useRef } from 'react';
import searchQuery, { SearchQueryProps } from '@/api/queries/search';
import searchQuery, { SearchQueryProps } from '@/data/queries/search';
import useInfiniteList from '@/hooks/useInfiniteList';
const useSearch = (props: SearchQueryProps) => {
+2 -1
View File
@@ -1,9 +1,10 @@
import { useRef } from 'react';
import { useMutation } from '@tanstack/react-query';
import { createRequestToken, createSession } from '@/api';
import { useSetSession } from '@/hooks/useSession';
import { createRequestToken, createSession } from '../../../../data';
const useAuth = () => {
const setSession = useSetSession();
const tabRef = useRef<Window | null>(null);
@@ -5,7 +5,7 @@ import { useSetSession } from '@/hooks/useSession';
const useLogOut = () => {
const setSession = useSetSession();
return useCallback(() => setSession(null), [setSession]);
return useCallback(() => setSession(undefined), [setSession]);
};
export default useLogOut;
+2 -3
View File
@@ -2,6 +2,7 @@ import { FC } from 'react';
import Link from 'next/link';
import { Badge } from '@/components/ui/badge';
import { TITLE } from '@/env';
import { cn } from '@/lib/utils';
import { DesktopNavigation, MobileNavigation } from './components/Navigation';
@@ -23,9 +24,7 @@ const Header: FC<Props> = ({ className }) => (
<div className='container'>
<div className='flex items-center justify-between gap-2 xs:flex-nowrap'>
<Link shallow href='/'>
<Badge className='cursor-pointer whitespace-nowrap text-[15px] font-normal leading-[18px]'>
Movie advisor
</Badge>
<Badge className='cursor-pointer whitespace-nowrap text-[15px] font-normal leading-[18px]'>{TITLE}</Badge>
</Link>
<DesktopNavigation />
<div className='flex items-center gap-2'>
@@ -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'];
+1 -1
View File
@@ -3,7 +3,7 @@
import { startTransition, useCallback } from 'react';
import { atom, getDefaultStore, useAtom } from 'jotai';
import randomQuery from '@/api/queries/random';
import randomQuery from '@/data/queries/random';
import useInfiniteList from '@/hooks/useInfiniteList';
const indexAtom = atom(0);
+1 -1
View File
@@ -1,6 +1,6 @@
import { useQuery } from '@tanstack/react-query';
import trendingQuery, { TrendingQueryProps } from '@/api/queries/trending';
import trendingQuery, { TrendingQueryProps } from '@/data/queries/trending';
const useTrending = ({ type }: TrendingQueryProps) => useQuery(trendingQuery({ type }));
+4 -8
View File
@@ -3,7 +3,6 @@
import { FC } from 'react';
import List from '@/components/List';
import useMounted from '@/hooks/useMounted';
import useUsersShows from '@/hooks/useUsersShows';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '../ui/tabs';
@@ -11,21 +10,18 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '../ui/tabs';
interface Props {
list: 'favorite' | 'watchlist';
label: string;
session?: string;
}
const UsersList: FC<Props> = ({ list, label }) => {
const isMounted = useMounted();
const movies = useUsersShows({ list, showType: 'movie' });
const series = useUsersShows({ list, showType: 'tv' });
const UsersList: FC<Props> = ({ list, label, session }) => {
const movies = useUsersShows({ list, showType: 'movie', session });
const series = useUsersShows({ list, showType: 'tv', session });
const tabs = [
{ query: movies, title: 'Movies', key: 'movie' as const },
{ query: series, title: 'Series', key: 'tv' as const }
];
if (!isMounted) return null;
return (
<Tabs defaultValue='movie' className='flex w-full flex-col items-center'>
<TabsList className='grid w-full grid-cols-2 sm:w-[300px]'>
+4 -5
View File
@@ -178,11 +178,10 @@ const Modal: React.FC<{
React.useLayoutEffect(() => {
const viewport = document.querySelector('[name="viewport"]');
viewport?.setAttribute('content', 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no');
return () => {
viewport?.setAttribute('content', 'width=device-width, initial-scale=1.0');
};
viewport?.setAttribute(
'content',
'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover'
);
}, []);
const handleClose = () => {