mirror of
https://github.com/p-stream/p-stream.git
synced 2026-05-12 15:20:58 +00:00
Merge branch 'p-stream:production' into substranslate
This commit is contained in:
commit
6b276d32fe
4 changed files with 31 additions and 24 deletions
|
|
@ -1147,7 +1147,8 @@
|
||||||
"link": "Migrate my data"
|
"link": "Migrate my data"
|
||||||
},
|
},
|
||||||
"documentation": "Backend documentation",
|
"documentation": "Backend documentation",
|
||||||
"error": "Error connecting to backend"
|
"error": "Error connecting to backend",
|
||||||
|
"notice": "Your account does NOT sync between backends, so remember which one you use!"
|
||||||
},
|
},
|
||||||
"setup": {
|
"setup": {
|
||||||
"doSetup": "Do setup",
|
"doSetup": "Do setup",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { useEffect, useState } from "react";
|
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 { usePlayerMeta } from "@/components/player/hooks/usePlayerMeta";
|
||||||
import { conf } from "@/setup/config";
|
import { conf } from "@/setup/config";
|
||||||
import { usePreferencesStore } from "@/stores/preferences";
|
import { usePreferencesStore } from "@/stores/preferences";
|
||||||
|
|
@ -8,7 +8,7 @@ import { getTurnstileToken } from "@/utils/turnstile";
|
||||||
|
|
||||||
// Thanks Nemo for this API
|
// Thanks Nemo for this API
|
||||||
const FED_SKIPS_BASE_URL = "https://fed-skips.pstream.mov";
|
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;
|
const MAX_RETRIES = 3;
|
||||||
|
|
||||||
export function useSkipTime() {
|
export function useSkipTime() {
|
||||||
|
|
@ -17,26 +17,26 @@ export function useSkipTime() {
|
||||||
const febboxKey = usePreferencesStore((s) => s.febboxKey);
|
const febboxKey = usePreferencesStore((s) => s.febboxKey);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchVeloraSkipTime = async (): Promise<number | null> => {
|
// const fetchVeloraSkipTime = async (): Promise<number | null> => {
|
||||||
if (!meta?.tmdbId) return null;
|
// if (!meta?.tmdbId) return null;
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
let apiUrl = `${VELORA_BASE_URL}?tmdbId=${meta.tmdbId}`;
|
// let apiUrl = `${VELORA_BASE_URL}?tmdbId=${meta.tmdbId}`;
|
||||||
if (meta.type !== "movie") {
|
// if (meta.type !== "movie") {
|
||||||
apiUrl += `&season=${meta.season?.number}&episode=${meta.episode?.number}`;
|
// apiUrl += `&season=${meta.season?.number}&episode=${meta.episode?.number}`;
|
||||||
}
|
// }
|
||||||
const data = await proxiedFetch(apiUrl);
|
// const data = await proxiedFetch(apiUrl);
|
||||||
|
|
||||||
if (data.introSkippable && typeof data.introEnd === "number") {
|
// if (data.introSkippable && typeof data.introEnd === "number") {
|
||||||
return data.introEnd;
|
// return data.introEnd;
|
||||||
}
|
// }
|
||||||
|
|
||||||
return null;
|
// return null;
|
||||||
} catch (error) {
|
// } catch (error) {
|
||||||
console.error("Error fetching velora skip time:", error);
|
// console.error("Error fetching velora skip time:", error);
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
const fetchFedSkipsTime = async (retries = 0): Promise<number | null> => {
|
const fetchFedSkipsTime = async (retries = 0): Promise<number | null> => {
|
||||||
if (!meta?.imdbId || meta.type === "movie") return null;
|
if (!meta?.imdbId || meta.type === "movie") return null;
|
||||||
|
|
@ -88,13 +88,13 @@ export function useSkipTime() {
|
||||||
const fedSkipsTime = await fetchFedSkipsTime();
|
const fedSkipsTime = await fetchFedSkipsTime();
|
||||||
if (fedSkipsTime !== null) {
|
if (fedSkipsTime !== null) {
|
||||||
setSkiptime(fedSkipsTime);
|
setSkiptime(fedSkipsTime);
|
||||||
return;
|
// return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fall back to Velora API (available to all users)
|
// // Fall back to Velora API (available to all users)
|
||||||
const veloraSkipTime = await fetchVeloraSkipTime();
|
// const veloraSkipTime = await fetchVeloraSkipTime();
|
||||||
setSkiptime(veloraSkipTime);
|
// setSkiptime(veloraSkipTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
fetchSkipTime();
|
fetchSkipTime();
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,9 @@ export function LoginPage() {
|
||||||
showCustom
|
showCustom
|
||||||
/>
|
/>
|
||||||
<LargeCardButtons>
|
<LargeCardButtons>
|
||||||
|
<span className="text-type-danger font-medium text-center">
|
||||||
|
{t("settings.connections.server.notice")}
|
||||||
|
</span>
|
||||||
<Button
|
<Button
|
||||||
theme="purple"
|
theme="purple"
|
||||||
onClick={handleContinue}
|
onClick={handleContinue}
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,9 @@ export function RegisterPage() {
|
||||||
showCustom
|
showCustom
|
||||||
/>
|
/>
|
||||||
<LargeCardButtons>
|
<LargeCardButtons>
|
||||||
|
<span className="text-type-danger font-medium text-center">
|
||||||
|
{t("settings.connections.server.notice")}
|
||||||
|
</span>
|
||||||
<Button
|
<Button
|
||||||
theme="purple"
|
theme="purple"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue