mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-29 16:07:40 +01:00
Fix next episode stuff! and add another proxy
This commit is contained in:
parent
49f3bb297f
commit
a63bb88a25
3 changed files with 17 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
||||||
window.__CONFIG__ = {
|
window.__CONFIG__ = {
|
||||||
// The URL for the CORS proxy, the URL must NOT end with a slash!
|
// The URL for the CORS proxy, the URL must NOT end with a slash!
|
||||||
VITE_CORS_PROXY_URL: "https://sudo-proxy0.netlify.app,https://sudo-proxy1.up.railway.app,https://sudo-proxy2.up.railway.app,https://sudo-proxy3.up.railway.app",
|
VITE_CORS_PROXY_URL: "https://sudo-proxy0.netlify.app,https://sudo-proxy1.up.railway.app,https://sudo-proxy2.up.railway.app,https://sudo-proxy3.up.railway.app,https://sudo-proxy4.netlify.app",
|
||||||
|
|
||||||
// The READ API key to access TMDB
|
// The READ API key to access TMDB
|
||||||
VITE_TMDB_READ_API_KEY: "eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJhZTljNGE2ZDE1ZDFiODZiNzdlMWQyYmI5ZGY0MzdmYyIsInN1YiI6IjY1YjNmMWI0NTk0Yzk0MDE2MzNkZDBjNSIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.kAX7TkbKuJkNty6IsjcCLnoENFicVZn6d6DkLQsy3p8",
|
VITE_TMDB_READ_API_KEY: "eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJhZTljNGE2ZDE1ZDFiODZiNzdlMWQyYmI5ZGY0MzdmYyIsInN1YiI6IjY1YjNmMWI0NTk0Yzk0MDE2MzNkZDBjNSIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.kAX7TkbKuJkNty6IsjcCLnoENFicVZn6d6DkLQsy3p8",
|
||||||
|
|
|
@ -388,8 +388,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nextEpisode": {
|
"nextEpisode": {
|
||||||
"cancel": "Cancel",
|
"replay": "Replay",
|
||||||
"next": "Next episode!"
|
"next": "Next episode"
|
||||||
},
|
},
|
||||||
"playbackError": {
|
"playbackError": {
|
||||||
"badge": "Playback error",
|
"badge": "Playback error",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { useCallback } from "react";
|
import React, { useCallback } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
import { Icon, Icons } from "@/components/Icon";
|
import { Icon, Icons } from "@/components/Icon";
|
||||||
|
@ -15,7 +15,7 @@ function shouldShowNextEpisodeButton(
|
||||||
const percentage = time / duration;
|
const percentage = time / duration;
|
||||||
const secondsFromEnd = duration - time;
|
const secondsFromEnd = duration - time;
|
||||||
if (secondsFromEnd <= 30) return "always";
|
if (secondsFromEnd <= 30) return "always";
|
||||||
if (percentage >= 0.9) return "hover";
|
if (percentage >= 0.93) return "hover";
|
||||||
return "none";
|
return "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +81,15 @@ export function NextEpisodeButton(props: {
|
||||||
props.onChange?.(metaCopy);
|
props.onChange?.(metaCopy);
|
||||||
}, [setDirectMeta, nextEp, meta, props, setShouldStartFromBeginning]);
|
}, [setDirectMeta, nextEp, meta, props, setShouldStartFromBeginning]);
|
||||||
|
|
||||||
|
const startCurrentEpisodeFromBeginning = useCallback(() => {
|
||||||
|
if (!meta || !meta.episode) return;
|
||||||
|
const metaCopy = { ...meta };
|
||||||
|
// No need to change the episode, as we're restarting the current one
|
||||||
|
setShouldStartFromBeginning(true);
|
||||||
|
setDirectMeta(metaCopy);
|
||||||
|
props.onChange?.(metaCopy);
|
||||||
|
}, [setDirectMeta, meta, props, setShouldStartFromBeginning]);
|
||||||
|
|
||||||
if (!meta?.episode || !nextEp) return null;
|
if (!meta?.episode || !nextEp) return null;
|
||||||
if (metaType !== "show") return null;
|
if (metaType !== "show") return null;
|
||||||
|
|
||||||
|
@ -97,10 +106,10 @@ export function NextEpisodeButton(props: {
|
||||||
])}
|
])}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
className="py-px box-content bg-buttons-secondary hover:bg-buttons-secondaryHover bg-opacity-90 text-buttons-secondaryText"
|
className="py-px box-content bg-buttons-secondary hover:bg-buttons-secondaryHover bg-opacity-90 text-buttons-secondaryText justify-center items-center"
|
||||||
onClick={hideNextEpisodeButton}
|
onClick={() => startCurrentEpisodeFromBeginning()}
|
||||||
>
|
>
|
||||||
{t("player.nextEpisode.cancel")}
|
{t("player.nextEpisode.replay")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => loadNextEpisode()}
|
onClick={() => loadNextEpisode()}
|
||||||
|
|
Loading…
Reference in a new issue