From 897ecf00c3aaf8a1da826e3a5e3ebdce7a1860f3 Mon Sep 17 00:00:00 2001 From: kodxana Date: Wed, 8 Dec 2021 15:33:50 +0100 Subject: [PATCH 1/6] Seed service UI --- ui/page/seed_service/view.jsx | 170 ++++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 ui/page/seed_service/view.jsx 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; + From da1570ec87fd2050c1e7e21454e85c40cc91f476 Mon Sep 17 00:00:00 2001 From: kodxana Date: Wed, 8 Dec 2021 15:34:37 +0100 Subject: [PATCH 2/6] Seed service page --- ui/page/seed_service/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 ui/page/seed_service/index.js 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); From c3d9063c6c1eaee6a7057ccc83fb196a9145d7ff Mon Sep 17 00:00:00 2001 From: kodxana Date: Wed, 8 Dec 2021 15:36:05 +0100 Subject: [PATCH 3/6] Seed page --- ui/scss/component/_seed.scss | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 ui/scss/component/_seed.scss 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; +} From b665b14fd7dedc04bfbf88782a46d3b367554d70 Mon Sep 17 00:00:00 2001 From: kodxana Date: Wed, 8 Dec 2021 15:38:29 +0100 Subject: [PATCH 4/6] Seed page --- ui/component/router/view.jsx | 2 ++ 1 file changed, 2 insertions(+) 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) { + From 08a1c593902ca37a545c46fdda2eccd0247c61e4 Mon Sep 17 00:00:00 2001 From: kodxana Date: Wed, 8 Dec 2021 15:41:05 +0100 Subject: [PATCH 5/6] seed page --- ui/component/sideNavigation/view.jsx | 7 +++++++ 1 file changed, 7 insertions(+) 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', From f63764f58a0df62346c8aa4f3973ffe997c61f1a Mon Sep 17 00:00:00 2001 From: kodxana Date: Wed, 8 Dec 2021 15:41:50 +0100 Subject: [PATCH 6/6] Update pages.js --- ui/constants/pages.js | 1 + 1 file changed, 1 insertion(+) 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';