From 81ffd7ae79a4924d23983a6712efcb2298b054b4 Mon Sep 17 00:00:00 2001 From: jessop Date: Tue, 14 Jul 2020 18:49:10 -0400 Subject: [PATCH] specify first run follow in config --- .env.defaults | 2 ++ README.md | 3 +++ config.js | 1 + ui/component/userChannelFollowIntro/view.jsx | 19 ++++++++----------- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.env.defaults b/.env.defaults index 6cf3b3156..08a090ea0 100644 --- a/.env.defaults +++ b/.env.defaults @@ -30,6 +30,8 @@ DEFAULT_LANGUAGE=en # Custom Content # If the following is true, copy custom/homepage.example.js to custom/homepage.js and modify CUSTOM_HOMEPAGE=false +# Add channels to auto-follow on first run +AUTO_FOLLOW_CHANNELS=lbry://@lbrycast#4c29f8b013adea4d5cca1861fb2161d5089613ea lbry://@lbry#3fda836a92faaceedfe398225fb9b2ee2ed1f01a # Add up to 2 sidebar links: # PINNED_URI_1=@Lbrylatam#2/Integracionesporseguridad#4 # PINNED_LABEL_1=LBRY LATAM diff --git a/README.md b/README.md index b69193883..328c04bf0 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,9 @@ nano .env - To specify your own OG-IMAGE You can either place a png named v2-og.png in the /custom folder or specify the OG_IMAGE_URL in .env +- To specify your own channels to be followed on first run +`AUTO_FOLLOW_URLS=lbry://@chan#123...a lbry://@chan2#456...a` + - If you want to customize the homepage content 1. add `CUSTOM_HOMEPAGE=true` to the '.env' file diff --git a/config.js b/config.js index 302966827..087febdd4 100644 --- a/config.js +++ b/config.js @@ -21,6 +21,7 @@ const config = { OG_IMAGE_URL: process.env.OG_IMAGE_URL, SITE_CANONICAL_URL: process.env.SITE_CANONICAL_URL, DEFAULT_LANGUAGE: process.env.DEFAULT_LANGUAGE, + AUTO_FOLLOW_CHANNELS: process.env.AUTO_FOLLOW_CHANNELS, PINNED_URI_1: process.env.PINNED_URI_1, PINNED_LABEL_1: process.env.PINNED_LABEL_1, diff --git a/ui/component/userChannelFollowIntro/view.jsx b/ui/component/userChannelFollowIntro/view.jsx index f2441c8fa..df17d28d4 100644 --- a/ui/component/userChannelFollowIntro/view.jsx +++ b/ui/component/userChannelFollowIntro/view.jsx @@ -6,6 +6,7 @@ import Nag from 'component/common/nag'; import { parseURI } from 'lbry-redux'; import Button from 'component/button'; import Card from 'component/common/card'; +import { AUTO_FOLLOW_CHANNELS } from 'config'; type Props = { subscribedChannels: Array, @@ -14,8 +15,7 @@ type Props = { channelSubscribe: (sub: Subscription) => void, }; -const LBRY_URI = 'lbry://@lbry#3fda836a92faaceedfe398225fb9b2ee2ed1f01a'; -const LBRYCAST_URI = 'lbry://@lbrycast#4c29f8b013adea4d5cca1861fb2161d5089613ea'; +const channelsToSubscribe = AUTO_FOLLOW_CHANNELS.trim().split(' '); function UserChannelFollowIntro(props: Props) { const { subscribedChannels, channelSubscribe, onContinue, onBack } = props; @@ -23,15 +23,12 @@ function UserChannelFollowIntro(props: Props) { // subscribe to lbry useEffect(() => { - channelSubscribe({ - channelName: parseURI(LBRY_URI).claimName, - uri: LBRY_URI, - }); - - channelSubscribe({ - channelName: parseURI(LBRYCAST_URI).claimName, - uri: LBRYCAST_URI, - }); + channelsToSubscribe.forEach(c => + channelSubscribe({ + channelName: parseURI(c).claimName, + uri: c, + }) + ); }, []); return (