add proxy streams setting

This commit is contained in:
unclekingpin 2024-06-23 02:33:45 -07:00
parent 4d97ed946a
commit 4480423731
2 changed files with 39 additions and 1 deletions

View file

@ -47,6 +47,7 @@ const Settings = () => {
} = useProfileSettingsInputs(profile); } = useProfileSettingsInputs(profile);
const { const {
streamingServerRemoteUrlInput, streamingServerRemoteUrlInput,
proxyStreamsCheckbox,
remoteEndpointSelect, remoteEndpointSelect,
cacheSizeSelect, cacheSizeSelect,
torrentProfileSelect, torrentProfileSelect,
@ -627,6 +628,21 @@ const Settings = () => {
: :
null null
} }
{
proxyStreamsCheckbox !== null ?
<div className={styles['option-container']}>
<div className={styles['option-name-container']}>
<div className={styles['label']}>{ t('SETTINGS_PROXY_STREAMS') }</div>
</div>
<Checkbox
className={classnames(styles['option-input-container'], styles['checkbox-container'])}
tabIndex={-1}
{...proxyStreamsCheckbox}
/>
</div>
:
null
}
</div> </div>
<div ref={shortcutsSectionRef} className={styles['section-container']}> <div ref={shortcutsSectionRef} className={styles['section-container']}>
<div className={styles['section-title']}>{ t('SETTINGS_NAV_SHORTCUTS') }</div> <div className={styles['section-title']}>{ t('SETTINGS_NAV_SHORTCUTS') }</div>

View file

@ -61,6 +61,28 @@ const useStreamingServerSettingsInputs = (streamingServer) => {
value: streamingServer.remoteUrl, value: streamingServer.remoteUrl,
}), [streamingServer.remoteUrl]); }), [streamingServer.remoteUrl]);
const proxyStreamsCheckbox = React.useMemo(() => {
if (streamingServer.settings?.type !== 'Ready') {
return null;
}
return {
checked: streamingServer.settings.content.proxyStreamsEnabled,
onClick: () => {
core.transport.dispatch({
action: 'StreamingServer',
args: {
action: 'UpdateSettings',
args: {
...streamingServer.settings.content,
proxyStreamsEnabled: !streamingServer.settings.content.proxyStreamsEnabled
}
}
});
}
}
}, [streamingServer.settings]);
const remoteEndpointSelect = React.useMemo(() => { const remoteEndpointSelect = React.useMemo(() => {
if (streamingServer.settings?.type !== 'Ready' || streamingServer.networkInfo?.type !== 'Ready') { if (streamingServer.settings?.type !== 'Ready' || streamingServer.networkInfo?.type !== 'Ready') {
return null; return null;
@ -198,7 +220,7 @@ const useStreamingServerSettingsInputs = (streamingServer) => {
} }
}; };
}, [streamingServer.settings, streamingServer.deviceInfo]); }, [streamingServer.settings, streamingServer.deviceInfo]);
return { streamingServerRemoteUrlInput, remoteEndpointSelect, cacheSizeSelect, torrentProfileSelect, transcodingProfileSelect }; return { streamingServerRemoteUrlInput, proxyStreamsCheckbox, remoteEndpointSelect, cacheSizeSelect, torrentProfileSelect, transcodingProfileSelect };
}; };
module.exports = useStreamingServerSettingsInputs; module.exports = useStreamingServerSettingsInputs;