From 897ecf00c3aaf8a1da826e3a5e3ebdce7a1860f3 Mon Sep 17 00:00:00 2001 From: kodxana Date: Wed, 8 Dec 2021 15:33:50 +0100 Subject: [PATCH] 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; +