lbry-desktop/ui/page/settings/view.jsx

846 lines
32 KiB
React
Raw Normal View History

2018-03-26 23:32:43 +02:00
// @flow
2019-08-25 22:43:44 +02:00
/* eslint react/no-unescaped-entities:0 */
/* eslint react/jsx-no-comment-textnodes:0 */
import * as PAGES from 'constants/pages';
import * as MODALS from 'constants/modal_types';
2018-03-26 23:32:43 +02:00
import * as React from 'react';
2019-10-23 20:59:33 +02:00
2019-09-27 22:03:05 +02:00
import { FormField, FormFieldPrice } from 'component/common/form';
2018-03-26 23:32:43 +02:00
import Button from 'component/button';
import I18nMessage from 'component/i18nMessage';
2018-03-26 23:32:43 +02:00
import Page from 'component/page';
import SettingLanguage from 'component/settingLanguage';
import SettingWalletServer from 'component/settingWalletServer';
2019-11-18 19:30:15 +01:00
import SettingAutoLaunch from 'component/settingAutoLaunch';
2018-03-26 23:32:43 +02:00
import FileSelector from 'component/common/file-selector';
2019-10-15 23:23:51 +02:00
import SyncToggle from 'component/syncToggle';
import { SETTINGS } from 'lbry-redux';
2019-09-27 22:03:05 +02:00
import Card from 'component/common/card';
2020-03-17 19:58:34 +01:00
import { getPasswordFromCookie } from 'util/saved-passwords';
import Spinner from 'component/spinner';
import SettingAccountPassword from 'component/settingAccountPassword';
import { Lbryio } from 'lbryinc';
2019-11-18 19:30:15 +01:00
// @if TARGET='app'
export const IS_MAC = process.platform === 'darwin';
// @endif
2019-04-24 16:02:08 +02:00
type Price = {
2018-03-26 23:32:43 +02:00
currency: string,
amount: number,
};
type SetDaemonSettingArg = boolean | string | number | Price;
2019-08-18 19:01:04 +02:00
type DarkModeTimes = {
from: { hour: string, min: string, formattedTime: string },
to: { hour: string, min: string, formattedTime: string },
};
type OptionTimes = {
fromTo: string,
time: string,
};
2018-03-26 23:32:43 +02:00
type DaemonSettings = {
download_dir: string,
2018-03-26 23:32:43 +02:00
share_usage_data: boolean,
2018-10-13 17:49:47 +02:00
max_key_fee?: Price,
2019-08-02 08:28:14 +02:00
max_connections_per_download?: number,
save_files: boolean,
save_blobs: boolean,
ffmpeg_path: string,
2018-03-26 23:32:43 +02:00
};
type Props = {
setDaemonSetting: (string, ?SetDaemonSettingArg) => void,
clearDaemonSetting: string => void,
setClientSetting: (string, SetDaemonSettingArg) => void,
toggle3PAnalytics: boolean => void,
2018-03-26 23:32:43 +02:00
clearCache: () => Promise<any>,
daemonSettings: DaemonSettings,
allowAnalytics: boolean,
2018-03-26 23:32:43 +02:00
showNsfw: boolean,
2019-11-22 22:13:00 +01:00
isAuthenticated: boolean,
2018-03-26 23:32:43 +02:00
instantPurchaseEnabled: boolean,
instantPurchaseMax: Price,
currentTheme: string,
themes: Array<string>,
automaticDarkModeEnabled: boolean,
2018-05-30 05:18:41 +02:00
autoplay: boolean,
2019-10-15 06:20:12 +02:00
// autoDownload: boolean,
2018-07-18 21:48:30 +02:00
encryptWallet: () => void,
decryptWallet: () => void,
2018-10-13 17:49:47 +02:00
updateWalletStatus: () => void,
2018-07-18 21:48:30 +02:00
walletEncrypted: boolean,
osNotificationsEnabled: boolean,
supportOption: boolean,
userBlockedChannelsCount?: number,
hideBalance: boolean,
confirmForgetPassword: ({}) => void,
2019-08-13 07:35:13 +02:00
floatingPlayer: boolean,
hideReposts: ?boolean,
2019-08-13 07:35:13 +02:00
clearPlayingUri: () => void,
2019-08-18 19:01:04 +02:00
darkModeTimes: DarkModeTimes,
2019-08-18 18:54:55 +02:00
setDarkTime: (string, {}) => void,
ffmpegStatus: { available: boolean, which: string },
findingFFmpeg: boolean,
findFFmpeg: () => void,
openModal: string => void,
2018-03-26 23:32:43 +02:00
};
type State = {
clearingCache: boolean,
2019-08-20 14:29:59 +02:00
storedPassword: boolean,
2018-03-26 23:32:43 +02:00
};
class SettingsPage extends React.PureComponent<Props, State> {
constructor(props: Props) {
2017-05-17 10:10:25 +02:00
super(props);
this.state = {
clearingCache: false,
2019-08-20 14:29:59 +02:00
storedPassword: false,
2017-06-06 23:19:12 +02:00
};
2018-03-26 23:32:43 +02:00
(this: any).onKeyFeeChange = this.onKeyFeeChange.bind(this);
2019-08-02 08:28:14 +02:00
(this: any).onMaxConnectionsChange = this.onMaxConnectionsChange.bind(this);
(this: any).onKeyFeeDisableChange = this.onKeyFeeDisableChange.bind(this);
2018-03-26 23:32:43 +02:00
(this: any).onInstantPurchaseMaxChange = this.onInstantPurchaseMaxChange.bind(this);
(this: any).onThemeChange = this.onThemeChange.bind(this);
(this: any).onAutomaticDarkModeChange = this.onAutomaticDarkModeChange.bind(this);
2019-08-18 18:54:55 +02:00
(this: any).onChangeTime = this.onChangeTime.bind(this);
2019-08-28 04:35:07 +02:00
(this: any).onConfirmForgetPassword = this.onConfirmForgetPassword.bind(this);
}
2018-03-26 23:32:43 +02:00
componentDidMount() {
const { isAuthenticated, ffmpegStatus, daemonSettings, findFFmpeg } = this.props;
// @if TARGET='app'
const { available } = ffmpegStatus;
const { ffmpeg_path: ffmpegPath } = daemonSettings;
if (!available) {
if (ffmpegPath) {
this.clearDaemonSetting('ffmpeg_path');
}
findFFmpeg();
}
// @endif
if (isAuthenticated || !IS_WEB) {
this.props.updateWalletStatus();
2020-03-17 19:58:34 +01:00
getPasswordFromCookie().then(p => {
if (typeof p === 'string') {
this.setState({ storedPassword: true });
}
});
}
2017-05-17 10:10:25 +02:00
}
onFFmpegFolder(path: string) {
this.setDaemonSetting('ffmpeg_path', path);
this.findFFmpeg();
}
2018-03-26 23:32:43 +02:00
onKeyFeeChange(newValue: Price) {
this.setDaemonSetting('max_key_fee', newValue);
2017-05-17 10:10:25 +02:00
}
2019-08-02 08:28:14 +02:00
onMaxConnectionsChange(event: SyntheticInputEvent<*>) {
const { value } = event.target;
this.setDaemonSetting('max_connections_per_download', value);
}
2018-03-26 23:32:43 +02:00
onKeyFeeDisableChange(isDisabled: boolean) {
if (isDisabled) this.setDaemonSetting('max_key_fee');
2017-05-17 10:10:25 +02:00
}
2018-03-26 23:32:43 +02:00
onThemeChange(event: SyntheticInputEvent<*>) {
const { value } = event.target;
if (value === 'dark') {
this.onAutomaticDarkModeChange(false);
}
2018-11-26 02:21:25 +01:00
this.props.setClientSetting(SETTINGS.THEME, value);
2017-08-05 03:36:36 +02:00
}
2018-03-26 23:32:43 +02:00
onAutomaticDarkModeChange(value: boolean) {
2018-11-26 02:21:25 +01:00
this.props.setClientSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED, value);
2018-01-14 10:14:15 +01:00
}
2018-03-26 23:32:43 +02:00
onInstantPurchaseEnabledChange(enabled: boolean) {
2018-11-26 02:21:25 +01:00
this.props.setClientSetting(SETTINGS.INSTANT_PURCHASE_ENABLED, enabled);
}
2018-03-26 23:32:43 +02:00
onInstantPurchaseMaxChange(newValue: Price) {
2018-11-26 02:21:25 +01:00
this.props.setClientSetting(SETTINGS.INSTANT_PURCHASE_MAX, newValue);
}
2018-07-18 21:48:30 +02:00
onChangeEncryptWallet() {
2018-10-13 17:49:47 +02:00
const { decryptWallet, walletEncrypted, encryptWallet } = this.props;
if (walletEncrypted) {
decryptWallet();
} else {
encryptWallet();
}
}
2019-08-20 14:29:59 +02:00
onConfirmForgetPassword() {
const { confirmForgetPassword } = this.props;
confirmForgetPassword({
callback: () => {
this.setState({ storedPassword: false });
},
});
2019-08-20 14:29:59 +02:00
}
2019-08-18 19:01:04 +02:00
onChangeTime(event: SyntheticInputEvent<*>, options: OptionTimes) {
2019-08-18 18:54:55 +02:00
const { value } = event.target;
this.props.setDarkTime(value, options);
}
to12Hour(time: string) {
const now = new Date(0, 0, 0, Number(time));
const hour = now.toLocaleTimeString('en-US', { hour12: true, hour: '2-digit' });
return hour;
}
setDaemonSetting(name: string, value: ?SetDaemonSettingArg): void {
2018-10-13 17:49:47 +02:00
this.props.setDaemonSetting(name, value);
}
clearDaemonSetting(name: string): void {
this.props.clearDaemonSetting(name);
}
findFFmpeg(): void {
this.props.findFFmpeg();
}
2017-05-17 10:10:25 +02:00
render() {
2017-09-07 03:53:42 +02:00
const {
daemonSettings,
ffmpegStatus,
allowAnalytics,
2017-09-07 03:53:42 +02:00
showNsfw,
instantPurchaseEnabled,
instantPurchaseMax,
2019-11-22 22:13:00 +01:00
isAuthenticated,
2018-03-26 23:32:43 +02:00
currentTheme,
2017-09-07 03:53:42 +02:00
themes,
2018-01-14 10:14:15 +01:00
automaticDarkModeEnabled,
2018-05-30 05:18:41 +02:00
autoplay,
2018-07-18 21:48:30 +02:00
walletEncrypted,
osNotificationsEnabled,
2019-10-15 06:20:12 +02:00
// autoDownload,
2019-02-13 17:27:20 +01:00
setDaemonSetting,
setClientSetting,
toggle3PAnalytics,
supportOption,
hideBalance,
userBlockedChannelsCount,
2019-08-13 07:35:13 +02:00
floatingPlayer,
hideReposts,
2019-08-14 05:04:08 +02:00
clearPlayingUri,
2019-08-18 18:54:55 +02:00
darkModeTimes,
clearCache,
findingFFmpeg,
openModal,
2017-09-07 03:53:42 +02:00
} = this.props;
const { storedPassword } = this.state;
2018-03-26 23:32:43 +02:00
const noDaemonSettings = !daemonSettings || Object.keys(daemonSettings).length === 0;
// @if TARGET='app'
const { available: ffmpegAvailable, which: ffmpegPath } = ffmpegStatus;
// @endif
const defaultMaxKeyFee = { currency: 'USD', amount: 50 };
2019-08-02 08:28:14 +02:00
const disableMaxKeyFee = !(daemonSettings && daemonSettings.max_key_fee);
2019-08-13 07:35:13 +02:00
const connectionOptions = [1, 2, 4, 6, 10, 20];
2019-08-18 18:54:55 +02:00
const startHours = ['18', '19', '20', '21'];
const endHours = ['5', '6', '7', '8'];
2016-04-10 02:00:56 +02:00
return (
<Page className="card-stack">
2019-08-26 20:32:45 +02:00
{!IS_WEB && noDaemonSettings ? (
2018-03-26 23:32:43 +02:00
<section className="card card--section">
Changed how 'Blocked channels' are displayed on settings and a small typo Problems solved (second attempt): A. Small typo for <div className="card__title card__t itle--deprecated"> (extra space in the word **t itle**) B. More details about problems with languages: 1. The word blocked has two forms in other languages (one for plural and one for singular) and therefore must be put together with channel and channels words. Currently it can be translated in only one form. 2. In the case there are no blocked channels there is no need to show the 0 value and is more elegant the message 'You do not have blocked channels' 3. The link to manage the channels should not be visible in the case that there is no channel blocked, because there is no channel that need to be managed. And about your statement: "Your change would make it harder for other languages to change this sentence." It's quite the opossite, it's very clear and easy. They just have to translate (with examples in Romanian): '%count% %channels%. ', (leave it as it is) 'You don't have' = 'Nu aveți' 'You have' = 'Aveți' 'blocked channel' = 'canal blocat' 'blocked channels' = 'canale blocat**e**' (see the change for plural forms for the word blocked, not only for channels word?) I hope this time I explained better the need for the changes. Thanks Messages displayed: Case with 0 blocked channels: You don't have blocked channels. (No Manage button displayed) Case with 1 blocked channel: You have 1 blocked channel. **Manage** (manage link) Case with 2 or more blocked channels: You have 2 blocked channels. **Manage** (manage link)
2020-05-18 23:17:26 +02:00
<div className="card__title card__title--deprecated">{__('Failed to load settings.')}</div>
2018-03-26 23:32:43 +02:00
</section>
) : (
2019-08-22 23:14:51 +02:00
<div>
2019-09-27 22:03:05 +02:00
<Card title={__('Language')} actions={<SettingLanguage />} />
{isAuthenticated && <SettingAccountPassword />}
2019-10-23 20:59:33 +02:00
{/* @if TARGET='app' */}
<Card
title={__('Sync')}
subtitle={
walletEncrypted && !storedPassword
? __("To enable this feature, check 'Save Password' the next time you start the app.")
: null
}
actions={<SyncToggle disabled={walletEncrypted && !storedPassword} />}
/>
2019-09-27 22:03:05 +02:00
<Card
title={__('Download Directory')}
actions={
<React.Fragment>
<FileSelector
type="openDirectory"
currentPath={daemonSettings.download_dir}
onFileChosen={(newDirectory: WebFile) => {
setDaemonSetting('download_dir', newDirectory.path);
2019-09-27 22:03:05 +02:00
}}
/>
<p className="help">{__('LBRY downloads will be saved here.')}</p>
</React.Fragment>
}
/>
<Card
title={__('Network and Data Settings')}
actions={
<React.Fragment>
<FormField
type="checkbox"
name="save_files"
onChange={() => setDaemonSetting('save_files', !daemonSettings.save_files)}
checked={daemonSettings.save_files}
label={__('Save all viewed content to your downloads directory')}
helper={__(
'Paid content and some file types are saved by default. Changing this setting will not affect previously downloaded content.'
)}
/>
2019-09-27 22:03:05 +02:00
<FormField
type="checkbox"
name="save_blobs"
onChange={() => setDaemonSetting('save_blobs', !daemonSettings.save_blobs)}
checked={daemonSettings.save_blobs}
label={__('Save hosting data to help the LBRY network')}
helper={
<React.Fragment>
{__("If disabled, LBRY will be very sad and you won't be helping improve the network.")}{' '}
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/host-content" />.
</React.Fragment>
}
/>
</React.Fragment>
}
/>
<Card
title={__('Max Purchase Price')}
actions={
<React.Fragment>
<FormField
type="radio"
name="no_max_purchase_no_limit"
checked={disableMaxKeyFee}
label={__('No Limit')}
onChange={() => {
this.onKeyFeeDisableChange(true);
}}
/>
<FormField
type="radio"
name="max_purchase_limit"
checked={!disableMaxKeyFee}
onChange={() => {
this.onKeyFeeDisableChange(false);
this.onKeyFeeChange(defaultMaxKeyFee);
}}
label={__('Choose limit')}
/>
2019-02-13 17:27:20 +01:00
2019-09-27 22:03:05 +02:00
{!disableMaxKeyFee && (
<FormFieldPrice
name="max_key_fee"
min={0}
onChange={this.onKeyFeeChange}
price={daemonSettings.max_key_fee ? daemonSettings.max_key_fee : defaultMaxKeyFee}
/>
)}
<p className="help">
{__('This will prevent you from purchasing any content over a certain cost, as a safety measure.')}
</p>
</React.Fragment>
}
/>
{/* @endif */}
2019-09-27 22:03:05 +02:00
<Card
title={__('Purchase and Tip Confirmations')}
2019-09-27 22:03:05 +02:00
actions={
<React.Fragment>
<FormField
type="radio"
name="confirm_all_purchases"
checked={!instantPurchaseEnabled}
label={__('Always confirm before purchasing content or tipping')}
2019-09-27 22:03:05 +02:00
onChange={() => {
this.onInstantPurchaseEnabledChange(false);
}}
/>
<FormField
type="radio"
name="instant_purchases"
checked={instantPurchaseEnabled}
label={__('Only confirm purchases or tips over a certain amount')}
2019-09-27 22:03:05 +02:00
onChange={() => {
this.onInstantPurchaseEnabledChange(true);
}}
2018-04-11 00:05:30 +02:00
/>
2019-09-27 22:03:05 +02:00
{instantPurchaseEnabled && (
<FormFieldPrice
name="confirmation_price"
min={0.1}
onChange={this.onInstantPurchaseMaxChange}
price={instantPurchaseMax}
/>
)}
2019-09-27 22:03:05 +02:00
<p className="help">
{__(
"When this option is chosen, LBRY won't ask you to confirm downloads or tips below your chosen amount."
)}
2019-09-27 22:03:05 +02:00
</p>
</React.Fragment>
}
/>
<Card
title={__('Content Settings')}
actions={
<React.Fragment>
<FormField
type="checkbox"
name="floating_player"
onChange={() => {
setClientSetting(SETTINGS.FLOATING_PLAYER, !floatingPlayer);
clearPlayingUri();
}}
checked={floatingPlayer}
label={__('Floating video player')}
helper={__('Keep content playing in the corner when navigating to a different page.')}
/>
2019-02-20 06:20:29 +01:00
2019-09-27 22:03:05 +02:00
<FormField
type="checkbox"
name="autoplay"
onChange={() => setClientSetting(SETTINGS.AUTOPLAY, !autoplay)}
checked={autoplay}
label={__('Autoplay media files')}
helper={__(
'Autoplay video and audio files when navigating to a file, as well as the next related item when a file finishes playing.'
)}
2018-04-11 00:05:30 +02:00
/>
<FormField
2020-02-20 13:30:27 +01:00
type="checkbox"
name="hide_reposts"
onChange={e => {
if (isAuthenticated) {
let param = e.target.checked ? { add: 'noreposts' } : { remove: 'noreposts' };
Lbryio.call('user_tag', 'edit', param);
}
setClientSetting(SETTINGS.HIDE_REPOSTS, !hideReposts);
2020-02-20 13:30:27 +01:00
}}
checked={hideReposts}
label={__('Hide reposts')}
helper={__('You will not see reposts by people you follow or receive email notifying about them.')}
/>
2020-02-20 13:30:27 +01:00
2019-10-17 18:58:28 +02:00
{/* <FormField
2019-10-08 18:25:33 +02:00
type="checkbox"
name="show_anonymous"
onChange={() => setClientSetting(SETTINGS.SHOW_ANONYMOUS, !showAnonymous)}
checked={showAnonymous}
label={__('Show anonymous content')}
2019-10-15 19:29:27 +02:00
helper={__('Anonymous content is published without a channel.')}
2019-10-17 18:58:28 +02:00
/> */}
2019-10-08 18:25:33 +02:00
2019-09-27 22:03:05 +02:00
<FormField
type="checkbox"
name="show_nsfw"
onChange={() =>
!IS_WEB || showNsfw
? setClientSetting(SETTINGS.SHOW_MATURE, !showNsfw)
: openModal(MODALS.CONFIRM_AGE)
}
2019-09-27 22:03:05 +02:00
checked={showNsfw}
label={__('Show mature content')}
helper={__(
'Mature content may include nudity, intense sexuality, profanity, or other adult content. By displaying mature content, you are affirming you are of legal age to view mature content in your country or jurisdiction. '
)}
/>
</React.Fragment>
}
/>
{(isAuthenticated || !IS_WEB) && (
2019-11-22 22:13:00 +01:00
<Card
title={__('Blocked Channels')}
actions={
<p>
<React.Fragment>
{
userBlockedChannelsCount === 0 ? __("You don't have blocked channels.")
: userBlockedChannelsCount === 1 ? __('You have one blocked channel.') +' '
: __('You have %channels% blocked channels.', {channels: userBlockedChannelsCount})+' '
}
{
<Button
button="link"
label={userBlockedChannelsCount === 0 ? null : __('Manage')}
navigate={`/$/${PAGES.BLOCKED}`}
/>
}
</React.Fragment>
</p>
2019-11-22 22:13:00 +01:00
}
/>
)}
2019-09-27 22:03:05 +02:00
2019-08-26 20:32:45 +02:00
{/* @if TARGET='app' */}
2019-09-27 22:03:05 +02:00
<Card
title={__('Notifications')}
actions={
2019-08-25 22:43:44 +02:00
<FormField
type="checkbox"
name="desktopNotification"
onChange={() => setClientSetting(SETTINGS.OS_NOTIFICATIONS_ENABLED, !osNotificationsEnabled)}
checked={osNotificationsEnabled}
label={__('Show Desktop Notifications')}
helper={__('Get notified when a publish is confirmed, or when new content is available to watch.')}
/>
2019-09-27 22:03:05 +02:00
}
/>
<Card
title={__('Share Usage and Diagnostic Data')}
subtitle={
<React.Fragment>
{__(
`This is information like error logging, performance tracking, and usage statistics. It includes your IP address and basic system details, but no other identifying information (unless you sign in to lbry.tv)`
)}{' '}
<Button button="link" label={__('Learn more')} href="https://lbry.com/privacypolicy" />
</React.Fragment>
}
2019-09-27 22:03:05 +02:00
actions={
<>
<FormField
type="checkbox"
name="share_internal"
onChange={() => setDaemonSetting('share_usage_data', !daemonSettings.share_usage_data)}
checked={daemonSettings.share_usage_data}
label={<React.Fragment>{__('Allow the app to share data to LBRY.inc')}</React.Fragment>}
helper={
isAuthenticated
? __('Internal sharing is required while signed in.')
: __('Internal sharing is required to participate in rewards programs.')
}
disabled={isAuthenticated && daemonSettings.share_usage_data}
/>
<FormField
type="checkbox"
name="share_third_party"
onChange={e => toggle3PAnalytics(e.target.checked)}
checked={allowAnalytics}
2020-02-24 22:39:00 +01:00
label={__('Allow the app to access third party analytics platforms')}
helper={__('We use detailed analytics to improve all aspects of the LBRY experience.')}
/>
</>
2019-09-27 22:03:05 +02:00
}
/>
2019-08-26 20:32:45 +02:00
{/* @endif */}
2019-09-27 22:03:05 +02:00
<Card
title={__('Appearance')}
actions={
<React.Fragment>
<fieldset-section>
<FormField
name="theme_select"
type="select"
label={__('Theme')}
onChange={this.onThemeChange}
value={currentTheme}
disabled={automaticDarkModeEnabled}
>
{themes.map(theme => (
<option key={theme} value={theme}>
2019-10-24 23:41:18 +02:00
{theme === 'light' ? __('Light') : __('Dark')}
2019-09-27 22:03:05 +02:00
</option>
))}
</FormField>
</fieldset-section>
<fieldset-section>
<FormField
type="checkbox"
name="automatic_dark_mode"
onChange={() => this.onAutomaticDarkModeChange(!automaticDarkModeEnabled)}
checked={automaticDarkModeEnabled}
label={__('Automatic dark mode')}
/>
{automaticDarkModeEnabled && (
<fieldset-group class="fieldset-group--smushed">
<FormField
type="select"
name="automatic_dark_mode_range"
onChange={value => this.onChangeTime(value, { fromTo: 'from', time: 'hour' })}
value={darkModeTimes.from.hour}
label={__('From')}
>
{startHours.map(time => (
<option key={time} value={time}>
{this.to12Hour(time)}
</option>
))}
</FormField>
<FormField
type="select"
name="automatic_dark_mode_range"
label={__('To')}
onChange={value => this.onChangeTime(value, { fromTo: 'to', time: 'hour' })}
value={darkModeTimes.to.hour}
>
{endHours.map(time => (
<option key={time} value={time}>
{this.to12Hour(time)}
</option>
))}
</FormField>
</fieldset-group>
)}
</fieldset-section>
</React.Fragment>
}
/>
2019-11-22 22:13:00 +01:00
{(isAuthenticated || !IS_WEB) && (
<Card
title={__('Wallet Security')}
actions={
<React.Fragment>
{/* @if TARGET='app' */}
<FormField
disabled
type="checkbox"
name="encrypt_wallet"
onChange={() => this.onChangeEncryptWallet()}
checked={walletEncrypted}
label={__('Encrypt my wallet with a custom password')}
helper={
<React.Fragment>
<I18nMessage
tokens={{
learn_more: (
<Button
button="link"
label={__('Learn more')}
href="https://lbry.com/faq/account-sync"
/>
),
}}
>
Wallet encryption is currently unavailable until it's supported for synced accounts. It will
be added back soon. %learn_more%.
</I18nMessage>
{/* {__('Secure your local wallet data with a custom password.')}{' '}
<strong>{__('Lost passwords cannot be recovered.')} </strong>
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/wallet-encryption" />. */}
</React.Fragment>
}
/>
{walletEncrypted && this.state.storedPassword && (
<FormField
type="checkbox"
name="save_password"
onChange={this.onConfirmForgetPassword}
checked={this.state.storedPassword}
label={__('Save Password')}
helper={<React.Fragment>{__('Automatically unlock your wallet on startup')}</React.Fragment>}
/>
)}
{/* @endif */}
<FormField
type="checkbox"
name="hide_balance"
onChange={() => setClientSetting(SETTINGS.HIDE_BALANCE, !hideBalance)}
checked={hideBalance}
label={__('Hide wallet balance in header')}
/>
</React.Fragment>
}
/>
)}
{/* @if TARGET='app' */}
<Card
title={
<span>
{__('Experimental Transcoding')}
{findingFFmpeg && <Spinner type="small" />}
</span>
}
actions={
<React.Fragment>
<FileSelector
type="openDirectory"
placeholder={__('A Folder containing FFmpeg')}
currentPath={ffmpegPath || daemonSettings.ffmpeg_path}
onFileChosen={(newDirectory: WebFile) => {
this.onFFmpegFolder(newDirectory.path);
}}
disabled={Boolean(ffmpegPath)}
/>
<p className="help">
{ffmpegAvailable ? (
<I18nMessage
tokens={{
learn_more: (
<Button
button="link"
label={__('Learn more')}
href="https://lbry.com/faq/video-publishing-guide#automatic"
/>
),
}}
>
FFmpeg is correctly configured. %learn_more%
</I18nMessage>
) : (
<I18nMessage
tokens={{
check_again: (
<Button
button="link"
label={__('Check again')}
onClick={() => this.findFFmpeg()}
disabled={findingFFmpeg}
/>
),
learn_more: (
<Button
button="link"
label={__('Learn more')}
href="https://lbry.com/faq/video-publishing-guide#automatic"
/>
),
}}
>
FFmpeg could not be found. Navigate to it or Install, Then %check_again% or quit and restart the
app. %learn_more%
</I18nMessage>
)}
</p>
</React.Fragment>
}
/>
{/* @endif */}
2019-11-22 22:13:00 +01:00
{(!IS_WEB || isAuthenticated) && (
<Card
title={__('Experimental Settings')}
actions={
<React.Fragment>
<FormField
type="checkbox"
name="support_option"
onChange={() => setClientSetting(SETTINGS.SUPPORT_OPTION, !supportOption)}
checked={supportOption}
label={__('Enable claim support')}
helper={
2019-10-03 23:40:54 +02:00
<I18nMessage
tokens={{
2019-11-22 22:13:00 +01:00
discovery_link: (
<Button button="link" label={__('discovery')} href="https://lbry.com/faq/trending" />
),
vanity_names_link: (
<Button button="link" label={__('vanity names')} href="https://lbry.com/faq/naming" />
2019-10-03 23:40:54 +02:00
),
}}
>
2019-11-22 22:13:00 +01:00
This will add a Support button along side tipping. Similar to tips, supports help
%discovery_link% but the LBC is returned to your wallet if revoked. Both also help secure your
%vanity_names_link%.
2019-10-03 23:40:54 +02:00
</I18nMessage>
2019-11-22 22:13:00 +01:00
}
2019-09-27 22:03:05 +02:00
/>
2019-11-22 22:13:00 +01:00
{/* @if TARGET='app' */}
{/*
2019-10-15 17:47:43 +02:00
Disabling below until we get downloads to work with shared subscriptions code
<FormField
2019-09-27 22:03:05 +02:00
type="checkbox"
name="auto_download"
onChange={() => setClientSetting(SETTINGS.AUTO_DOWNLOAD, !autoDownload)}
checked={autoDownload}
label={__('Automatically download new content from my subscriptions')}
2019-08-13 07:35:13 +02:00
helper={__(
2019-09-27 22:03:05 +02:00
"The latest file from each of your subscriptions will be downloaded for quick access as soon as it's published."
2019-08-13 07:35:13 +02:00
)}
2019-10-15 06:20:12 +02:00
/> */}
2019-11-22 22:13:00 +01:00
<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>
2019-12-12 21:18:13 +01:00
<SettingWalletServer />
{/* @endif */}
2019-11-22 22:13:00 +01:00
</React.Fragment>
}
/>
)}
2019-09-27 22:03:05 +02:00
2019-11-18 19:30:15 +01:00
{/* @if TARGET='app' */}
{/* Auto launch in a hidden state doesn't work on mac https://github.com/Teamwork/node-auto-launch/issues/81 */}
{!IS_MAC && <Card title={__('Startup Preferences')} actions={<SettingAutoLaunch />} />}
{/* @endif */}
2019-09-27 22:03:05 +02:00
<Card
title={__('Application Cache')}
subtitle={
2019-11-22 22:13:00 +01:00
<p className="section__subtitle">
2019-09-27 22:03:05 +02:00
{__(
2019-11-22 22:13:00 +01:00
'This will clear the application cache, and might fix issues you are having. Your wallet will not be affected. '
2019-09-27 22:03:05 +02:00
)}
2019-10-16 03:14:21 +02:00
</p>
2019-09-27 22:03:05 +02:00
}
actions={
<Button
2019-11-22 22:13:00 +01:00
button="secondary"
2019-09-27 22:03:05 +02:00
label={this.state.clearingCache ? __('Clearing') : __('Clear Cache')}
onClick={clearCache}
2019-09-27 22:03:05 +02:00
disabled={this.state.clearingCache}
/>
}
/>
2019-03-18 06:06:41 +01:00
</div>
2018-03-26 23:32:43 +02:00
)}
</Page>
2016-04-10 02:00:56 +02:00
);
}
2017-05-17 10:10:25 +02:00
}
2016-11-22 21:19:08 +01:00
export default SettingsPage;