mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-11-01 19:17:16 -04:00
Format stuff
This commit is contained in:
parent
9206a30182
commit
5fdc96db64
@ -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}`);
|
||||
},
|
||||
{
|
||||
|
||||
@ -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: [] };
|
||||
}
|
||||
|
||||
@ -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 . .
|
||||
|
||||
@ -101,7 +101,7 @@ export type VideoInfo = z.infer<typeof VideoInfo>;
|
||||
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]
|
||||
);
|
||||
|
||||
@ -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]}
|
||||
/>
|
||||
</View>
|
||||
))}
|
||||
|
||||
@ -55,14 +55,14 @@ export const Slider = ({
|
||||
return (
|
||||
<View
|
||||
ref={ref}
|
||||
// @ts-ignore Web only
|
||||
// @ts-expect-error Web only
|
||||
onMouseEnter={() => 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,
|
||||
},
|
||||
|
||||
@ -39,7 +39,7 @@ export const useBreakpointMap = <T extends Record<string, unknown>>(
|
||||
value: T,
|
||||
): { [key in keyof T]: T[key] extends Breakpoint<infer V> ? V : T } => {
|
||||
const breakpoint = useBreakpoint();
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
return Object.fromEntries(
|
||||
Object.entries(value).map(([key, val]) => [
|
||||
key,
|
||||
|
||||
@ -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: {
|
||||
|
||||
@ -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":
|
||||
|
||||
@ -18,16 +18,27 @@
|
||||
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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 (
|
||||
<View
|
||||
@ -153,7 +166,13 @@ export const ScrubberTooltip = ({
|
||||
};
|
||||
let scrubberWidth = 0;
|
||||
|
||||
export const BottomScrubber = ({ url, chapters }: { url: string; chapters?: Chapter[] }) => {
|
||||
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 <ErrorView error={error} />;
|
||||
|
||||
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 (
|
||||
<View {...css({ overflow: "hidden" })}>
|
||||
<View
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user