mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-05-13 02:16:29 +01:00
Compare commits
1 Commits
fix/maxEpi
...
renovate/t
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0f267abc7 |
8
bun.lock
8
bun.lock
@@ -19,7 +19,7 @@
|
|||||||
"@shopify/flash-list": "2.0.2",
|
"@shopify/flash-list": "2.0.2",
|
||||||
"@tanstack/query-sync-storage-persister": "^5.90.18",
|
"@tanstack/query-sync-storage-persister": "^5.90.18",
|
||||||
"@tanstack/react-pacer": "^0.19.1",
|
"@tanstack/react-pacer": "^0.19.1",
|
||||||
"@tanstack/react-query": "5.90.20",
|
"@tanstack/react-query": "5.100.9",
|
||||||
"@tanstack/react-query-persist-client": "^5.90.18",
|
"@tanstack/react-query-persist-client": "^5.90.18",
|
||||||
"axios": "^1.7.9",
|
"axios": "^1.7.9",
|
||||||
"expo": "~54.0.31",
|
"expo": "~54.0.31",
|
||||||
@@ -602,7 +602,7 @@
|
|||||||
|
|
||||||
"@tanstack/react-pacer": ["@tanstack/react-pacer@0.19.1", "", { "dependencies": { "@tanstack/pacer": "0.17.1", "@tanstack/react-store": "^0.8.0" }, "peerDependencies": { "react": ">=16.8", "react-dom": ">=16.8" } }, "sha512-wfGwKLo2gosKr5tsXico+jWJ8LsWsBC8MA1HVtUY/D6dhFduEVizKxRUcvP60I3dRvnoXDbN202g4feJHlivnA=="],
|
"@tanstack/react-pacer": ["@tanstack/react-pacer@0.19.1", "", { "dependencies": { "@tanstack/pacer": "0.17.1", "@tanstack/react-store": "^0.8.0" }, "peerDependencies": { "react": ">=16.8", "react-dom": ">=16.8" } }, "sha512-wfGwKLo2gosKr5tsXico+jWJ8LsWsBC8MA1HVtUY/D6dhFduEVizKxRUcvP60I3dRvnoXDbN202g4feJHlivnA=="],
|
||||||
|
|
||||||
"@tanstack/react-query": ["@tanstack/react-query@5.90.20", "", { "dependencies": { "@tanstack/query-core": "5.90.20" }, "peerDependencies": { "react": "^18 || ^19" } }, "sha512-vXBxa+qeyveVO7OA0jX1z+DeyCA4JKnThKv411jd5SORpBKgkcVnYKCiBgECvADvniBX7tobwBmg01qq9JmMJw=="],
|
"@tanstack/react-query": ["@tanstack/react-query@5.100.9", "", { "dependencies": { "@tanstack/query-core": "5.100.9" }, "peerDependencies": { "react": "^18 || ^19" } }, "sha512-Oa44XkaI3kCNN6ME0KByU3xT3SEUNOMfZpHxL6+wFoTm+OeUFYHKdeYVe0aOXlRDm/f15sgLwEt2HDorIdW8+A=="],
|
||||||
|
|
||||||
"@tanstack/react-query-persist-client": ["@tanstack/react-query-persist-client@5.90.18", "", { "dependencies": { "@tanstack/query-persist-client-core": "5.91.15" }, "peerDependencies": { "@tanstack/react-query": "^5.90.16", "react": "^18 || ^19" } }, "sha512-ToVRTVpjzTrd9S/p7JIvGdLs+Xtz9aDMM/7+TQGSV9notY8Jt64irfAAAkZ05syftLKS+3KPgyKAnHcVeKVbWQ=="],
|
"@tanstack/react-query-persist-client": ["@tanstack/react-query-persist-client@5.90.18", "", { "dependencies": { "@tanstack/query-persist-client-core": "5.91.15" }, "peerDependencies": { "@tanstack/react-query": "^5.90.16", "react": "^18 || ^19" } }, "sha512-ToVRTVpjzTrd9S/p7JIvGdLs+Xtz9aDMM/7+TQGSV9notY8Jt64irfAAAkZ05syftLKS+3KPgyKAnHcVeKVbWQ=="],
|
||||||
|
|
||||||
@@ -1696,7 +1696,7 @@
|
|||||||
|
|
||||||
"react-native-text-ticker": ["react-native-text-ticker@1.15.0", "", {}, "sha512-d/uK+PIOhsYMy1r8h825iq/nADiHsabz3WMbRJSnkpQYn+K9aykUAXRRhu8ZbTAzk4CgnUWajJEFxS5ZDygsdg=="],
|
"react-native-text-ticker": ["react-native-text-ticker@1.15.0", "", {}, "sha512-d/uK+PIOhsYMy1r8h825iq/nADiHsabz3WMbRJSnkpQYn+K9aykUAXRRhu8ZbTAzk4CgnUWajJEFxS5ZDygsdg=="],
|
||||||
|
|
||||||
"react-native-track-player": ["react-native-track-player@github:lovegaoshi/react-native-track-player#003afd0", { "peerDependencies": { "react": "*", "react-native": "*", "react-native-windows": "*", "shaka-player": "^4.7.9" }, "optionalPeers": ["react-native-windows", "shaka-player"] }, "lovegaoshi-react-native-track-player-003afd0"],
|
"react-native-track-player": ["react-native-track-player@github:lovegaoshi/react-native-track-player#003afd0", { "peerDependencies": { "react": "*", "react-native": "*", "react-native-windows": "*", "shaka-player": "^4.7.9" }, "optionalPeers": ["react-native-windows", "shaka-player"] }, "lovegaoshi-react-native-track-player-003afd0", "sha512-HR7BaMDMBhQ4xAy5XeQEkT0fBosWw2x9+X2QOD4buocxuX03D770LaRKm5rgQ/qDzchr92KW7+d8fISI14fRLA=="],
|
||||||
|
|
||||||
"react-native-udp": ["react-native-udp@4.1.7", "", { "dependencies": { "buffer": "^5.6.0", "events": "^3.1.0" } }, "sha512-NUE3zewu61NCdSsLlj+l0ad6qojcVEZPT4hVG/x6DU9U4iCzwtfZSASh9vm7teAcVzLkdD+cO3411LHshAi/wA=="],
|
"react-native-udp": ["react-native-udp@4.1.7", "", { "dependencies": { "buffer": "^5.6.0", "events": "^3.1.0" } }, "sha512-NUE3zewu61NCdSsLlj+l0ad6qojcVEZPT4hVG/x6DU9U4iCzwtfZSASh9vm7teAcVzLkdD+cO3411LHshAi/wA=="],
|
||||||
|
|
||||||
@@ -2244,7 +2244,7 @@
|
|||||||
|
|
||||||
"@react-navigation/native-stack/color": ["color@4.2.3", "", { "dependencies": { "color-convert": "^2.0.1", "color-string": "^1.9.0" } }, "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A=="],
|
"@react-navigation/native-stack/color": ["color@4.2.3", "", { "dependencies": { "color-convert": "^2.0.1", "color-string": "^1.9.0" } }, "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A=="],
|
||||||
|
|
||||||
"@tanstack/react-query/@tanstack/query-core": ["@tanstack/query-core@5.90.20", "", {}, "sha512-OMD2HLpNouXEfZJWcKeVKUgQ5n+n3A2JFmBaScpNDUqSrQSjiveC7dKMe53uJUg1nDG16ttFPz2xfilz6i2uVg=="],
|
"@tanstack/react-query/@tanstack/query-core": ["@tanstack/query-core@5.100.9", "", {}, "sha512-SJSFw1S8+kQ0+knv/XGfrbocWoAlT7vDKsSImtLx3ZPQmEcR46hkDjLSvynSy25N8Ms4tIEini1FuBd5k7IscQ=="],
|
||||||
|
|
||||||
"@types/babel__core/@babel/parser": ["@babel/parser@7.28.5", "", { "dependencies": { "@babel/types": "^7.28.5" }, "bin": "./bin/babel-parser.js" }, "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ=="],
|
"@types/babel__core/@babel/parser": ["@babel/parser@7.28.5", "", { "dependencies": { "@babel/types": "^7.28.5" }, "bin": "./bin/babel-parser.js" }, "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ=="],
|
||||||
|
|
||||||
|
|||||||
@@ -204,10 +204,7 @@ export const OtherSettings: React.FC = () => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<ListItem
|
<ListItem title={t("home.settings.other.max_auto_play_episode_count")}>
|
||||||
title={t("home.settings.other.max_auto_play_episode_count")}
|
|
||||||
disabled={pluginSettings?.maxAutoPlayEpisodeCount?.locked}
|
|
||||||
>
|
|
||||||
<PlatformDropdown
|
<PlatformDropdown
|
||||||
groups={autoPlayEpisodeOptions}
|
groups={autoPlayEpisodeOptions}
|
||||||
trigger={
|
trigger={
|
||||||
|
|||||||
@@ -229,10 +229,7 @@ export const PlaybackControlsSettings: React.FC = () => {
|
|||||||
|
|
||||||
<ListItem
|
<ListItem
|
||||||
title={t("home.settings.other.max_auto_play_episode_count")}
|
title={t("home.settings.other.max_auto_play_episode_count")}
|
||||||
disabled={
|
disabled={!settings.autoPlayNextEpisode}
|
||||||
!settings.autoPlayNextEpisode ||
|
|
||||||
pluginSettings?.maxAutoPlayEpisodeCount?.locked
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<PlatformDropdown
|
<PlatformDropdown
|
||||||
groups={autoPlayEpisodeOptions}
|
groups={autoPlayEpisodeOptions}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
"@shopify/flash-list": "2.0.2",
|
"@shopify/flash-list": "2.0.2",
|
||||||
"@tanstack/query-sync-storage-persister": "^5.90.18",
|
"@tanstack/query-sync-storage-persister": "^5.90.18",
|
||||||
"@tanstack/react-pacer": "^0.19.1",
|
"@tanstack/react-pacer": "^0.19.1",
|
||||||
"@tanstack/react-query": "5.90.20",
|
"@tanstack/react-query": "5.100.9",
|
||||||
"@tanstack/react-query-persist-client": "^5.90.18",
|
"@tanstack/react-query-persist-client": "^5.90.18",
|
||||||
"axios": "^1.7.9",
|
"axios": "^1.7.9",
|
||||||
"expo": "~54.0.31",
|
"expo": "~54.0.31",
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {
|
|||||||
type SortOrder,
|
type SortOrder,
|
||||||
SubtitlePlaybackMode,
|
SubtitlePlaybackMode,
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { t } from "i18next";
|
|
||||||
import { atom, useAtom, useAtomValue } from "jotai";
|
import { atom, useAtom, useAtomValue } from "jotai";
|
||||||
import { useCallback, useEffect, useMemo } from "react";
|
import { useCallback, useEffect, useMemo } from "react";
|
||||||
import { BITRATES, type Bitrate } from "@/components/BitrateSelector";
|
import { BITRATES, type Bitrate } from "@/components/BitrateSelector";
|
||||||
@@ -122,46 +121,6 @@ export interface MaxAutoPlayEpisodeCount {
|
|||||||
value: number;
|
value: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The plugin may send object-typed settings as plain primitives.
|
|
||||||
* Resolve to the proper option object from the available choices.
|
|
||||||
*/
|
|
||||||
const normalizePluginValue = (
|
|
||||||
settingsKey: keyof Settings,
|
|
||||||
value: unknown,
|
|
||||||
): unknown => {
|
|
||||||
if (typeof value !== "object" || value === null) {
|
|
||||||
const defaultVal = defaultValues[settingsKey];
|
|
||||||
if (
|
|
||||||
typeof defaultVal === "object" &&
|
|
||||||
defaultVal !== null &&
|
|
||||||
"key" in defaultVal &&
|
|
||||||
"value" in defaultVal
|
|
||||||
) {
|
|
||||||
// defaultBitrate needs a lookup because its keys are human-readable
|
|
||||||
// (e.g. "8 Mb/s") that can't be derived from the raw value (e.g. 8000000).
|
|
||||||
// Other { key, value } settings like maxAutoPlayEpisodeCount work with
|
|
||||||
// the fallback because their keys are just String(value) (e.g. "5").
|
|
||||||
if (settingsKey === "defaultBitrate") {
|
|
||||||
const match = BITRATES.find(
|
|
||||||
(b) => b.key === value || b.value === value,
|
|
||||||
);
|
|
||||||
if (match) return match;
|
|
||||||
}
|
|
||||||
// maxAutoPlayEpisodeCount: 0 is invalid (breaks autoplay), clamp to -1
|
|
||||||
// -1 key must match the translated dropdown label so the UI shows "Disabled"
|
|
||||||
if (
|
|
||||||
settingsKey === "maxAutoPlayEpisodeCount" &&
|
|
||||||
(value === 0 || value === -1)
|
|
||||||
) {
|
|
||||||
return { key: t("home.settings.other.disabled"), value: -1 };
|
|
||||||
}
|
|
||||||
return { key: String(value), value };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type HomeSectionLatestResolver = {
|
export type HomeSectionLatestResolver = {
|
||||||
parentId?: string;
|
parentId?: string;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
@@ -403,7 +362,7 @@ export const useSettings = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const refreshStreamyfinPluginSettings = useCallback(
|
const refreshStreamyfinPluginSettings = useCallback(
|
||||||
async (_forceOverride = false) => {
|
async (forceOverride = false) => {
|
||||||
if (!api) {
|
if (!api) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -416,17 +375,20 @@ export const useSettings = () => {
|
|||||||
);
|
);
|
||||||
setPluginSettings(newPluginSettings);
|
setPluginSettings(newPluginSettings);
|
||||||
|
|
||||||
// Apply locked plugin values to settings (unlocked values are handled
|
// Apply plugin values to settings
|
||||||
// by the settings memo, which respects user customizations)
|
|
||||||
if (newPluginSettings && _settings) {
|
if (newPluginSettings && _settings) {
|
||||||
const updates: Partial<Settings> = {};
|
const updates: Partial<Settings> = {};
|
||||||
for (const [key, setting] of Object.entries(newPluginSettings)) {
|
for (const [key, setting] of Object.entries(newPluginSettings)) {
|
||||||
if (setting?.locked) {
|
if (setting && !setting.locked && setting.value !== undefined) {
|
||||||
const settingsKey = key as keyof Settings;
|
const settingsKey = key as keyof Settings;
|
||||||
(updates as any)[settingsKey] = normalizePluginValue(
|
// Apply if forceOverride is true, or if user hasn't explicitly set this value
|
||||||
settingsKey,
|
if (
|
||||||
setting.value,
|
forceOverride ||
|
||||||
);
|
_settings[settingsKey] === undefined ||
|
||||||
|
_settings[settingsKey] === ""
|
||||||
|
) {
|
||||||
|
(updates as any)[settingsKey] = setting.value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -478,31 +440,26 @@ export const useSettings = () => {
|
|||||||
// If admin sets locked to false but provides a value,
|
// If admin sets locked to false but provides a value,
|
||||||
// use user settings first and fallback on admin setting if required.
|
// use user settings first and fallback on admin setting if required.
|
||||||
const settings: Settings = useMemo(() => {
|
const settings: Settings = useMemo(() => {
|
||||||
const _unlockedPluginDefaults: Partial<Settings> = {};
|
const unlockedPluginDefaults: Partial<Settings> = {};
|
||||||
const overrideSettings = Object.entries(pluginSettings ?? {}).reduce<
|
const overrideSettings = Object.entries(pluginSettings ?? {}).reduce<
|
||||||
Partial<Settings>
|
Partial<Settings>
|
||||||
>((acc, [key, setting]) => {
|
>((acc, [key, setting]) => {
|
||||||
if (setting) {
|
if (setting) {
|
||||||
let { value } = setting;
|
const { value, locked } = setting;
|
||||||
const { locked } = setting;
|
|
||||||
const settingsKey = key as keyof Settings;
|
const settingsKey = key as keyof Settings;
|
||||||
|
|
||||||
// Normalize object-typed settings from plugin (plain primitive → { key, value })
|
// Make sure we override default settings with plugin settings when they are not locked.
|
||||||
value = normalizePluginValue(settingsKey, value);
|
if (
|
||||||
|
!locked &&
|
||||||
// For unlocked settings: use plugin value unless user explicitly
|
value !== undefined &&
|
||||||
// customized (their saved value differs from the default)
|
_settings?.[settingsKey] !== value
|
||||||
const userVal = _settings?.[settingsKey];
|
) {
|
||||||
const defaultVal = defaultValues[settingsKey];
|
(unlockedPluginDefaults as any)[settingsKey] = value;
|
||||||
const userCustomized =
|
}
|
||||||
userVal !== undefined &&
|
|
||||||
JSON.stringify(userVal) !== JSON.stringify(defaultVal);
|
|
||||||
|
|
||||||
(acc as any)[settingsKey] = locked
|
(acc as any)[settingsKey] = locked
|
||||||
? value
|
? value
|
||||||
: userCustomized
|
: (_settings?.[settingsKey] ?? value);
|
||||||
? userVal
|
|
||||||
: value;
|
|
||||||
}
|
}
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
|||||||
Reference in New Issue
Block a user