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_DESCRIPTION=Meet LBRY, an open, free, and community-controlled content wonderland.
SITE_HELP_EMAIL=help@lbry.com SITE_HELP_EMAIL=help@lbry.com
LOGO_TITLE=lbry.tv LOGO_TITLE=lbry.tv
## Social media
TWITTER_ACCOUNT=LBRYcom
## IMAGE ASSETS ## IMAGE ASSETS
YRBL_HAPPY_IMG_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-happy/7aa50a7e5adaf48691935d55e45d697547392929/839d9a 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_NAME: process.env.SITE_NAME,
SITE_DESCRIPTION: process.env.SITE_DESCRIPTION, SITE_DESCRIPTION: process.env.SITE_DESCRIPTION,
SITE_HELP_EMAIL: process.env.SITE_HELP_EMAIL, SITE_HELP_EMAIL: process.env.SITE_HELP_EMAIL,
// SOCIAL MEDIA
TWITTER_ACCOUNT: process.env.TWITTER_ACCOUNT,
// LOGO // LOGO
LOGO_TITLE: process.env.LOGO_TITLE, LOGO_TITLE: process.env.LOGO_TITLE,
FAVICON: process.env.FAVICON, FAVICON: process.env.FAVICON,
@ -70,7 +72,7 @@ const config = {
BRANDED_SITE: process.env.BRANDED_SITE, 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_DEV = `http://localhost:${config.WEBPACK_WEB_PORT}`;
config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`;
module.exports = config; module.exports = config;

View file

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