Merge pull request #2 from kodxana/seed_dev

Add Seed Service code
This commit is contained in:
kodxana 2021-12-08 15:42:48 +01:00 committed by GitHub
commit a42c09efdd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 220 additions and 0 deletions

View file

@ -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) {
<Route path={`/$/${PAGES.REPORT_CONTENT}`} exact component={ReportContentPage} />
<Route {...props} path={`/$/${PAGES.LIST}/:collectionId`} component={CollectionPage} />
<Route {...props} path={`/$/${PAGES.DONATION}`} component={DonationPage} />
<Route {...props} path={`/$/${PAGES.SEED}`} component={SeedPage} />
<PrivateRoute {...props} exact path={`/$/${PAGES.YOUTUBE_SYNC}`} component={YoutubeSyncPage} />
<PrivateRoute {...props} exact path={`/$/${PAGES.TAGS_FOLLOWING}`} component={TagsFollowingPage} />

View file

@ -37,6 +37,12 @@ const DONATE = {
icon: ICONS.LBC,
};
const SEED = {
title: 'Seed Service',
link: `/$/${PAGES.SEED}`,
icon: ICONS.DOWNLOADABLE,
};
type Props = {
subscriptions: Array<Subscription>,
followedTags: Array<Tag>,
@ -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',

View file

@ -73,3 +73,4 @@ exports.LIVESTREAM_CURRENT = 'live';
exports.GENERAL = 'general';
exports.LIST = 'list';
exports.DONATION = 'donation';
exports.SEED = 'seed_service';

View file

@ -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);

View file

@ -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<Props, State> {
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 (
<Page className="card-stack">
<h1 className="seed-h1">Madiator's Seeding Service</h1>
<div className="notice-message">
<h1 className="section__title">{__('How it works?')}</h1>
<p className="section__subtitle">
{__('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>
<Button label={__('Click here to submit channel')} button="link" href="https://next.madiator.com/apps/forms/33cfmc8s8AoKcmxs" />
</p>
</div>
<p classNames="seed-p">
<span className="rules-span">
1.Do not request channels that host copyrighted content or NSFW.
</span>
<span className="rules-span">
2.Donators can request more than 1 channel to be seeded.
</span>
<span className="rules-span">
3.You can donate to seed other people content (Something like gift system).
</span>
<span className="rules-span">
4.Small channels can be seed for free if they are under 100 vides.
</span>
<span className="rules-span">
5.Channels above 100 videos will be reviewd based on videos file size (Current price 5.5 LBC / GB ).
</span>
{/*
<span className="donation-span">
<img src="Image URL" className="donation-icon" />
Crypto Name: Crypto Address
</span>
*/}
</p>
</Page>
);
}
}
export default HelpPage;

View file

@ -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;
}