diff --git a/Blink-arm64-release.apk b/Blink-arm64-release.apk
new file mode 100644
index 0000000..0f5a34d
Binary files /dev/null and b/Blink-arm64-release.apk differ
diff --git a/src/components/albumMusicTrack/albumMusicTrack.scss b/src/components/albumMusicTrack/albumMusicTrack.scss
index d2dafaf..0718f9d 100644
--- a/src/components/albumMusicTrack/albumMusicTrack.scss
+++ b/src/components/albumMusicTrack/albumMusicTrack.scss
@@ -1,6 +1,6 @@
.album-track {
display: grid;
- grid-template-columns: 2.4em minmax(0, 1fr) 4.5em 2.6em;
+ grid-template-columns: 2.4em minmax(0, 1fr) 4.5em auto;
gap: 1em;
align-items: center;
padding: 0.5em 1em;
@@ -69,7 +69,9 @@
&-like {
display: flex;
- justify-content: center;
+ align-items: center;
+ justify-content: flex-end;
+ gap: 0.1em;
opacity: 0;
transition: opacity $transition-time-fast;
diff --git a/src/components/albumMusicTrack/index.tsx b/src/components/albumMusicTrack/index.tsx
index 8a92031..423a105 100644
--- a/src/components/albumMusicTrack/index.tsx
+++ b/src/components/albumMusicTrack/index.tsx
@@ -2,19 +2,20 @@ import type {
BaseItemDto,
BaseItemDtoQueryResult,
} from "@jellyfin/sdk/lib/generated-client";
-import React from "react";
import { useSnackbar } from "notistack";
-import lyricsIcon from "../../assets/icons/lyrics.svg";
+import React from "react";
import { getRuntimeMusic } from "@/utils/date/time";
+import { useApiInContext } from "@/utils/store/api";
import {
generateAudioStreamUrl,
playAudio,
useAudioPlayback,
} from "@/utils/store/audioPlayback";
-import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import { setQueue } from "@/utils/store/queue";
+import lyricsIcon from "../../assets/icons/lyrics.svg";
import LikeButton from "../buttons/likeButton";
+import RatingControl from "../buttons/ratingControl";
import "./albumMusicTrack.scss";
@@ -25,10 +26,17 @@ type AlbumMusicTrackProps = {
*/
trackIndex: number;
musicTracks: BaseItemDtoQueryResult | null;
+ /** Query key of the list this track belongs to, refreshed after a rating change. */
+ queryKey?: string[];
};
export default function AlbumMusicTrack(props: AlbumMusicTrackProps) {
- const { track, musicTracks, trackIndex } = props;
+ const {
+ track,
+ musicTracks,
+ trackIndex,
+ queryKey = ["item", "musicTracks"],
+ } = props;
const [currentPlayingItem] = useAudioPlayback((state) => [state.item]);
const user = useCentralStore((state) => state.currentUser);
@@ -88,17 +96,13 @@ export default function AlbumMusicTrack(props: AlbumMusicTrackProps) {
play_arrow
-
- {track.IndexNumber ?? "–"}
-
+ {track.IndexNumber ?? "–"}
{track.Name}
{(artists.length > 0 || track.HasLyrics) && (
- {track.HasLyrics && (
-
- )}
+ {track.HasLyrics &&
}
{artists.join(", ")}
)}
@@ -107,10 +111,18 @@ export default function AlbumMusicTrack(props: AlbumMusicTrackProps) {
{getRuntimeMusic(track.RunTimeTicks ?? 0)}
e.stopPropagation()}>
+
diff --git a/src/components/appStatus/appStatus.scss b/src/components/appStatus/appStatus.scss
new file mode 100644
index 0000000..e22b947
--- /dev/null
+++ b/src/components/appStatus/appStatus.scss
@@ -0,0 +1,117 @@
+/* Titlebar status: a tiny spinner that resolves into check / warning. */
+.app-status {
+ --status-accent: rgb(255 255 255 / 0.8);
+
+ position: relative;
+ display: grid;
+ place-items: center;
+ width: 2.35rem;
+ height: 2.35rem;
+ flex: 0 0 auto;
+ border-radius: 50%;
+ color: var(--status-accent);
+ opacity: 0;
+ transform: scale(0.92);
+ pointer-events: none;
+ transition:
+ opacity 0.18s ease,
+ transform 0.18s ease,
+ background-color 0.15s ease,
+ color 0.18s ease;
+}
+
+.app-status--loading,
+.app-status--success,
+.app-status--warning,
+.app-status--error,
+.app-status--info {
+ opacity: 1;
+ transform: scale(1);
+ pointer-events: auto;
+}
+
+/* Same hover language as the other titlebar icon buttons. */
+.app-status--loading:hover,
+.app-status--success:hover,
+.app-status--warning:hover,
+.app-status--error:hover,
+.app-status--info:hover {
+ background: rgb(255 255 255 / 0.1);
+}
+
+.app-status--loading {
+ --status-accent: rgb(255 255 255 / 0.8);
+}
+
+.app-status--success {
+ --status-accent: #65e6a3;
+}
+
+.app-status--warning {
+ --status-accent: #ffc46b;
+}
+
+.app-status--error {
+ --status-accent: #ff8a7a;
+}
+
+.app-status--info {
+ --status-accent: #8fd0ff;
+}
+
+.app-status__icon {
+ display: grid;
+ place-items: center;
+ width: 100%;
+ height: 100%;
+
+ .material-symbols-rounded {
+ font-size: 1.35rem;
+ }
+}
+
+.app-status__spinner {
+ width: 1.05rem;
+ height: 1.05rem;
+ border: 2px solid currentColor;
+ border-right-color: transparent;
+ border-radius: 50%;
+ animation: app-status-spin 0.8s linear infinite;
+}
+
+@keyframes app-status-spin {
+ to {
+ transform: rotate(360deg);
+ }
+}
+
+/* On auth screens the titlebar is hidden; keep the same feedback as a plain
+ icon next to the window controls, without a separate badge around it. */
+.app-status--floating {
+ position: fixed;
+ top: calc(10px + var(--safe-top));
+ right: calc(150px + var(--safe-right, 0px));
+ z-index: 1002;
+ filter: drop-shadow(0 2px 6px rgb(0 0 0 / 0.5));
+}
+
+html.is-android .app-status--floating {
+ right: 12px;
+}
+
+@media (max-width: 900px) {
+ .app-status {
+ width: 2.15rem;
+ height: 2.15rem;
+ }
+
+ .app-status--floating {
+ top: calc(8px + var(--safe-top));
+ right: 12px;
+ }
+}
+
+/* Notifications are rendered as the titlebar status instead of toasts. */
+.notistack-SnackbarContainer {
+ display: none !important;
+}
diff --git a/src/components/appStatus/index.tsx b/src/components/appStatus/index.tsx
new file mode 100644
index 0000000..4266233
--- /dev/null
+++ b/src/components/appStatus/index.tsx
@@ -0,0 +1,77 @@
+import { Tooltip } from "@mui/material";
+import { useLocation } from "@tanstack/react-router";
+import { AnimatePresence, motion } from "motion/react";
+import React from "react";
+import { shouldShowTitlebar } from "@/components/appTitlebar/routeVisibility";
+import {
+ type AppStatusPhase,
+ useAppStatusStore,
+} from "@/utils/store/appStatus";
+
+import "./appStatus.scss";
+
+const ICONS: Record
, string> = {
+ success: "check",
+ warning: "warning",
+ error: "warning",
+ info: "info",
+};
+
+export const AppStatusIndicator = ({
+ floating = false,
+}: {
+ floating?: boolean;
+}) => {
+ const phase = useAppStatusStore((state) => state.phase);
+ const message = useAppStatusStore((state) => state.message);
+
+ if (phase === "idle") {
+ return floating ? null : (
+
+ );
+ }
+
+ const body = (
+
+
+
+ {phase === "loading" ? (
+
+ ) : (
+ {ICONS[phase]}
+ )}
+
+
+
+ );
+
+ return (
+
+ {body}
+
+ );
+};
+
+/** Shows the indicator over players/auth screens where the titlebar is hidden. */
+export const AppStatusOverlay = () => {
+ const { pathname } = useLocation();
+ if (shouldShowTitlebar(pathname)) return null;
+ // The video player renders the indicator inside its own OSD action pill,
+ // next to share / SyncPlay / settings, so no floating copy is needed.
+ if (pathname === "/player") return null;
+ return ;
+};
diff --git a/src/components/appTitlebar/index.tsx b/src/components/appTitlebar/index.tsx
index 805262f..6104550 100644
--- a/src/components/appTitlebar/index.tsx
+++ b/src/components/appTitlebar/index.tsx
@@ -2,6 +2,7 @@ import { IconButton, Tooltip, useScrollTrigger } from "@mui/material";
import { Link, useLocation, useNavigate } from "@tanstack/react-router";
import React, { useEffect, useLayoutEffect, useRef } from "react";
import { useShallow } from "zustand/shallow";
+import { AppStatusIndicator } from "@/components/appStatus";
import BackButton from "@/components/buttons/backButton";
import CastButton from "@/components/buttons/castButton";
import { UserAvatarMenu } from "@/components/userAvatarMenu";
@@ -129,6 +130,7 @@ export const AppTitlebar = () => {
+
{
setCheckForQuickConnect(true);
},
onError: (error) => {
- enqueueSnackbar("Не удалось запустить Quick Connect.", { variant: "error" });
+ enqueueSnackbar("Не удалось запустить Quick Connect.", {
+ variant: "error",
+ });
console.error(error);
},
});
@@ -157,7 +159,6 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
useInterval(
() => {
if (quickConnectSecret) {
- console.log(checkForQuickConnect);
checkQuickConnectStatus.mutate(quickConnectSecret);
}
},
@@ -187,9 +188,7 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
: "Quick Connect недоступен"}
- {quickConnectEnabled.data?.data
- ? "Quick Connect"
- : "QC недоступен"}
+ {quickConnectEnabled.data?.data ? "Quick Connect" : "QC недоступен"}
@@ -228,35 +236,33 @@ function MusicAlbumTitlePage() {
Время
- {allDiscs.length > 1 ? (
- allDiscs.map((disc) => (
-
-
Диск {disc}
- {musicTracks.data?.Items?.map((track, index) =>
- track.ParentIndexNumber === disc ? (
-
- ) : null,
- )}
-
- ))
- ) : (
- musicTracks.data?.Items?.map((track, index) => (
-
- ))
- )}
- {trackCount === 0 && (
- Треки не найдены
- )}
+ {allDiscs.length > 1
+ ? allDiscs.map((disc) => (
+
+
Диск {disc}
+ {musicTracks.data?.Items?.map((track, index) =>
+ track.ParentIndexNumber === disc ? (
+
+ ) : null,
+ )}
+
+ ))
+ : musicTracks.data?.Items?.map((track, index) => (
+
+ ))}
+ {trackCount === 0 && Треки не найдены
}
{(genres.length > 0 || item.data.Overview) && (
@@ -265,18 +271,12 @@ function MusicAlbumTitlePage() {
{genres.length > 0 && (
{genres.map((genre) => (
-
+
))}
)}
{item.data.Overview && (
-
+
)}
)}
@@ -330,5 +330,3 @@ function MusicAlbumTitlePage() {
);
}
}
-
-export default MusicAlbumTitlePage;
diff --git a/src/routes/_api/music/artist/$id.tsx b/src/routes/_api/music/artist/$id.tsx
index 9c68fb8..3510d27 100644
--- a/src/routes/_api/music/artist/$id.tsx
+++ b/src/routes/_api/music/artist/$id.tsx
@@ -1,3 +1,5 @@
+import type { Api } from "@jellyfin/sdk";
+import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import {
BaseItemKind,
ItemFields,
@@ -11,12 +13,11 @@ import Tooltip from "@mui/material/Tooltip";
import { useQuery } from "@tanstack/react-query";
import { createFileRoute } from "@tanstack/react-router";
import React, { useEffect, useMemo, useState } from "react";
-import type { Api } from "@jellyfin/sdk";
-import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import AlbumMusicTrack from "@/components/albumMusicTrack";
import InstantMixButton from "@/components/buttons/instantMixButton";
import LikeButton from "@/components/buttons/likeButton";
import PlayButton from "@/components/buttons/playButton";
+import RatingControl from "@/components/buttons/ratingControl";
import { Card } from "@/components/card/card";
import IconLink from "@/components/iconLink";
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
@@ -109,6 +110,7 @@ function ArtistTitlePage() {
includeItemTypes: [BaseItemKind.Audio],
userId: user?.Id,
fields: [ItemFields.Overview],
+ enableUserData: true,
});
return result.data;
},
@@ -154,7 +156,8 @@ function ArtistTitlePage() {
if (artistDiscography.data && artistSongs.data && artistAppearances.data) {
if (artistDiscography.data.TotalRecordCount) setActiveTab("discography");
else if (artistSongs.data.TotalRecordCount) setActiveTab("songs");
- else if (artistAppearances.data.TotalRecordCount) setActiveTab("appearances");
+ else if (artistAppearances.data.TotalRecordCount)
+ setActiveTab("appearances");
}
}, [artistDiscography.data, artistSongs.data, artistAppearances.data]);
@@ -267,13 +270,18 @@ function ArtistTitlePage() {
isFavorite={item.data.UserData?.IsFavorite}
userId={user?.Id}
/>
+
{item.data.Overview && (
-
+
)}
{(item.data.ExternalUrls?.length ?? 0) > 0 && (
@@ -336,6 +344,7 @@ function ArtistTitlePage() {
track={track}
trackIndex={index}
musicTracks={artistSongs.data ?? null}
+ queryKey={["item", id, "artist", "songs"]}
/>
))}
{songCount === 0 && Песен пока нет
}
@@ -362,5 +371,3 @@ function ArtistTitlePage() {
);
}
}
-
-export default ArtistTitlePage;
diff --git a/src/routes/_api/music/music.scss b/src/routes/_api/music/music.scss
index 703a7e2..ee9d72b 100644
--- a/src/routes/_api/music/music.scss
+++ b/src/routes/_api/music/music.scss
@@ -119,6 +119,7 @@
.music-actions {
display: flex;
+ flex-wrap: wrap;
align-items: center;
gap: 0.5em;
margin-top: 1.6em;
diff --git a/src/routes/_api/music/playlist/$id.tsx b/src/routes/_api/music/playlist/$id.tsx
index b7961b4..4afb58e 100644
--- a/src/routes/_api/music/playlist/$id.tsx
+++ b/src/routes/_api/music/playlist/$id.tsx
@@ -9,6 +9,7 @@ import React, { useEffect } from "react";
import AlbumMusicTrack from "@/components/albumMusicTrack";
import LikeButton from "@/components/buttons/likeButton";
import PlayButton from "@/components/buttons/playButton";
+import RatingControl from "@/components/buttons/ratingControl";
import { Card } from "@/components/card/card";
import CardScroller from "@/components/cardScroller/cardScroller";
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
@@ -82,6 +83,7 @@ function PlaylistTitlePage() {
const result = await getPlaylistApi(api).getPlaylistItems({
userId: user?.Id,
playlistId: item.data.Id,
+ enableUserData: true,
});
return result.data;
},
@@ -169,6 +171,14 @@ function PlaylistTitlePage() {
userId={user?.Id}
itemName={item.data.Name}
/>
+
@@ -186,6 +196,7 @@ function PlaylistTitlePage() {
track={track}
trackIndex={index}
musicTracks={musicTracks.data ?? null}
+ queryKey={["item", id, "musicTracks"]}
/>
))}
{trackCount === 0 && (
@@ -204,10 +215,7 @@ function PlaylistTitlePage() {
)}
{item.data.Overview && (
-
+
)}
)}
@@ -256,5 +264,3 @@ function PlaylistTitlePage() {
);
}
}
-
-export default PlaylistTitlePage;
diff --git a/src/routes/_api/player/audio.tsx b/src/routes/_api/player/audio.tsx
index 95efaf5..99cb853 100644
--- a/src/routes/_api/player/audio.tsx
+++ b/src/routes/_api/player/audio.tsx
@@ -11,7 +11,12 @@ import {
Tooltip,
} from "@mui/material";
import { useQuery } from "@tanstack/react-query";
-import { createFileRoute, Link, useNavigate, useRouter } from "@tanstack/react-router";
+import {
+ createFileRoute,
+ Link,
+ useNavigate,
+ useRouter,
+} from "@tanstack/react-router";
import { AnimatePresence, motion } from "motion/react";
import React, {
useEffect,
@@ -22,9 +27,8 @@ import React, {
} from "react";
import CastButton from "@/components/buttons/castButton";
import LikeButton from "@/components/buttons/likeButton";
-import LyricsPanel, {
- getLyricsQueryOptions,
-} from "@/components/playback/audioPlayer/components/LyricsPanel";
+import RatingControl from "@/components/buttons/ratingControl";
+import LyricsPanel from "@/components/playback/audioPlayer/components/LyricsPanel";
import PlayerVolume from "@/components/playback/audioPlayer/components/PlayerVolume";
import StatsPanel from "@/components/playback/audioPlayer/components/StatsPanel";
import WindowControls from "@/components/windowControls";
@@ -268,8 +272,6 @@ function AudioPlayerRoute() {
...getItemQueryOptions(item?.Id ?? "", api, user?.Id),
enabled: Boolean(item?.Id && api && user?.Id),
});
- const lyrics = useQuery(getLyricsQueryOptions(item, api));
- const hasLyrics = (lyrics.data?.Lyrics?.length ?? 0) > 0;
// Wall colour derived from the sleeve.
const palette = useMemo(() => getCoverPalette(item), [item]);
@@ -333,9 +335,7 @@ function AudioPlayerRoute() {
return (
<>
-
+
-
-
+
+
-
-
{item?.Name}
-
- {item?.ArtistItems?.length
- ? item.ArtistItems.map((artist, index) => (
-
- {index > 0 && ", "}
- {artist.Id ? (
-
- {artist.Name}
-
- ) : (
- artist.Name
- )}
-
- ))
- : item?.Artists?.join(", ")}
- {item?.Album && (
- <>
- {(item?.ArtistItems?.length || item?.Artists?.length) &&
- " · "}
- {item.AlbumId ? (
-
- {item.Album}
-
- ) : (
- item.Album
- )}
- >
- )}
-
-
-
-
+ {item?.Name}
+
+ {item?.ArtistItems?.length
+ ? item.ArtistItems.map((artist, index) => (
+
+ {index > 0 && ", "}
+ {artist.Id ? (
+
+ {artist.Name}
+
+ ) : (
+ artist.Name
+ )}
+
+ ))
+ : item?.Artists?.join(", ")}
+ {item?.Album && (
+ <>
+ {(item?.ArtistItems?.length || item?.Artists?.length) &&
+ " · "}
+ {item.AlbumId ? (
+
+ {item.Album}
+
+ ) : (
+ item.Album
+ )}
+ >
)}
- max={item?.RunTimeTicks ?? 1}
- step={1}
- size="small"
- aria-label="Перемотка"
- onChange={(_, value) => {
- const next = Array.isArray(value) ? value[0] : value;
- setProgress(ticksToSec(next));
- }}
- onChangeCommitted={(_, value) => {
- const next = Array.isArray(value) ? value[0] : value;
- handleSeekCommit(next);
- }}
- />
+
+
+
+ {
+ const next = Array.isArray(value) ? value[0] : value;
+ setProgress(ticksToSec(next));
+ }}
+ onChangeCommitted={(_, value) => {
+ const next = Array.isArray(value) ? value[0] : value;
+ handleSeekCommit(next);
+ }}
+ />
+
-
-
- {panelOpen && (
-
-
- {panelTab === "lyrics" ? (
- <>
-
-
- Текст песни
-
- setPanelOpen(false)}
- >
- close
-
-
-
- {hasLyrics ? (
+
+ {panelOpen && (
+
+
+ {panelTab === "lyrics" ? (
+ <>
+
+
+ Текст песни
+
+ setPanelOpen(false)}
+ >
+
+ close
+
+
+
+
- ) : (
-
- Для этого трека нет текста.
-
- )}
-
- >
- ) : (
- <>
-
- Очередь
- setPanelOpen(false)}
- >
- close
-
-
-
- {upcoming.length === 0 ? (
-
- Очередь пуста. Запустите альбом или плейлист,
- чтобы она наполнилась.
-
- ) : (
-
- {upcoming.map((track, offset) => (
-
- playItemFromQueue(index, user?.Id, api)
- }
- queryKey={["queue-upcoming"]}
- userId={user?.Id}
- />
- ))}
-
- )}
-
- >
- )}
-
-
- )}
-
+
+ >
+ ) : (
+ <>
+
+
+ Очередь
+
+ setPanelOpen(false)}
+ >
+
+ close
+
+
+
+
+ {upcoming.length === 0 ? (
+
+ Очередь пуста. Запустите альбом или плейлист,
+ чтобы она наполнилась.
+
+ ) : (
+
+ {upcoming.map((track, offset) => (
+
+ playItemFromQueue(index, user?.Id, api)
+ }
+ queryKey={["queue-upcoming"]}
+ userId={user?.Id}
+ />
+ ))}
+
+ )}
+
+ >
+ )}
+
+
+ )}
+
@@ -533,6 +530,14 @@ function AudioPlayerRoute() {
queryKey={["item", item?.Id ?? ""]}
userId={user?.Id}
/>
+
{item && (
lyrics
diff --git a/src/routes/_api/player/index.tsx b/src/routes/_api/player/index.tsx
index 182e6d8..8141c46 100644
--- a/src/routes/_api/player/index.tsx
+++ b/src/routes/_api/player/index.tsx
@@ -88,8 +88,10 @@ function addSubtitleTrackToReactPlayer(
const a = track.track;
a.mode = "showing";
});
- track.addEventListener("error", (e) => {
- console.error("Error loading subtitle track", e);
+ track.addEventListener("error", () => {
+ // Some servers advertise subtitle streams that cannot be delivered
+ // as a text track; the video still plays and JASSUB handles image
+ // subtitles separately.
});
videoElem.appendChild(track);
@@ -99,7 +101,7 @@ function addSubtitleTrackToReactPlayer(
}
}
-export function VideoPlayer() {
+function VideoPlayer() {
const api = useApiInContext((s) => s.api);
const navigate = useNavigate();
const { history } = useRouter();
@@ -357,8 +359,6 @@ export function VideoPlayer() {
});
}
- console.log(mediaSource.subtitle);
-
registerPlayerActions({
seekTo: (seconds: number) => {
// A user seek wins over the pending transfer/resume target.
@@ -639,9 +639,7 @@ export function VideoPlayer() {
wasmUrl,
modernWasmUrl,
});
- jassubRenderer.ready.then(() => {
- console.log("JASSUB subtitle renderer is ready");
- });
+ jassubRenderer.ready.then(() => undefined);
} else if (
mediaSource.subtitle.format === "subrip" ||
mediaSource.subtitle.format === "vtt"
diff --git a/src/routes/_api/search/index.tsx b/src/routes/_api/search/index.tsx
index 72af165..265925b 100644
--- a/src/routes/_api/search/index.tsx
+++ b/src/routes/_api/search/index.tsx
@@ -505,5 +505,3 @@ function CategorySkeleton() {
);
}
-
-export default SearchPage;
diff --git a/src/routes/setup/server.add.tsx b/src/routes/setup/server.add.tsx
index a57bbe8..90189cb 100644
--- a/src/routes/setup/server.add.tsx
+++ b/src/routes/setup/server.add.tsx
@@ -54,7 +54,6 @@ function ServerSetup() {
enqueueSnackbar("Что-то пошло не так", { variant: "error" });
},
onSettled: (bestServer) => {
- console.log(bestServer);
if (!bestServer) {
enqueueSnackbar("Указанный адрес не является сервером Jellyfin.", {
variant: "error",
diff --git a/src/routes/setup/server.list.tsx b/src/routes/setup/server.list.tsx
index d0524a5..cc1f3fc 100644
--- a/src/routes/setup/server.list.tsx
+++ b/src/routes/setup/server.list.tsx
@@ -234,4 +234,3 @@ function ServerList() {
);
}
-export default ServerList;
diff --git a/src/utils/methods/itemImages.ts b/src/utils/methods/itemImages.ts
index c04cff4..c0c6fc3 100644
--- a/src/utils/methods/itemImages.ts
+++ b/src/utils/methods/itemImages.ts
@@ -1,4 +1,7 @@
-import type { BaseItemDto, ImageType } from "@jellyfin/sdk/lib/generated-client";
+import type {
+ BaseItemDto,
+ ImageType,
+} from "@jellyfin/sdk/lib/generated-client";
export type ResolvedItemImage = {
/** Item that actually owns the image (episodes borrow their series' artwork). */
@@ -47,11 +50,14 @@ export const resolveItemImage = (
// Library grids show one poster per episode, owned by the series.
const seriesId = options.seriesId ?? item.SeriesId;
if (options.seriesId && seriesId) {
- return {
- itemId: seriesId,
- imageType: "Primary",
- tag: item.SeriesPrimaryImageTag ?? undefined,
- };
+ const seriesPrimaryTag = item.SeriesPrimaryImageTag ?? undefined;
+ if (seriesPrimaryTag) {
+ return {
+ itemId: seriesId,
+ imageType: "Primary",
+ tag: seriesPrimaryTag,
+ };
+ }
}
const order = ownFallbackOrder[preferred] ?? [preferred];
@@ -69,9 +75,6 @@ export const resolveItemImage = (
tag: item.SeriesPrimaryImageTag,
};
}
- if (seriesId && item.Type === "Episode") {
- return { itemId: seriesId, imageType: "Primary" };
- }
// Audio inherits its cover from the album.
if (item.AlbumId) {
return { itemId: item.AlbumId, imageType: "Primary" };
@@ -84,11 +87,9 @@ export const resolveItemImage = (
};
}
- // Nothing known: keep the requested type so the server gets a chance, but
- // only when the item exists. Callers render their icon placeholder on 404.
- if (item.Id) {
- return { itemId: item.Id, imageType: preferred };
- }
+ // Do not invent an image URL when the item has no advertised artwork:
+ // requesting /Images/Primary for such items only produces 404 noise. The
+ // card/hero fall back to their own placeholder icon instead.
return undefined;
};
diff --git a/src/utils/methods/transferPlayback.ts b/src/utils/methods/transferPlayback.ts
index b11f427..5b16859 100644
--- a/src/utils/methods/transferPlayback.ts
+++ b/src/utils/methods/transferPlayback.ts
@@ -64,13 +64,28 @@ export const playOnSession = async (
): Promise
=> {
if (options.itemIds.length === 0) return;
- const sessionApi = getSessionApi(api);
- const startPositionTicks = Math.max(0, options.startPositionTicks ?? 0);
- const startIndex = Math.min(
+ // The Jellyfin Play endpoint takes every queue item as a repeated query
+ // parameter. A whole library/playlist can exceed the proxy URL limit and
+ // the connection is closed before the request reaches the server. Send a
+ // window of the queue around the current item; 40 is plenty for hand-off.
+ const MAX_REMOTE_QUEUE = 40;
+ const requestedIndex = Math.min(
Math.max(0, options.startIndex ?? 0),
options.itemIds.length - 1,
);
- const expectedItemId = options.itemIds[startIndex];
+ const windowStart = Math.max(
+ 0,
+ Math.min(requestedIndex, options.itemIds.length - MAX_REMOTE_QUEUE),
+ );
+ const itemIds = options.itemIds.slice(
+ windowStart,
+ windowStart + MAX_REMOTE_QUEUE,
+ );
+ const startIndex = requestedIndex - windowStart;
+ const expectedItemId = itemIds[startIndex];
+
+ const sessionApi = getSessionApi(api);
+ const startPositionTicks = Math.max(0, options.startPositionTicks ?? 0);
const readTarget = async () => {
try {
@@ -106,7 +121,7 @@ export const playOnSession = async (
await sessionApi.play({
sessionId,
playCommand: "PlayNow",
- itemIds: options.itemIds,
+ itemIds,
startIndex,
startPositionTicks,
mediaSourceId: options.mediaSourceId,
diff --git a/src/utils/queries/libraryItems.ts b/src/utils/queries/libraryItems.ts
index f5135b3..9672c3e 100644
--- a/src/utils/queries/libraryItems.ts
+++ b/src/utils/queries/libraryItems.ts
@@ -71,7 +71,6 @@ export const getLibraryItemsQueryOptions = (
);
return { Items: [], TotalRecordCount: 0 } as BaseItemDtoQueryResult;
}
- console.info("Fetching library items with params:", params);
const { currentViewType, videoTypesState, filters } = params;
const buildVideoTypes = (state: typeof videoTypesState) => {
const videoTypes: VideoType[] = [];
diff --git a/src/utils/storage/settings.ts b/src/utils/storage/settings.ts
index 73fd589..5a3dccc 100644
--- a/src/utils/storage/settings.ts
+++ b/src/utils/storage/settings.ts
@@ -14,7 +14,6 @@ export const setSetting = async (settingKey: string, value: boolean) => {
export const getSetting = async (settingKey: string) => {
const value = await SettingsStore.get(settingKey);
- console.log(`${settingKey} - ${value}`);
if (value) return value;
return false;
};
@@ -28,4 +27,4 @@ export const allSettings = {
"Показывает кнопку пропуска интро и титров в сериях. Для этого на сервере должен быть установлен плагин jumoog/intro-skipper.",
},
],
-};
\ No newline at end of file
+};
diff --git a/src/utils/store/appStatus.ts b/src/utils/store/appStatus.ts
new file mode 100644
index 0000000..a5c7713
--- /dev/null
+++ b/src/utils/store/appStatus.ts
@@ -0,0 +1,79 @@
+import { create } from "zustand";
+
+export type AppStatusPhase =
+ | "idle"
+ | "loading"
+ | "success"
+ | "warning"
+ | "error"
+ | "info";
+
+type AppStatusState = {
+ phase: AppStatusPhase;
+ message: string;
+ /** Bumped on every notification so stale timers can be ignored. */
+ token: number;
+ notify: (variant: string, message: unknown) => void;
+ reset: () => void;
+};
+
+let resultTimer: ReturnType | null = null;
+let idleTimer: ReturnType | null = null;
+
+const clearTimers = () => {
+ if (resultTimer) clearTimeout(resultTimer);
+ if (idleTimer) clearTimeout(idleTimer);
+ resultTimer = null;
+ idleTimer = null;
+};
+
+const messageText = (message: unknown): string => {
+ if (typeof message === "string") return message;
+ if (typeof message === "number") return String(message);
+ if (message && typeof message === "object") {
+ const props = (message as { props?: { children?: unknown } }).props;
+ if (typeof props?.children === "string") return props.children;
+ }
+ return "Готово";
+};
+
+const phaseForVariant = (variant: string): AppStatusPhase => {
+ switch (variant) {
+ case "success":
+ return "success";
+ case "error":
+ return "error";
+ case "warning":
+ return "warning";
+ default:
+ return "info";
+ }
+};
+
+export const useAppStatusStore = create((set) => ({
+ phase: "idle",
+ message: "",
+ token: 0,
+ notify: (variant, message) => {
+ clearTimers();
+ const phase = phaseForVariant(variant);
+ const text = messageText(message);
+ const token = Date.now();
+ set({ phase: "loading", message: text, token });
+
+ // A short spinner beat makes the titlebar icon feel like a process
+ // completing (spinner → check / warning) rather than a random blink.
+ resultTimer = setTimeout(() => {
+ resultTimer = null;
+ set({ phase, message: text, token });
+ idleTimer = setTimeout(() => {
+ idleTimer = null;
+ set({ phase: "idle", message: "", token: 0 });
+ }, 2600);
+ }, 450);
+ },
+ reset: () => {
+ clearTimers();
+ set({ phase: "idle", message: "", token: 0 });
+ },
+}));
diff --git a/src/utils/store/playback.ts b/src/utils/store/playback.ts
index 3da13ce..bba44ce 100644
--- a/src/utils/store/playback.ts
+++ b/src/utils/store/playback.ts
@@ -565,7 +565,6 @@ export const usePlaybackStore = create<
},
},
registerPlayerActions: (actions) => {
- console.info("Registering player actions:", actions);
set({
_playerActions: actions,
});
@@ -628,10 +627,8 @@ export const usePlaybackStore = create<
(s) => s.Id === activeSegmentId,
);
if (!activeSegment) {
- console.warn("No segment to skip");
return;
}
- console.info("Skipping segment:", activeSegment);
get()._playerActions.seekTo(ticksToSec(activeSegment.EndTicks ?? 0));
},
handleStartSeek: (ticks) => {
@@ -653,7 +650,6 @@ export const usePlaybackStore = create<
const ticks = secToTicks(seconds);
const segments = get().metadata.mediaSegments?.Items;
if (!segments || segments.length === 0) {
- console.warn("No segments available for seeking");
return;
}
const segment = segments.find(
diff --git a/src/utils/store/queue.ts b/src/utils/store/queue.ts
index dc1d410..31a01b5 100644
--- a/src/utils/store/queue.ts
+++ b/src/utils/store/queue.ts
@@ -30,7 +30,6 @@ export const setQueue = (
};
export const setTrackIndex = (index: number) => {
- console.info(`Setting index ${index}`);
useQueue.setState((state) => ({ ...state, currentItemIndex: index }));
};