mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-29 16:07:40 +01:00
pwa fix and dont remove t param after use
This commit is contained in:
parent
92bca33b91
commit
df5735cfbf
5 changed files with 17 additions and 12 deletions
|
@ -109,7 +109,9 @@ function EpisodesView({
|
|||
const newData = setPlayerMeta(loadingState.value.fullData, episodeId);
|
||||
if (newData) onChange?.(newData);
|
||||
}
|
||||
router.close();
|
||||
// prevent router clear here, otherwise its done double
|
||||
// player already switches route after meta change
|
||||
router.close(true);
|
||||
},
|
||||
[setPlayerMeta, loadingState, router, onChange]
|
||||
);
|
||||
|
|
|
@ -91,10 +91,13 @@ export function useInternalOverlayRouter(id: string) {
|
|||
return routerActive;
|
||||
}
|
||||
|
||||
const close = useCallback(() => {
|
||||
if (route) setRoute(null);
|
||||
setTransition(null);
|
||||
}, [setRoute, route, setTransition]);
|
||||
const close = useCallback(
|
||||
(preventRouteClear?: boolean) => {
|
||||
if (route && !preventRouteClear) setRoute(null);
|
||||
setTransition(null);
|
||||
},
|
||||
[setRoute, route, setTransition]
|
||||
);
|
||||
|
||||
const open = useCallback(
|
||||
(defaultRoute = "/") => {
|
||||
|
|
|
@ -32,7 +32,7 @@ export function useQueryParam(
|
|||
search: parsed.toString(),
|
||||
});
|
||||
},
|
||||
[param, location, router]
|
||||
[param, location.search, router]
|
||||
);
|
||||
|
||||
return [currentValue, set];
|
||||
|
|
|
@ -26,7 +26,7 @@ export function PlayerView() {
|
|||
sources: Record<string, ScrapingSegment>;
|
||||
sourceOrder: ScrapingItems[];
|
||||
} | null>(null);
|
||||
const [startAtParam, setStartAtParam] = useQueryParam("t");
|
||||
const [startAtParam] = useQueryParam("t");
|
||||
const { status, playMedia, reset, setScrapeNotFound } = usePlayer();
|
||||
const { setPlayerMeta, scrapeMedia } = usePlayerMeta();
|
||||
const backUrl = useLastNonPlayerLink();
|
||||
|
@ -54,14 +54,13 @@ export function PlayerView() {
|
|||
const playAfterScrape = useCallback(
|
||||
(out: RunOutput | null) => {
|
||||
if (!out) return;
|
||||
|
||||
let startAt: number | undefined;
|
||||
if (startAtParam) {
|
||||
setStartAtParam(null);
|
||||
startAt = parseTimestamp(startAtParam) ?? undefined;
|
||||
}
|
||||
if (startAtParam) startAt = parseTimestamp(startAtParam) ?? undefined;
|
||||
|
||||
playMedia(convertRunoutputToSource(out), out.sourceId, startAt);
|
||||
},
|
||||
[playMedia, setStartAtParam, startAtParam]
|
||||
[playMedia, startAtParam]
|
||||
);
|
||||
|
||||
return (
|
||||
|
|
|
@ -54,6 +54,7 @@ export default defineConfig(({ mode }) => {
|
|||
theme_color: "#120f1d",
|
||||
background_color: "#120f1d",
|
||||
display: "standalone",
|
||||
orientation: "portrait-primary",
|
||||
start_url: "/",
|
||||
icons: [
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue