From f2a5054f76e2124dc5fae15b1dc2166f1db3c842 Mon Sep 17 00:00:00 2001 From: Radiquum Date: Wed, 9 Jul 2025 02:53:12 +0500 Subject: [PATCH] Revert "feat: return additional env var for anilibria player parsing, that is rakes precedent before `NEXT_PUBLIC_PLAYER_PARSER_URL`, since it may be required" This reverts commit a3f1457721b5d25bfd062edca41dcc2a41efe815. --- app/components/ReleasePlayer/PlayerParsing.ts | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/app/components/ReleasePlayer/PlayerParsing.ts b/app/components/ReleasePlayer/PlayerParsing.ts index abee0b8..c5cf87b 100644 --- a/app/components/ReleasePlayer/PlayerParsing.ts +++ b/app/components/ReleasePlayer/PlayerParsing.ts @@ -1,5 +1,5 @@ import { tryCatchPlayer, tryCatchAPI } from "#/api/utils"; -import { env } from "next-runtime-env"; +import { env } from 'next-runtime-env'; export async function _fetchAPI( url: string, @@ -62,11 +62,12 @@ export async function _fetchPlayer( return data; } + export const _fetchKodikManifest = async ( url: string, setPlayerError: (state) => void ) => { - const NEXT_PUBLIC_PLAYER_PARSER_URL = env("NEXT_PUBLIC_PLAYER_PARSER_URL"); + const NEXT_PUBLIC_PLAYER_PARSER_URL = env("NEXT_PUBLIC_PLAYER_PARSER_URL") if (!NEXT_PUBLIC_PLAYER_PARSER_URL) { setPlayerError({ message: "Плеер не настроен", @@ -81,15 +82,15 @@ export const _fetchKodikManifest = async ( ); if (data) { - let manifest: string = data.manifest; - if (!manifest.startsWith("http")) { - let file = new File([manifest], "manifest.m3u8", { - type: "application/x-mpegURL", - }); - manifest = URL.createObjectURL(file); + let manifest: string = data.manifest + if (!manifest.startsWith("http")) { + let file = new File([manifest], "manifest.m3u8", { + type: "application/x-mpegURL", + }); + manifest = URL.createObjectURL(file); + } + return { manifest, poster: data.poster }; } - return { manifest, poster: data.poster }; - } return { manifest: null, poster: null }; }; @@ -97,9 +98,8 @@ export const _fetchAnilibriaManifest = async ( url: string, setPlayerError: (state) => void ) => { - const NEXT_PUBLIC_LIBRIA_PARSER_URL = env("NEXT_PUBLIC_LIBRIA_PARSER_URL") || null; - const NEXT_PUBLIC_PLAYER_PARSER_URL = env("NEXT_PUBLIC_PLAYER_PARSER_URL") || null; - if (!NEXT_PUBLIC_LIBRIA_PARSER_URL && !NEXT_PUBLIC_PLAYER_PARSER_URL) { + const NEXT_PUBLIC_PLAYER_PARSER_URL = env("NEXT_PUBLIC_PLAYER_PARSER_URL") + if (!NEXT_PUBLIC_PLAYER_PARSER_URL) { setPlayerError({ message: "Плеер не настроен", detail: "переменная 'NEXT_PUBLIC_PLAYER_PARSER_URL' не обнаружена", @@ -108,7 +108,7 @@ export const _fetchAnilibriaManifest = async ( } const data = await _fetchPlayer( - `${NEXT_PUBLIC_LIBRIA_PARSER_URL || NEXT_PUBLIC_PLAYER_PARSER_URL}/?url=${encodeURIComponent(url)}&player=libria`, + `${NEXT_PUBLIC_PLAYER_PARSER_URL}/?url=${encodeURIComponent(url)}&player=libria`, setPlayerError ); @@ -126,7 +126,7 @@ export const _fetchSibnetManifest = async ( url: string, setPlayerError: (state) => void ) => { - const NEXT_PUBLIC_PLAYER_PARSER_URL = env("NEXT_PUBLIC_PLAYER_PARSER_URL"); + const NEXT_PUBLIC_PLAYER_PARSER_URL = env("NEXT_PUBLIC_PLAYER_PARSER_URL") if (!NEXT_PUBLIC_PLAYER_PARSER_URL) { setPlayerError({ message: "Плеер не настроен",