use env for twitter account

This commit is contained in:
btzr-io 2021-07-26 12:27:48 -05:00 committed by jessopb
parent d462f96834
commit c0c65c46f4
3 changed files with 12 additions and 6 deletions

View file

@ -38,6 +38,8 @@ SITE_NAME=lbry.tv
SITE_DESCRIPTION=Meet LBRY, an open, free, and community-controlled content wonderland.
SITE_HELP_EMAIL=help@lbry.com
LOGO_TITLE=lbry.tv
## Social media
TWITTER_ACCOUNT=LBRYcom
## IMAGE ASSETS
YRBL_HAPPY_IMG_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-happy/7aa50a7e5adaf48691935d55e45d697547392929/839d9a

View file

@ -24,6 +24,8 @@ const config = {
SITE_NAME: process.env.SITE_NAME,
SITE_DESCRIPTION: process.env.SITE_DESCRIPTION,
SITE_HELP_EMAIL: process.env.SITE_HELP_EMAIL,
// SOCIAL MEDIA
TWITTER_ACCOUNT: process.env.TWITTER_ACCOUNT,
// LOGO
LOGO_TITLE: process.env.LOGO_TITLE,
FAVICON: process.env.FAVICON,
@ -70,7 +72,7 @@ const config = {
BRANDED_SITE: process.env.BRANDED_SITE,
};
config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`;
config.URL_DEV = `http://localhost:${config.WEBPACK_WEB_PORT}`;
config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`;
module.exports = config;

View file

@ -9,16 +9,13 @@ import { useIsMobile } from 'effects/use-screensize';
import { FormField } from 'component/common/form';
import { hmsToSeconds, secondsToHms } from 'util/time';
import { generateLbryContentUrl, generateLbryWebUrl, generateEncodedLbryURL, generateShareUrl } from 'util/url';
import { URL, SHARE_DOMAIN_URL } from 'config';
import { URL, TWITTER_ACCOUNT, SHARE_DOMAIN_URL } from 'config';
const SHARE_DOMAIN = SHARE_DOMAIN_URL || URL;
const IOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
const SUPPORTS_SHARE_API = typeof navigator.share !== 'undefined';
const IS_ODYSEE = SHARE_DOMAIN === 'https://odysee.com';
// Twitter share
const TWITTER_LBRY = 'LBRYcom';
const TWITTER_ODYSEE = 'OdyseeTeam';
const TWITTER_INTENT_API = 'https://twitter.com/intent/tweet?';
type Props = {
@ -77,10 +74,15 @@ function SocialShare(props: Props) {
// Tweet params
let tweetIntentParams = {
url: shareUrl,
via: IS_ODYSEE ? TWITTER_ODYSEE : TWITTER_LBRY,
text: title || claim.name,
hashtags: 'LBRY',
};
if (TWITTER_ACCOUNT) {
// $FlowFixMe
tweetIntentParams.via = TWITTER_ACCOUNT;
}
// Generate twitter web intent url
const tweetIntent = TWITTER_INTENT_API + new URLSearchParams(tweetIntentParams).toString();