mirror of
https://github.com/p-stream/p-stream.git
synced 2026-01-11 20:10:32 +00:00
disable velora skips
This commit is contained in:
parent
694b127165
commit
70d226af70
1 changed files with 23 additions and 23 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { useEffect, useState } from "react";
|
||||
|
||||
import { proxiedFetch } from "@/backend/helpers/fetch";
|
||||
// import { proxiedFetch } from "@/backend/helpers/fetch";
|
||||
import { usePlayerMeta } from "@/components/player/hooks/usePlayerMeta";
|
||||
import { conf } from "@/setup/config";
|
||||
import { usePreferencesStore } from "@/stores/preferences";
|
||||
|
|
@ -8,7 +8,7 @@ import { getTurnstileToken } from "@/utils/turnstile";
|
|||
|
||||
// Thanks Nemo for this API
|
||||
const FED_SKIPS_BASE_URL = "https://fed-skips.pstream.mov";
|
||||
const VELORA_BASE_URL = "https://veloratv.ru/api/intro-end/confirmed";
|
||||
// const VELORA_BASE_URL = "https://veloratv.ru/api/intro-end/confirmed";
|
||||
const MAX_RETRIES = 3;
|
||||
|
||||
export function useSkipTime() {
|
||||
|
|
@ -17,26 +17,26 @@ export function useSkipTime() {
|
|||
const febboxKey = usePreferencesStore((s) => s.febboxKey);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchVeloraSkipTime = async (): Promise<number | null> => {
|
||||
if (!meta?.tmdbId) return null;
|
||||
// const fetchVeloraSkipTime = async (): Promise<number | null> => {
|
||||
// if (!meta?.tmdbId) return null;
|
||||
|
||||
try {
|
||||
let apiUrl = `${VELORA_BASE_URL}?tmdbId=${meta.tmdbId}`;
|
||||
if (meta.type !== "movie") {
|
||||
apiUrl += `&season=${meta.season?.number}&episode=${meta.episode?.number}`;
|
||||
}
|
||||
const data = await proxiedFetch(apiUrl);
|
||||
// try {
|
||||
// let apiUrl = `${VELORA_BASE_URL}?tmdbId=${meta.tmdbId}`;
|
||||
// if (meta.type !== "movie") {
|
||||
// apiUrl += `&season=${meta.season?.number}&episode=${meta.episode?.number}`;
|
||||
// }
|
||||
// const data = await proxiedFetch(apiUrl);
|
||||
|
||||
if (data.introSkippable && typeof data.introEnd === "number") {
|
||||
return data.introEnd;
|
||||
}
|
||||
// if (data.introSkippable && typeof data.introEnd === "number") {
|
||||
// return data.introEnd;
|
||||
// }
|
||||
|
||||
return null;
|
||||
} catch (error) {
|
||||
console.error("Error fetching velora skip time:", error);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
// return null;
|
||||
// } catch (error) {
|
||||
// console.error("Error fetching velora skip time:", error);
|
||||
// return null;
|
||||
// }
|
||||
// };
|
||||
|
||||
const fetchFedSkipsTime = async (retries = 0): Promise<number | null> => {
|
||||
if (!meta?.imdbId || meta.type === "movie") return null;
|
||||
|
|
@ -88,13 +88,13 @@ export function useSkipTime() {
|
|||
const fedSkipsTime = await fetchFedSkipsTime();
|
||||
if (fedSkipsTime !== null) {
|
||||
setSkiptime(fedSkipsTime);
|
||||
return;
|
||||
// return;
|
||||
}
|
||||
}
|
||||
|
||||
// Fall back to Velora API (available to all users)
|
||||
const veloraSkipTime = await fetchVeloraSkipTime();
|
||||
setSkiptime(veloraSkipTime);
|
||||
// // Fall back to Velora API (available to all users)
|
||||
// const veloraSkipTime = await fetchVeloraSkipTime();
|
||||
// setSkiptime(veloraSkipTime);
|
||||
};
|
||||
|
||||
fetchSkipTime();
|
||||
|
|
|
|||
Loading…
Reference in a new issue