diff --git a/ui/component/router/view.jsx b/ui/component/router/view.jsx index 52c235b..096cdf8 100644 --- a/ui/component/router/view.jsx +++ b/ui/component/router/view.jsx @@ -58,6 +58,7 @@ import SignInWalletPasswordPage from 'page/signInWalletPassword'; import YoutubeSyncPage from 'page/youtubeSync'; import CollectionPage from 'page/collection'; import DonationPage from 'page/donation'; +import SeedPage from 'page/seed_service'; import { LINKED_COMMENT_QUERY_PARAM } from 'constants/comment'; import { parseURI, isURIValid } from 'lbry-redux'; @@ -261,6 +262,7 @@ function AppRouter(props: Props) { + diff --git a/ui/component/sideNavigation/view.jsx b/ui/component/sideNavigation/view.jsx index 8f6dc6c..d94e616 100644 --- a/ui/component/sideNavigation/view.jsx +++ b/ui/component/sideNavigation/view.jsx @@ -37,6 +37,12 @@ const DONATE = { icon: ICONS.LBC, }; +const SEED = { + title: 'Seed Service', + link: `/$/${PAGES.SEED}`, + icon: ICONS.DOWNLOADABLE, +}; + type Props = { subscriptions: Array, followedTags: Array, @@ -222,6 +228,7 @@ function SideNavigation(props: Props) { SIDE_LINKS.push(HOME); SIDE_LINKS.push(DONATE); + SIDE_LINKS.push(SEED); if (!SIMPLE_SITE && hasExperimentalUi) { FULL_LINKS.push({ title: 'Lists', diff --git a/ui/constants/pages.js b/ui/constants/pages.js index c8eaa85..eeffb01 100644 --- a/ui/constants/pages.js +++ b/ui/constants/pages.js @@ -73,3 +73,4 @@ exports.LIVESTREAM_CURRENT = 'live'; exports.GENERAL = 'general'; exports.LIST = 'list'; exports.DONATION = 'donation'; +exports.SEED = 'seed_service'; diff --git a/ui/page/seed_service/index.js b/ui/page/seed_service/index.js new file mode 100644 index 0000000..3bc8289 --- /dev/null +++ b/ui/page/seed_service/index.js @@ -0,0 +1,19 @@ +import * as PAGES from 'constants/pages'; +import { connect } from 'react-redux'; +import { doFetchAccessToken } from 'redux/actions/user'; +import { selectAccessToken, selectUser } from 'redux/selectors/user'; +import { selectDaemonSettings } from 'redux/selectors/settings'; +import HelpPage from './view'; + +const select = (state) => ({ + user: selectUser(state), + accessToken: selectAccessToken(state), + deamonSettings: selectDaemonSettings(state), +}); + +const perform = (dispatch, ownProps) => ({ + doAuth: () => ownProps.history.push(`/$/${PAGES.AUTH}?redirect=/$/${PAGES.HELP}`), + fetchAccessToken: () => dispatch(doFetchAccessToken()), +}); + +export default connect(select, perform)(HelpPage); diff --git a/ui/page/seed_service/view.jsx b/ui/page/seed_service/view.jsx new file mode 100644 index 0000000..7d82275 --- /dev/null +++ b/ui/page/seed_service/view.jsx @@ -0,0 +1,170 @@ +// @flow +import * as React from 'react'; +// @if TARGET='app' +import { shell } from 'electron'; +// @endif +import { Lbry } from 'lbry-redux'; +import Native from 'native'; +import Button from 'component/button'; +import Page from 'component/page'; +import 'scss/component/_seed'; + +type DeamonSettings = { + data_dir: string | any, +}; + +type Props = { + deamonSettings: DeamonSettings, + accessToken: string, + fetchAccessToken: () => void, + doAuth: () => void, + user: any, +}; + +type VersionInfo = { + os_system: string, + os_release: string, + platform: string, + lbrynet_version: string, +}; + +type State = { + versionInfo: VersionInfo | any, + lbryId: String | any, + uiVersion: ?string, + upgradeAvailable: ?boolean, + accessTokenHidden: ?boolean, +}; + +class HelpPage extends React.PureComponent { + constructor(props: Props) { + super(props); + + this.state = { + versionInfo: null, + lbryId: null, + uiVersion: null, + upgradeAvailable: null, + accessTokenHidden: true, + }; + + (this: any).showAccessToken = this.showAccessToken.bind(this); + (this: any).openLogFile = this.openLogFile.bind(this); + } + + componentDidMount() { + // @if TARGET='app' + Native.getAppVersionInfo().then(({ localVersion, upgradeAvailable }) => { + this.setState({ + uiVersion: localVersion, + upgradeAvailable, + }); + }); + if (!this.props.accessToken) this.props.fetchAccessToken(); + // @endif + + Lbry.version().then((info) => { + this.setState({ + versionInfo: info, + }); + }); + Lbry.status().then((info) => { + this.setState({ + lbryId: info.installation_id, + }); + }); + } + + showAccessToken() { + this.setState({ + accessTokenHidden: false, + }); + } + + openLogFile(userHomeDirectory: string) { + const logFileName = 'lbrynet.log'; + const os = this.state.versionInfo.os_system; + if (os === 'Darwin' || os === 'Linux') { + shell.openPath(`${userHomeDirectory}/${logFileName}`); + } else { + shell.openPath(`${userHomeDirectory}\\${logFileName}`); + } + } + + render() { + let ver; + let osName; + let platform; + let newVerLink; + + if (this.state.versionInfo) { + ver = this.state.versionInfo; + if (ver.os_system === 'Darwin') { + osName = parseInt(ver.os_release.match(/^\d+/), 10) < 16 ? 'Mac OS X' : 'Mac OS'; + + platform = `${osName} ${ver.os_release}`; + newVerLink = 'https://lbry.com/get/lbry.dmg'; + } else if (process.env.APPIMAGE !== undefined) { + platform = `Linux (AppImage)`; + newVerLink = 'https://lbry.com/get/lbry.AppImage'; + } else if (ver.os_system === 'Linux') { + platform = `Linux (${ver.platform})`; + newVerLink = 'https://lbry.com/get/lbry.deb'; + } else { + platform = `Windows (${ver.platform})`; + newVerLink = 'https://lbry.com/get/lbry.msi'; + } + } else { + ver = null; + } + + return ( + +

Madiator's Seeding Service

+ +
+

{__('How it works?')}

+

+ {__('Hello everyone! I decided to start own seeding service for community to help creators with distribution of their content. By running this service I hope to get donations for improving my project. Everyone is welcome to submit where small channels can be hosted for Free and bigger ones will bo hoste> +

+ +

+ + + 1.Do not request channels that host copyrighted content or NSFW. + + + + 2.Donators can request more than 1 channel to be seeded. + + + + 3.You can donate to seed other people content (Something like gift system). + + + + 4.Small channels can be seed for free if they are under 100 vides. + + + + 5.Channels above 100 videos will be reviewd based on videos file size (Current price 5.5 LBC / GB ). + + + + + {/* + + + Crypto Name: Crypto Address + + */} +

+
+ ); + } +} + +export default HelpPage; + diff --git a/ui/scss/component/_seed.scss b/ui/scss/component/_seed.scss new file mode 100644 index 0000000..2d80c28 --- /dev/null +++ b/ui/scss/component/_seed.scss @@ -0,0 +1,21 @@ +.seed-h1 { + text-align: center; + font-size: 50px; + margin-bottom: 20px; +} + +.seed-p { + margin-top: 20px; +} + +.seed-span { + display: block; + font-size: 25px; + padding: 5px 5px 5px 5px; +} + +.seed-icon { + height: 30px; + width: 30px; + padding-right: 5px; +}