2017-12-21 22:08:54 +01:00
|
|
|
// @TODO: Customize advice based on OS
|
2018-06-10 00:33:23 +02:00
|
|
|
// @flow
|
2018-12-19 06:44:53 +01:00
|
|
|
import * as icons from 'constants/icons';
|
2018-06-10 00:33:23 +02:00
|
|
|
import * as React from 'react';
|
2019-03-05 05:46:57 +01:00
|
|
|
// @if TARGET='app'
|
2018-06-09 05:38:09 +02:00
|
|
|
import { shell } from 'electron';
|
2020-03-23 17:06:43 +01:00
|
|
|
import WalletBackup from 'component/walletBackup';
|
2019-03-05 05:46:57 +01:00
|
|
|
// @endif
|
2018-04-18 06:03:01 +02:00
|
|
|
import { Lbry } from 'lbry-redux';
|
2018-06-10 01:22:36 +02:00
|
|
|
import Native from 'native';
|
2018-03-26 23:32:43 +02:00
|
|
|
import Button from 'component/button';
|
|
|
|
import Page from 'component/page';
|
2019-09-27 22:03:05 +02:00
|
|
|
import Card from 'component/common/card';
|
2019-10-01 06:53:33 +02:00
|
|
|
import I18nMessage from 'component/i18nMessage';
|
2016-04-24 11:00:13 +02:00
|
|
|
|
2018-06-10 00:33:23 +02:00
|
|
|
type DeamonSettings = {
|
2018-06-10 01:19:04 +02:00
|
|
|
data_dir: string | any,
|
2018-06-10 00:33:23 +02:00
|
|
|
};
|
|
|
|
|
2018-06-09 05:38:09 +02:00
|
|
|
type Props = {
|
2018-06-10 00:33:23 +02:00
|
|
|
deamonSettings: DeamonSettings,
|
|
|
|
accessToken: string,
|
|
|
|
fetchAccessToken: () => void,
|
|
|
|
doAuth: () => void,
|
|
|
|
user: any,
|
|
|
|
};
|
|
|
|
|
2018-06-10 01:19:04 +02:00
|
|
|
type VersionInfo = {
|
|
|
|
os_system: string,
|
|
|
|
os_release: string,
|
|
|
|
platform: string,
|
|
|
|
lbrynet_version: string,
|
|
|
|
};
|
|
|
|
|
2018-06-10 00:33:23 +02:00
|
|
|
type State = {
|
2018-06-10 01:19:04 +02:00
|
|
|
versionInfo: VersionInfo | any,
|
2018-06-10 01:20:29 +02:00
|
|
|
lbryId: String | any,
|
2018-06-10 01:19:04 +02:00
|
|
|
uiVersion: ?string,
|
|
|
|
upgradeAvailable: ?boolean,
|
|
|
|
accessTokenHidden: ?boolean,
|
2018-06-09 05:38:09 +02:00
|
|
|
};
|
|
|
|
|
2018-06-10 00:33:23 +02:00
|
|
|
class HelpPage extends React.PureComponent<Props, State> {
|
|
|
|
constructor(props: Props) {
|
2017-05-17 10:10:25 +02:00
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
2016-08-22 11:42:01 +02:00
|
|
|
versionInfo: null,
|
2016-11-30 06:23:57 +01:00
|
|
|
lbryId: null,
|
2017-05-31 18:22:50 +02:00
|
|
|
uiVersion: null,
|
2017-06-06 23:19:12 +02:00
|
|
|
upgradeAvailable: null,
|
2017-07-21 08:23:39 +02:00
|
|
|
accessTokenHidden: true,
|
2016-08-22 11:42:01 +02:00
|
|
|
};
|
2018-03-26 23:32:43 +02:00
|
|
|
|
2018-06-10 00:33:23 +02:00
|
|
|
(this: any).showAccessToken = this.showAccessToken.bind(this);
|
|
|
|
(this: any).openLogFile = this.openLogFile.bind(this);
|
2017-05-17 10:10:25 +02:00
|
|
|
}
|
|
|
|
|
2018-03-26 23:32:43 +02:00
|
|
|
componentDidMount() {
|
2019-03-07 22:46:15 +01:00
|
|
|
// @if TARGET='app'
|
2018-06-10 00:33:23 +02:00
|
|
|
Native.getAppVersionInfo().then(({ localVersion, upgradeAvailable }) => {
|
2017-12-21 22:08:54 +01:00
|
|
|
this.setState({
|
|
|
|
uiVersion: localVersion,
|
|
|
|
upgradeAvailable,
|
2016-08-22 11:42:01 +02:00
|
|
|
});
|
2017-12-21 22:08:54 +01:00
|
|
|
});
|
2019-03-07 22:46:15 +01:00
|
|
|
if (!this.props.accessToken) this.props.fetchAccessToken();
|
|
|
|
// @endif
|
|
|
|
|
2018-04-18 06:03:01 +02:00
|
|
|
Lbry.version().then(info => {
|
2017-05-25 20:29:28 +02:00
|
|
|
this.setState({
|
2017-06-06 23:19:12 +02:00
|
|
|
versionInfo: info,
|
|
|
|
});
|
|
|
|
});
|
2018-08-13 18:38:52 +02:00
|
|
|
Lbry.status().then(info => {
|
2016-11-30 06:23:57 +01:00
|
|
|
this.setState({
|
2018-08-13 18:53:31 +02:00
|
|
|
lbryId: info.installation_id,
|
2016-11-30 06:23:57 +01:00
|
|
|
});
|
|
|
|
});
|
2017-07-21 08:23:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
showAccessToken() {
|
|
|
|
this.setState({
|
|
|
|
accessTokenHidden: false,
|
|
|
|
});
|
2017-05-17 10:10:25 +02:00
|
|
|
}
|
|
|
|
|
2018-06-10 00:33:23 +02:00
|
|
|
openLogFile(userHomeDirectory: string) {
|
|
|
|
const logFileName = 'lbrynet.log';
|
|
|
|
const os = this.state.versionInfo.os_system;
|
|
|
|
if (os === 'Darwin' || os === 'Linux') {
|
|
|
|
shell.openItem(`${userHomeDirectory}/${logFileName}`);
|
|
|
|
} else {
|
|
|
|
shell.openItem(`${userHomeDirectory}\\${logFileName}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-17 10:10:25 +02:00
|
|
|
render() {
|
2018-04-18 06:03:01 +02:00
|
|
|
let ver;
|
|
|
|
let osName;
|
|
|
|
let platform;
|
|
|
|
let newVerLink;
|
2017-05-22 00:34:12 +02:00
|
|
|
|
2018-06-09 05:38:09 +02:00
|
|
|
const { accessToken, doAuth, user, deamonSettings } = this.props;
|
|
|
|
const { data_dir: dataDirectory } = deamonSettings;
|
2017-05-22 00:34:12 +02:00
|
|
|
|
2016-11-24 01:55:36 +01:00
|
|
|
if (this.state.versionInfo) {
|
|
|
|
ver = this.state.versionInfo;
|
2018-04-18 06:03:01 +02:00
|
|
|
if (ver.os_system === 'Darwin') {
|
|
|
|
osName = parseInt(ver.os_release.match(/^\d+/), 10) < 16 ? 'Mac OS X' : 'Mac OS';
|
2016-08-22 11:42:01 +02:00
|
|
|
|
2017-06-06 23:19:12 +02:00
|
|
|
platform = `${osName} ${ver.os_release}`;
|
2019-03-20 22:43:00 +01:00
|
|
|
newVerLink = 'https://lbry.com/get/lbry.dmg';
|
2020-01-15 05:34:28 +01:00
|
|
|
} else if (process.env.APPIMAGE !== undefined) {
|
|
|
|
platform = `Linux (AppImage)`;
|
|
|
|
newVerLink = 'https://lbry.com/get/lbry.AppImage';
|
2018-04-18 06:03:01 +02:00
|
|
|
} else if (ver.os_system === 'Linux') {
|
2016-11-24 01:55:36 +01:00
|
|
|
platform = `Linux (${ver.platform})`;
|
2019-03-20 22:43:00 +01:00
|
|
|
newVerLink = 'https://lbry.com/get/lbry.deb';
|
2016-08-22 11:42:01 +02:00
|
|
|
} else {
|
2016-11-24 01:55:36 +01:00
|
|
|
platform = `Windows (${ver.platform})`;
|
2019-03-20 22:43:00 +01:00
|
|
|
newVerLink = 'https://lbry.com/get/lbry.msi';
|
2016-08-27 00:06:22 +02:00
|
|
|
}
|
2016-11-24 01:55:36 +01:00
|
|
|
} else {
|
|
|
|
ver = null;
|
2016-08-22 11:42:01 +02:00
|
|
|
}
|
2016-08-27 00:06:22 +02:00
|
|
|
|
2016-04-20 12:28:13 +02:00
|
|
|
return (
|
2020-04-01 20:43:50 +02:00
|
|
|
<Page className="card-stack">
|
2019-09-27 22:03:05 +02:00
|
|
|
<Card
|
|
|
|
title={__('Read the FAQ')}
|
|
|
|
subtitle={__('Our FAQ answers many common questions.')}
|
|
|
|
actions={
|
|
|
|
<div className="section__actions">
|
|
|
|
<Button
|
|
|
|
href="https://lbry.com/faq/lbry-basics"
|
|
|
|
label={__('Read the App Basics FAQ')}
|
|
|
|
icon={icons.HELP}
|
2019-11-22 22:13:00 +01:00
|
|
|
button="secondary"
|
|
|
|
/>
|
|
|
|
<Button
|
|
|
|
href="https://lbry.com/faq"
|
|
|
|
label={__('View all LBRY FAQs')}
|
|
|
|
icon={icons.HELP}
|
|
|
|
button="secondary"
|
2019-09-27 22:03:05 +02:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
/>
|
2018-03-26 23:32:43 +02:00
|
|
|
|
2019-09-27 22:03:05 +02:00
|
|
|
<Card
|
|
|
|
title={__('Find Assistance')}
|
|
|
|
subtitle={
|
2019-10-01 06:53:33 +02:00
|
|
|
<I18nMessage tokens={{ channel: <strong>#help</strong> }}>
|
|
|
|
Live help is available most hours in the %channel% channel of our Discord chat room. Or you can always
|
|
|
|
email us at help@lbry.com.
|
|
|
|
</I18nMessage>
|
2019-09-27 22:03:05 +02:00
|
|
|
}
|
|
|
|
actions={
|
|
|
|
<div className="section__actions">
|
2019-11-22 22:13:00 +01:00
|
|
|
<Button button="secondary" label={__('Join Our Chat')} icon={icons.CHAT} href="https://chat.lbry.com" />
|
|
|
|
<Button button="secondary" label={__('Email Us')} icon={icons.WEB} href="mailto:help@lbry.com" />
|
2019-09-27 22:03:05 +02:00
|
|
|
</div>
|
|
|
|
}
|
|
|
|
/>
|
2019-04-11 18:12:00 +02:00
|
|
|
|
2019-09-27 22:03:05 +02:00
|
|
|
<Card
|
|
|
|
title={__('Report a Bug or Suggest a New Feature')}
|
|
|
|
subtitle={
|
2019-11-22 22:13:00 +01:00
|
|
|
<React.Fragment>
|
2019-09-27 22:03:05 +02:00
|
|
|
{__('Did you find something wrong? Think LBRY could add something useful and cool?')}{' '}
|
|
|
|
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/support" />.
|
2019-11-22 22:13:00 +01:00
|
|
|
</React.Fragment>
|
2019-09-27 22:03:05 +02:00
|
|
|
}
|
|
|
|
actions={
|
|
|
|
<div className="section__actions">
|
2019-11-22 22:13:00 +01:00
|
|
|
<Button navigate="/$/report" label={__('Submit Feedback')} button="secondary" />
|
2019-09-27 22:03:05 +02:00
|
|
|
</div>
|
|
|
|
}
|
|
|
|
/>
|
2018-06-09 05:38:09 +02:00
|
|
|
|
2019-04-11 20:17:23 +02:00
|
|
|
{/* @if TARGET='app' */}
|
2019-09-27 22:03:05 +02:00
|
|
|
<Card
|
|
|
|
title={__('View your Log')}
|
|
|
|
subtitle={
|
2020-01-03 23:07:57 +01:00
|
|
|
<I18nMessage
|
|
|
|
tokens={{
|
|
|
|
support_link: <Button button="link" label={__('support')} href="https://lbry.com/faq/support" />,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
Did something go wrong? Have a look in your log file, or send it to %support_link%.
|
|
|
|
</I18nMessage>
|
2019-09-27 22:03:05 +02:00
|
|
|
}
|
|
|
|
actions={
|
|
|
|
<div className="section__actions">
|
2019-11-22 22:13:00 +01:00
|
|
|
<Button button="secondary" label={__('Open Log')} onClick={() => this.openLogFile(dataDirectory)} />
|
|
|
|
<Button button="secondary" label={__('Open Log Folder')} onClick={() => shell.openItem(dataDirectory)} />
|
2019-09-27 22:03:05 +02:00
|
|
|
</div>
|
|
|
|
}
|
|
|
|
/>
|
2017-07-21 08:23:39 +02:00
|
|
|
|
2020-03-23 17:06:43 +01:00
|
|
|
<WalletBackup />
|
2019-05-14 04:51:33 +02:00
|
|
|
{/* @endif */}
|
|
|
|
|
2020-04-01 20:43:50 +02:00
|
|
|
<Card
|
|
|
|
title={__('About')}
|
|
|
|
subtitle={
|
|
|
|
this.state.upgradeAvailable !== null && this.state.upgradeAvailable ? (
|
|
|
|
<span>
|
|
|
|
{__('A newer version of LBRY is available.')}
|
|
|
|
<Button button="link" href={newVerLink} label={__('Download now!')} />
|
|
|
|
</span>
|
|
|
|
) : null
|
|
|
|
}
|
2020-04-29 21:31:11 +02:00
|
|
|
isBodyList
|
2020-04-01 20:43:50 +02:00
|
|
|
body={
|
|
|
|
<div className="table__wrapper">
|
|
|
|
<table className="table table--stretch">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>{__('App')}</td>
|
|
|
|
<td>{this.state.uiVersion}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>{__('Daemon (lbrynet)')}</td>
|
|
|
|
<td>{ver ? ver.lbrynet_version : __('Loading...')}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>{__('Connected Email')}</td>
|
|
|
|
<td>
|
|
|
|
{user && user.primary_email ? (
|
|
|
|
<React.Fragment>
|
|
|
|
{user.primary_email}{' '}
|
|
|
|
<Button
|
|
|
|
button="link"
|
|
|
|
href={`https://lbry.com/list/edit/${accessToken}`}
|
|
|
|
label={__('Update mailing preferences')}
|
|
|
|
/>
|
|
|
|
</React.Fragment>
|
|
|
|
) : (
|
|
|
|
<React.Fragment>
|
|
|
|
<span className="empty">{__('none')} </span>
|
|
|
|
<Button button="link" onClick={() => doAuth()} label={__('set email')} />
|
|
|
|
</React.Fragment>
|
|
|
|
)}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>{__('Reward Eligible')}</td>
|
|
|
|
<td>{user && user.is_reward_approved ? __('Yes') : __('No')}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>{__('Platform')}</td>
|
|
|
|
<td>{platform}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>{__('Installation ID')}</td>
|
|
|
|
<td>{this.state.lbryId}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>{__('Access Token')}</td>
|
|
|
|
<td>
|
|
|
|
{this.state.accessTokenHidden && (
|
|
|
|
<Button button="link" label={__('View')} onClick={this.showAccessToken} />
|
|
|
|
)}
|
|
|
|
{!this.state.accessTokenHidden && accessToken && (
|
|
|
|
<div>
|
|
|
|
<p>{accessToken}</p>
|
|
|
|
<div className="help--warning">
|
|
|
|
{__('This is equivalent to a password. Do not post or share this.')}
|
|
|
|
</div>
|
2019-12-18 06:27:08 +01:00
|
|
|
</div>
|
2020-04-01 20:43:50 +02:00
|
|
|
)}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
/>
|
2018-03-26 23:32:43 +02:00
|
|
|
</Page>
|
2016-04-20 12:28:13 +02:00
|
|
|
);
|
|
|
|
}
|
2017-05-17 10:10:25 +02:00
|
|
|
}
|
2016-11-22 21:19:08 +01:00
|
|
|
|
2017-04-07 07:15:22 +02:00
|
|
|
export default HelpPage;
|