mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-05-24 04:22:12 +00:00
Merge 6b866407a7 into 87ccc591df
This commit is contained in:
commit
2cf1a714d2
5 changed files with 69 additions and 6 deletions
|
|
@ -17,7 +17,7 @@
|
|||
"@babel/runtime": "7.29.2",
|
||||
"@sentry/browser": "8.42.0",
|
||||
"@stremio/stremio-colors": "5.2.0",
|
||||
"@stremio/stremio-core-web": "0.58.0",
|
||||
"@stremio/stremio-core-web": "https://stremio.github.io/stremio-core/stremio-core-web/feat/add-cache-drive-option/dev/stremio-stremio-core-web-0.58.0.tgz",
|
||||
"@stremio/stremio-icons": "5.10.0",
|
||||
"@stremio/stremio-video": "0.0.79",
|
||||
"a-color-picker": "1.2.1",
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ importers:
|
|||
specifier: 5.2.0
|
||||
version: 5.2.0
|
||||
'@stremio/stremio-core-web':
|
||||
specifier: 0.58.0
|
||||
version: 0.58.0
|
||||
specifier: https://stremio.github.io/stremio-core/stremio-core-web/feat/add-cache-drive-option/dev/stremio-stremio-core-web-0.58.0.tgz
|
||||
version: https://stremio.github.io/stremio-core/stremio-core-web/feat/add-cache-drive-option/dev/stremio-stremio-core-web-0.58.0.tgz
|
||||
'@stremio/stremio-icons':
|
||||
specifier: 5.10.0
|
||||
version: 5.10.0
|
||||
|
|
@ -1394,8 +1394,9 @@ packages:
|
|||
'@stremio/stremio-colors@5.2.0':
|
||||
resolution: {integrity: sha512-dYlPgu9W/H7c9s1zmW5tiDnRenaUa4Hg1QCyOg1lhOcgSfM/bVTi5nnqX+IfvGTTUNA0zgzh8hI3o3miwnZxTg==}
|
||||
|
||||
'@stremio/stremio-core-web@0.58.0':
|
||||
resolution: {integrity: sha512-HwXf4fXdWKxvfnXhqvI3qpXaHVITYdjWwQrdGJKG17LURXPGZfYddcTIQ+h2J6K7EIYSrjysyjoJ0lEYBdSemg==}
|
||||
'@stremio/stremio-core-web@https://stremio.github.io/stremio-core/stremio-core-web/feat/add-cache-drive-option/dev/stremio-stremio-core-web-0.58.0.tgz':
|
||||
resolution: {tarball: https://stremio.github.io/stremio-core/stremio-core-web/feat/add-cache-drive-option/dev/stremio-stremio-core-web-0.58.0.tgz}
|
||||
version: 0.58.0
|
||||
|
||||
'@stremio/stremio-icons@5.10.0':
|
||||
resolution: {integrity: sha512-Zw/vGC3D2yeQfk8xv/tfMJTDvbCPOI91tBg4XpR2+EgbZSX8Xvm7Vz457PIhFPhTAwdOPHp0VX0M3gzjbt0zOg==}
|
||||
|
|
@ -6444,7 +6445,7 @@ snapshots:
|
|||
|
||||
'@stremio/stremio-colors@5.2.0': {}
|
||||
|
||||
'@stremio/stremio-core-web@0.58.0':
|
||||
'@stremio/stremio-core-web@https://stremio.github.io/stremio-core/stremio-core-web/feat/add-cache-drive-option/dev/stremio-stremio-core-web-0.58.0.tgz':
|
||||
dependencies:
|
||||
'@babel/runtime': 7.24.1
|
||||
|
||||
|
|
|
|||
10
src/core/types/models/StremingServer.d.ts
vendored
10
src/core/types/models/StremingServer.d.ts
vendored
|
|
@ -27,6 +27,15 @@ type StreamingServerSettings = {
|
|||
transcodeProfile: string | null,
|
||||
};
|
||||
|
||||
type StreamingServerSettingsOption = {
|
||||
id: string,
|
||||
label: string,
|
||||
selections?: {
|
||||
name: string,
|
||||
val: string | number | null,
|
||||
}[],
|
||||
};
|
||||
|
||||
type SFile = {
|
||||
name: string,
|
||||
path: string,
|
||||
|
|
@ -122,6 +131,7 @@ type StreamingServer = {
|
|||
remoteUrl: string | null,
|
||||
selected: Selected | null,
|
||||
settings: Loadable<StreamingServerSettings> | null,
|
||||
settingsOptions: StreamingServerSettingsOption[],
|
||||
torrent: [string, Loadable<Torrent>] | null,
|
||||
statistics: Loadable<Statistics> | null,
|
||||
playbackDevices: Loadable<PlaybackDevice[]> | null,
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ const Streaming = forwardRef<HTMLDivElement, Props>(({ profile, streamingServer
|
|||
streamingServerRemoteUrlInput,
|
||||
remoteEndpointSelect,
|
||||
cacheSizeSelect,
|
||||
cacheLocationSelect,
|
||||
torrentProfileSelect,
|
||||
transcodingProfileSelect,
|
||||
} = useStreamingOptions(streamingServer);
|
||||
|
|
@ -67,6 +68,15 @@ const Streaming = forwardRef<HTMLDivElement, Props>(({ profile, streamingServer
|
|||
/>
|
||||
</Option>
|
||||
}
|
||||
{
|
||||
cacheLocationSelect !== null &&
|
||||
<Option label={'SETTINGS_CACHING_DRIVE'}>
|
||||
<MultiselectMenu
|
||||
className={'multiselect'}
|
||||
{...cacheLocationSelect}
|
||||
/>
|
||||
</Option>
|
||||
}
|
||||
{
|
||||
torrentProfileSelect !== null &&
|
||||
<Option label={'SETTINGS_SERVER_TORRENT_PROFILE'}>
|
||||
|
|
|
|||
|
|
@ -81,6 +81,10 @@ const useStreamingOptions = (streamingServer: StreamingServer) => {
|
|||
streamingServer.deviceInfo.content as DeviceInfo : null
|
||||
), [streamingServer.deviceInfo]);
|
||||
|
||||
const cacheRootOption = useMemo(() => {
|
||||
return streamingServer.settingsOptions?.find(({ id }) => id === 'cacheRoot') ?? null;
|
||||
}, [streamingServer.settingsOptions]);
|
||||
|
||||
const streamingServerRemoteUrlInput = useMemo(() => ({
|
||||
value: streamingServer.remoteUrl,
|
||||
}), [streamingServer.remoteUrl]);
|
||||
|
|
@ -146,6 +150,43 @@ const useStreamingOptions = (streamingServer: StreamingServer) => {
|
|||
};
|
||||
}, [settings]);
|
||||
|
||||
const cacheLocationSelect = useMemo(() => {
|
||||
if (!settings || !cacheRootOption?.selections?.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const options = cacheRootOption.selections
|
||||
.filter(({ val }) => typeof val === 'string')
|
||||
.map(({ name, val }) => ({
|
||||
label: name,
|
||||
value: val as string,
|
||||
}));
|
||||
|
||||
if (!options.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
options,
|
||||
value: settings.cacheRoot,
|
||||
title: () => {
|
||||
return settings.cacheRoot;
|
||||
},
|
||||
onSelect: (value: string) => {
|
||||
core.transport.dispatch({
|
||||
action: 'StreamingServer',
|
||||
args: {
|
||||
action: 'UpdateSettings',
|
||||
args: {
|
||||
...settings,
|
||||
cacheRoot: value,
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}, [settings, cacheRootOption]);
|
||||
|
||||
const torrentProfileSelect = useMemo(() => {
|
||||
if (!settings) {
|
||||
return null;
|
||||
|
|
@ -229,6 +270,7 @@ const useStreamingOptions = (streamingServer: StreamingServer) => {
|
|||
streamingServerRemoteUrlInput,
|
||||
remoteEndpointSelect,
|
||||
cacheSizeSelect,
|
||||
cacheLocationSelect,
|
||||
torrentProfileSelect,
|
||||
transcodingProfileSelect,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue