[System] grab "Experimental settings"

This commit is contained in:
infinite-persistence 2021-08-07 21:12:07 +08:00
parent 2cda3d0a62
commit c55179998b
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
2 changed files with 44 additions and 57 deletions

View file

@ -6,7 +6,9 @@ import Card from 'component/common/card';
import { FormField } from 'component/common/form'; import { FormField } from 'component/common/form';
import SettingAutoLaunch from 'component/settingAutoLaunch'; import SettingAutoLaunch from 'component/settingAutoLaunch';
import SettingClosingBehavior from 'component/settingClosingBehavior'; import SettingClosingBehavior from 'component/settingClosingBehavior';
import SettingCommentsServer from 'component/settingCommentsServer';
import SettingsRow from 'component/settingsRow'; import SettingsRow from 'component/settingsRow';
import SettingWalletServer from 'component/settingWalletServer';
// @if TARGET='app' // @if TARGET='app'
const IS_MAC = process.platform === 'darwin'; const IS_MAC = process.platform === 'darwin';
@ -98,6 +100,48 @@ export default function SettingSystem(props: Props) {
</SettingsRow> </SettingsRow>
{/* @endif */} {/* @endif */}
{/* @if TARGET='app' */}
<SettingsRow title={__('Experimental settings')} useVerticalSeparator>
{/* Disabling below until we get downloads to work with shared subscriptions code */}
{/*
<FormField
type="checkbox"
name="auto_download"
onChange={() => setClientSetting(SETTINGS.AUTO_DOWNLOAD, !autoDownload)}
checked={autoDownload}
label={__('Automatically download new content from my subscriptions')}
helper={__(
"The latest file from each of your subscriptions will be downloaded for quick access as soon as it's published."
)}
/>
*/}
<fieldset-section>
<FormField
name="max_connections"
type="select"
label={__('Max Connections')}
helper={__(
'For users with good bandwidth, try a higher value to improve streaming and download speeds. Low bandwidth users may benefit from a lower setting. Default is 4.'
)}
min={1}
max={100}
onChange={(e) => setDaemonSetting('max_connections_per_download', e.target.value)}
value={daemonSettings.max_connections_per_download}
>
{[1, 2, 4, 6, 10, 20].map((connectionOption) => (
<option key={connectionOption} value={connectionOption}>
{connectionOption}
</option>
))}
</FormField>
</fieldset-section>
<SettingWalletServer />
<SettingCommentsServer />
</SettingsRow>
{/* @endif */}
<SettingsRow <SettingsRow
title={__('Clear application cache')} title={__('Clear application cache')}
subtitle={__('This might fix issues that you are having. Your wallet will not be affected.')} subtitle={__('This might fix issues that you are having. Your wallet will not be affected.')}

View file

@ -5,8 +5,6 @@ import { FormField } from 'component/common/form';
import Button from 'component/button'; import Button from 'component/button';
import I18nMessage from 'component/i18nMessage'; import I18nMessage from 'component/i18nMessage';
import Page from 'component/page'; import Page from 'component/page';
import SettingCommentsServer from 'component/settingCommentsServer';
import SettingWalletServer from 'component/settingWalletServer';
import FileSelector from 'component/common/file-selector'; import FileSelector from 'component/common/file-selector';
import { SETTINGS } from 'lbry-redux'; import { SETTINGS } from 'lbry-redux';
import Card from 'component/common/card'; import Card from 'component/common/card';
@ -63,7 +61,6 @@ class SettingsAdvancedPage extends React.PureComponent<Props, State> {
storedPassword: false, storedPassword: false,
}; };
(this: any).onMaxConnectionsChange = this.onMaxConnectionsChange.bind(this);
(this: any).onThemeChange = this.onThemeChange.bind(this); (this: any).onThemeChange = this.onThemeChange.bind(this);
(this: any).onAutomaticDarkModeChange = this.onAutomaticDarkModeChange.bind(this); (this: any).onAutomaticDarkModeChange = this.onAutomaticDarkModeChange.bind(this);
(this: any).onConfirmForgetPassword = this.onConfirmForgetPassword.bind(this); (this: any).onConfirmForgetPassword = this.onConfirmForgetPassword.bind(this);
@ -104,11 +101,6 @@ class SettingsAdvancedPage extends React.PureComponent<Props, State> {
this.findFFmpeg(); this.findFFmpeg();
} }
onMaxConnectionsChange(event: SyntheticInputEvent<*>) {
const { value } = event.target;
this.setDaemonSetting('max_connections_per_download', value);
}
onThemeChange(event: SyntheticInputEvent<*>) { onThemeChange(event: SyntheticInputEvent<*>) {
const { value } = event.target; const { value } = event.target;
@ -166,7 +158,6 @@ class SettingsAdvancedPage extends React.PureComponent<Props, State> {
const { storedPassword } = this.state; const { storedPassword } = this.state;
const noDaemonSettings = !daemonSettings || Object.keys(daemonSettings).length === 0; const noDaemonSettings = !daemonSettings || Object.keys(daemonSettings).length === 0;
const connectionOptions = [1, 2, 4, 6, 10, 20];
// @if TARGET='app' // @if TARGET='app'
const { available: ffmpegAvailable, which: ffmpegPath } = ffmpegStatus; const { available: ffmpegAvailable, which: ffmpegPath } = ffmpegStatus;
// @endif // @endif
@ -311,54 +302,6 @@ class SettingsAdvancedPage extends React.PureComponent<Props, State> {
} }
/> />
{/* @endif */} {/* @endif */}
{!IS_WEB && (
<Card
title={__('Experimental settings')}
actions={
<React.Fragment>
{/* @if TARGET='app' */}
{/*
Disabling below until we get downloads to work with shared subscriptions code
<FormField
type="checkbox"
name="auto_download"
onChange={() => setClientSetting(SETTINGS.AUTO_DOWNLOAD, !autoDownload)}
checked={autoDownload}
label={__('Automatically download new content from my subscriptions')}
helper={__(
"The latest file from each of your subscriptions will be downloaded for quick access as soon as it's published."
)}
/> */}
<fieldset-section>
<FormField
name="max_connections"
type="select"
label={__('Max Connections')}
helper={__(
'For users with good bandwidth, try a higher value to improve streaming and download speeds. Low bandwidth users may benefit from a lower setting. Default is 4.'
)}
min={1}
max={100}
onChange={this.onMaxConnectionsChange}
value={daemonSettings.max_connections_per_download}
>
{connectionOptions.map((connectionOption) => (
<option key={connectionOption} value={connectionOption}>
{connectionOption}
</option>
))}
</FormField>
</fieldset-section>
<SettingWalletServer />
{/* @endif */}
</React.Fragment>
}
/>
)}
{/* @if TARGET='app' */}
<Card title={__('Comments server')} actions={<SettingCommentsServer />} />
{/* @endif */}
</div> </div>
)} )}
</Page> </Page>