From 5fdc96db64c17b5c0a3647997fbb7efe853cd429 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Fri, 24 Oct 2025 16:15:31 +0200 Subject: [PATCH] Format stuff --- api/src/controllers/videos.ts | 2 +- api/src/models/utils/sort.ts | 2 +- front/Dockerfile | 1 + front/src/models/video-info.ts | 2 +- front/src/primitives/skeleton.tsx | 5 +-- front/src/primitives/slider.tsx | 8 ++-- front/src/primitives/utils/breakpoint.ts | 2 +- front/src/ui/details/header.tsx | 4 +- front/src/ui/player/keyboard.tsx | 4 +- front/src/ui/player/old/scrubber.tsx | 41 ++++++++++++++----- .../ui/player/old/watch-status-observer.tsx | 2 +- 11 files changed, 47 insertions(+), 26 deletions(-) diff --git a/api/src/controllers/videos.ts b/api/src/controllers/videos.ts index e1b31b58..2409ed2e 100644 --- a/api/src/controllers/videos.ts +++ b/api/src/controllers/videos.ts @@ -663,7 +663,7 @@ export const videosH = new Elysia({ prefix: "/videos", tags: ["videos"] }) }); } const path = Buffer.from(video.path, "utf8").toString("base64url"); - const query = request.url.substring(request.url.indexOf("?")) + const query = request.url.substring(request.url.indexOf("?")); return redirect(`/video/${path}/master.m3u8${query}`); }, { diff --git a/api/src/models/utils/sort.ts b/api/src/models/utils/sort.ts index cd3a053c..0ac18e78 100644 --- a/api/src/models/utils/sort.ts +++ b/api/src/models/utils/sort.ts @@ -58,7 +58,7 @@ export const Sort = ( const random = sort.find((x) => x.startsWith("random")); if (random) { const seed = random.includes(":") - ? Number.parseInt(random.substring("random:".length)) + ? Number.parseInt(random.substring("random:".length), 10) : Math.floor(Math.random() * Number.MAX_SAFE_INTEGER); return { tablePk, random: { seed }, sort: [] }; } diff --git a/front/Dockerfile b/front/Dockerfile index 180a0f84..f9590287 100644 --- a/front/Dockerfile +++ b/front/Dockerfile @@ -2,6 +2,7 @@ FROM oven/bun AS builder WORKDIR /app COPY package.json bun.lock scripts . +COPY scripts scripts RUN bun install --production --frozen-lockfile COPY . . diff --git a/front/src/models/video-info.ts b/front/src/models/video-info.ts index f6970e90..29933822 100644 --- a/front/src/models/video-info.ts +++ b/front/src/models/video-info.ts @@ -101,7 +101,7 @@ export type VideoInfo = z.infer; const humanFileSize = (size: number): string => { const i = size === 0 ? 0 : Math.floor(Math.log(size) / Math.log(1024)); return ( - // @ts-ignore I'm not gonna fix stackoverflow's working code. + // @ts-expect-error I'm not gonna fix stackoverflow's working code. // biome-ignore lint/style/useTemplate: same as above (size / 1024 ** i).toFixed(2) * 1 + " " + ["B", "kB", "MB", "GB", "TB"][i] ); diff --git a/front/src/primitives/skeleton.tsx b/front/src/primitives/skeleton.tsx index 4d798467..7546f87b 100644 --- a/front/src/primitives/skeleton.tsx +++ b/front/src/primitives/skeleton.tsx @@ -106,10 +106,7 @@ export const Skeleton = ({ start={{ x: 0, y: 0.5 }} end={{ x: 1, y: 0.5 }} colors={["transparent", theme.overlay1, "transparent"]} - style={[ - StyleSheet.absoluteFillObject, - animated, - ]} + style={[StyleSheet.absoluteFillObject, animated]} /> ))} diff --git a/front/src/primitives/slider.tsx b/front/src/primitives/slider.tsx index 0b6c864a..2455a172 100644 --- a/front/src/primitives/slider.tsx +++ b/front/src/primitives/slider.tsx @@ -55,14 +55,14 @@ export const Slider = ({ return ( setHover(true)} - // @ts-ignore Web only + // @ts-expect-error Web only onMouseLeave={() => { setHover(false); onHover?.(null, layout); }} - // @ts-ignore Web only + // @ts-expect-error Web only onMouseMove={(e) => onHover?.( Math.max(0, Math.min((e.clientX - layout.x) / layout.width, 1) * max), @@ -107,7 +107,7 @@ export const Slider = ({ {...css( { paddingVertical: ts(1), - // @ts-ignore Web only + // @ts-expect-error Web only cursor: "pointer", ...focusReset, }, diff --git a/front/src/primitives/utils/breakpoint.ts b/front/src/primitives/utils/breakpoint.ts index 50180402..70737333 100644 --- a/front/src/primitives/utils/breakpoint.ts +++ b/front/src/primitives/utils/breakpoint.ts @@ -39,7 +39,7 @@ export const useBreakpointMap = >( value: T, ): { [key in keyof T]: T[key] extends Breakpoint ? V : T } => { const breakpoint = useBreakpoint(); - // @ts-ignore + // @ts-expect-error return Object.fromEntries( Object.entries(value).map(([key, val]) => [ key, diff --git a/front/src/ui/details/header.tsx b/front/src/ui/details/header.tsx index 584d0fb5..3685e02a 100644 --- a/front/src/ui/details/header.tsx +++ b/front/src/ui/details/header.tsx @@ -729,7 +729,9 @@ export const Header = ({ playHref={data.kind !== "collection" ? data.playHref : null} trailerUrl={data.kind !== "collection" ? data.trailerUrl : null} watchStatus={ - data.kind !== "collection" ? data.watchStatus?.status! : null + data.kind !== "collection" + ? (data.watchStatus?.status ?? null) + : null } {...css({ marginTop: { diff --git a/front/src/ui/player/keyboard.tsx b/front/src/ui/player/keyboard.tsx index 4cd8891c..3b3e4325 100644 --- a/front/src/ui/player/keyboard.tsx +++ b/front/src/ui/player/keyboard.tsx @@ -95,10 +95,10 @@ export const useKeyboard = ( break; case "ArrowUp": - reducer(player, { type: "volume", value: +.05 }); + reducer(player, { type: "volume", value: +0.05 }); break; case "ArrowDown": - reducer(player, { type: "volume", value: -.05 }); + reducer(player, { type: "volume", value: -0.05 }); break; case "f": diff --git a/front/src/ui/player/old/scrubber.tsx b/front/src/ui/player/old/scrubber.tsx index 8cdb374e..7326d06f 100644 --- a/front/src/ui/player/old/scrubber.tsx +++ b/front/src/ui/player/old/scrubber.tsx @@ -18,16 +18,27 @@ * along with Kyoo. If not, see . */ -import { type Chapter, type QueryIdentifier, imageFn, useFetch } from "@kyoo/models"; -import { P, Sprite, imageBorderRadius, ts } from "@kyoo/primitives"; +import { + type Chapter, + imageFn, + type QueryIdentifier, + useFetch, +} from "@kyoo/models"; +import { imageBorderRadius, P, Sprite, ts } from "@kyoo/primitives"; import { useAtomValue } from "jotai"; import { useMemo } from "react"; import { Platform, View } from "react-native"; -import { type Theme, percent, px, useForceRerender, useYoshiki } from "yoshiki/native"; +import { + percent, + px, + type Theme, + useForceRerender, + useYoshiki, +} from "yoshiki/native"; import { ErrorView } from "../../errors"; -import { durationAtom } from "./state"; import { seekProgressAtom } from "../controls"; import { toTimerString } from "../controls/left-buttonsttons"; +import { durationAtom } from "./state"; type Thumb = { from: number; @@ -42,8 +53,8 @@ type Thumb = { const parseTs = (time: string) => { const times = time.split(":"); return ( - (Number.parseInt(times[0]) * 3600 + - Number.parseInt(times[1]) * 60 + + (Number.parseInt(times[0], 10) * 3600 + + Number.parseInt(times[1], 10) * 60 + Number.parseFloat(times[2])) * 1000 ); @@ -69,7 +80,7 @@ export const useScrubber = (url: string) => { for (let i = 0; i < ret.length; i++) { const times = lines[i * 2].split(" --> "); const url = lines[i * 2 + 1].split("#xywh="); - const xywh = url[1].split(",").map((x) => Number.parseInt(x)); + const xywh = url[1].split(",").map((x) => Number.parseInt(x, 10)); ret[i] = { from: parseTs(times[0]), to: parseTs(times[1]), @@ -123,7 +134,9 @@ export const ScrubberTooltip = ({ const current = info.findLast((x) => x.from <= seconds * 1000 && seconds * 1000 < x.to) ?? info.findLast(() => true); - const chapter = chapters?.findLast((x) => x.startTime <= seconds && seconds < x.endTime); + const chapter = chapters?.findLast( + (x) => x.startTime <= seconds && seconds < x.endTime, + ); return ( { +export const BottomScrubber = ({ + url, + chapters, +}: { + url: string; + chapters?: Chapter[]; +}) => { const { css } = useYoshiki(); const { info, error, stats } = useScrubber(url); const rerender = useForceRerender(); @@ -164,7 +183,9 @@ export const BottomScrubber = ({ url, chapters }: { url: string; chapters?: Chap if (error) return ; const width = stats?.width ?? 1; - const chapter = chapters?.findLast((x) => x.startTime <= progress && progress < x.endTime); + const chapter = chapters?.findLast( + (x) => x.startTime <= progress && progress < x.endTime, + ); return ( . */ -import { type MutationParam, WatchStatusV, useAccount } from "@kyoo/models"; +import { type MutationParam, useAccount, WatchStatusV } from "@kyoo/models"; import { useMutation } from "@tanstack/react-query"; import { useAtomValue } from "jotai"; import { useAtomCallback } from "jotai/utils";