mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-14 09:45:06 +01:00
commit
34b749abed
@ -62,7 +62,7 @@ module.exports = {
|
|||||||
"no-nested-ternary": "off",
|
"no-nested-ternary": "off",
|
||||||
"prefer-destructuring": "off",
|
"prefer-destructuring": "off",
|
||||||
"no-param-reassign": "off",
|
"no-param-reassign": "off",
|
||||||
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
|
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
|
||||||
"react/jsx-filename-extension": [
|
"react/jsx-filename-extension": [
|
||||||
"error",
|
"error",
|
||||||
{ extensions: [".js", ".tsx", ".jsx"] }
|
{ extensions: [".js", ".tsx", ".jsx"] }
|
||||||
|
@ -94,6 +94,11 @@ export async function getApiToken(): Promise<string | null> {
|
|||||||
return apiToken;
|
return apiToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseEventInput(inp: string): any {
|
||||||
|
if (inp.length === 0) return {};
|
||||||
|
return JSON.parse(inp);
|
||||||
|
}
|
||||||
|
|
||||||
export async function connectServerSideEvents<T>(
|
export async function connectServerSideEvents<T>(
|
||||||
url: string,
|
url: string,
|
||||||
endEvents: string[],
|
endEvents: string[],
|
||||||
@ -115,12 +120,12 @@ export async function connectServerSideEvents<T>(
|
|||||||
endEvents.forEach((evt) => {
|
endEvents.forEach((evt) => {
|
||||||
eventSource.addEventListener(evt, (e) => {
|
eventSource.addEventListener(evt, (e) => {
|
||||||
eventSource.close();
|
eventSource.close();
|
||||||
promResolve(JSON.parse(e.data));
|
promResolve(parseEventInput(e.data));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
eventSource.addEventListener("token", (e) => {
|
eventSource.addEventListener("token", (e) => {
|
||||||
setApiToken(JSON.parse(e.data));
|
setApiToken(parseEventInput(e.data));
|
||||||
});
|
});
|
||||||
|
|
||||||
eventSource.addEventListener("error", (err: MessageEvent<any>) => {
|
eventSource.addEventListener("error", (err: MessageEvent<any>) => {
|
||||||
|
@ -215,7 +215,7 @@ export function getMediaDetails<
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getMediaPoster(posterPath: string | null): string | undefined {
|
export function getMediaPoster(posterPath: string | null): string | undefined {
|
||||||
if (posterPath) return `https://image.tmdb.org/t/p/w185/${posterPath}`;
|
if (posterPath) return `https://image.tmdb.org/t/p/w342/${posterPath}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getEpisodes(
|
export async function getEpisodes(
|
||||||
|
@ -50,11 +50,7 @@ export function OverlayPortal(props: {
|
|||||||
{portalElement
|
{portalElement
|
||||||
? createPortal(
|
? createPortal(
|
||||||
<Transition show={props.show} animation="none">
|
<Transition show={props.show} animation="none">
|
||||||
<FocusTrap
|
<FocusTrap>
|
||||||
focusTrapOptions={{
|
|
||||||
onDeactivate: close,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className="popout-wrapper fixed overflow-hidden pointer-events-auto inset-0 z-[999] select-none">
|
<div className="popout-wrapper fixed overflow-hidden pointer-events-auto inset-0 z-[999] select-none">
|
||||||
<Transition animation="fade" isChild>
|
<Transition animation="fade" isChild>
|
||||||
<div
|
<div
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { PointerEvent, useCallback } from "react";
|
import { PointerEvent, useCallback } from "react";
|
||||||
|
import { useEffectOnce, useTimeoutFn } from "react-use";
|
||||||
|
|
||||||
import { useShouldShowVideoElement } from "@/components/player/internals/VideoContainer";
|
import { useShouldShowVideoElement } from "@/components/player/internals/VideoContainer";
|
||||||
import { PlayerHoverState } from "@/stores/player/slices/interface";
|
import { PlayerHoverState } from "@/stores/player/slices/interface";
|
||||||
@ -13,6 +14,12 @@ export function VideoClickTarget(props: { showingControls: boolean }) {
|
|||||||
(s) => s.updateInterfaceHovering,
|
(s) => s.updateInterfaceHovering,
|
||||||
);
|
);
|
||||||
const hovering = usePlayerStore((s) => s.interface.hovering);
|
const hovering = usePlayerStore((s) => s.interface.hovering);
|
||||||
|
const [_, cancel, reset] = useTimeoutFn(() => {
|
||||||
|
updateInterfaceHovering(PlayerHoverState.NOT_HOVERING);
|
||||||
|
}, 3000);
|
||||||
|
useEffectOnce(() => {
|
||||||
|
cancel();
|
||||||
|
});
|
||||||
|
|
||||||
const toggleFullscreen = useCallback(() => {
|
const toggleFullscreen = useCallback(() => {
|
||||||
display?.toggleFullscreen();
|
display?.toggleFullscreen();
|
||||||
@ -29,11 +36,15 @@ export function VideoClickTarget(props: { showingControls: boolean }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// toggle on other types of clicks
|
// toggle on other types of clicks
|
||||||
if (hovering !== PlayerHoverState.MOBILE_TAPPED)
|
if (hovering !== PlayerHoverState.MOBILE_TAPPED) {
|
||||||
updateInterfaceHovering(PlayerHoverState.MOBILE_TAPPED);
|
updateInterfaceHovering(PlayerHoverState.MOBILE_TAPPED);
|
||||||
else updateInterfaceHovering(PlayerHoverState.NOT_HOVERING);
|
reset();
|
||||||
|
} else {
|
||||||
|
updateInterfaceHovering(PlayerHoverState.NOT_HOVERING);
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[display, isPaused, hovering, updateInterfaceHovering],
|
[display, isPaused, hovering, updateInterfaceHovering, reset, cancel],
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!show) return null;
|
if (!show) return null;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
|
|
||||||
import { Button } from "@/components/buttons/Button";
|
import { Button } from "@/components/buttons/Button";
|
||||||
import { Icons } from "@/components/Icon";
|
import { Icons } from "@/components/Icon";
|
||||||
@ -9,6 +10,7 @@ import { Paragraph } from "@/components/text/Paragraph";
|
|||||||
import { Title } from "@/components/text/Title";
|
import { Title } from "@/components/text/Title";
|
||||||
import { ScrapingItems, ScrapingSegment } from "@/hooks/useProviderScrape";
|
import { ScrapingItems, ScrapingSegment } from "@/hooks/useProviderScrape";
|
||||||
import { ErrorContainer, ErrorLayout } from "@/pages/layouts/ErrorLayout";
|
import { ErrorContainer, ErrorLayout } from "@/pages/layouts/ErrorLayout";
|
||||||
|
import { getProviderApiUrls } from "@/utils/proxyUrls";
|
||||||
|
|
||||||
import { ErrorCardInModal } from "../errors/ErrorCard";
|
import { ErrorCardInModal } from "../errors/ErrorCard";
|
||||||
|
|
||||||
@ -22,21 +24,21 @@ export interface ScrapeErrorPartProps {
|
|||||||
export function ScrapeErrorPart(props: ScrapeErrorPartProps) {
|
export function ScrapeErrorPart(props: ScrapeErrorPartProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const modal = useModal("error");
|
const modal = useModal("error");
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
const error = useMemo(() => {
|
const error = useMemo(() => {
|
||||||
const data = props.data;
|
const data = props.data;
|
||||||
const amountError = Object.values(data.sources).filter(
|
|
||||||
(v) => v.status === "failure",
|
|
||||||
);
|
|
||||||
if (amountError.length === 0) return null;
|
|
||||||
let str = "";
|
let str = "";
|
||||||
|
const apiUrls = getProviderApiUrls();
|
||||||
|
str += `URL - ${location.pathname}\n`;
|
||||||
|
str += `API - ${apiUrls.length > 0}\n\n`;
|
||||||
Object.values(data.sources).forEach((v) => {
|
Object.values(data.sources).forEach((v) => {
|
||||||
str += `${v.id}: ${v.status}\n`;
|
str += `${v.id}: ${v.status}\n`;
|
||||||
if (v.reason) str += `${v.reason}\n`;
|
if (v.reason) str += `${v.reason}\n`;
|
||||||
if (v.error) str += `${v.error.toString()}\n`;
|
if (v.error) str += `${v.error.toString()}\n`;
|
||||||
});
|
});
|
||||||
return str;
|
return str;
|
||||||
}, [props]);
|
}, [props, location]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ErrorLayout>
|
<ErrorLayout>
|
||||||
|
Loading…
Reference in New Issue
Block a user