Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4193c09f68 |
No files matched your search
@@ -13,7 +13,6 @@ LBRY_WEB_STREAMING_API=https://cdn.lbryplayer.xyz
|
||||
LBRY_WEB_BUFFER_API=https://collector-service.api.lbry.tv/api/v1/events/video
|
||||
COMMENT_SERVER_API=https://comments.odysee.com/api/v2
|
||||
SEARCH_SERVER_API=https://lighthouse.odysee.com/search
|
||||
SOCKETY_SERVER_API=wss://sockety.odysee.com/ws
|
||||
THUMBNAIL_CDN_URL=https://image-processor.vanwanet.com/optimize/
|
||||
WELCOME_VERSION=1.0
|
||||
|
||||
@@ -39,8 +38,6 @@ 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
|
||||
|
||||
+2
-6
@@ -8,16 +8,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
### Added
|
||||
- Show currently active playing item on playlist _community pr!_ ([#6453](https://github.com/lbryio/lbry-desktop/pull/6453))
|
||||
- Add watch later to hover action for last used playlist on popup _community pr!_ ([#6274](https://github.com/lbryio/lbry-desktop/pull/6274))
|
||||
- Open in desktop (web feature) _community pr!_ ([#6667](https://github.com/lbryio/lbry-desktop/pull/6667))
|
||||
- Add confirmation on comment removal _community pr!_ ([#6563](https://github.com/lbryio/lbry-desktop/pull/6563))
|
||||
- Show on content page if a file is part of a playlist already _community pr!_([#6393](https://github.com/lbryio/lbry-desktop/pull/6393))
|
||||
|
||||
### Changed
|
||||
- Use Canonical Url for copy link ([#6500](https://github.com/lbryio/lbry-desktop/pull/6500))
|
||||
- Use better icon for copy link ([#6485](https://github.com/lbryio/lbry-desktop/pull/6485))
|
||||
- Comments load paginated ([#6390](https://github.com/lbryio/lbry-desktop/pull/6390))
|
||||
- Improve twitter share _community pr!_ ([#6690](https://github.com/lbryio/lbry-desktop/pull/6690))
|
||||
- Update lighthouse search api _community pr!_ ([#6731](https://github.com/lbryio/lbry-desktop/pull/6731))
|
||||
- Update sockety api _community pr!_ ([#6747](https://github.com/lbryio/lbry-desktop/pull/6747))
|
||||
- Improve twitter share _community pr!_ ([#6690](https://github.com/lbryio/lbry-desktop/pull/6690))
|
||||
|
||||
### Fixed
|
||||
- App now supports '#' and ':' for claimId separator ([#6496](https://github.com/lbryio/lbry-desktop/pull/6496))
|
||||
@@ -28,9 +27,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- Fix drag / drop publish issues for web users _community pr!_ ([#6466](https://github.com/lbryio/lbry-desktop/pull/6466))
|
||||
- Fix yarn copyenv on windows _community pr!_ ([#6702](https://github.com/lbryio/lbry-desktop/pull/6702))
|
||||
- Fix unnecessary livestream api calls in channel page _community pr!_ ([#6652](https://github.com/lbryio/lbry-desktop/pull/6652))
|
||||
- Fix desktop app fails to resolve deep links _community pr!_ ([#6779](https://github.com/lbryio/lbry-desktop/pull/6779))
|
||||
- Added \ and = to reserved symbol warning _community pr!_ ([#6733](https://github.com/lbryio/lbry-desktop/pull/6733))
|
||||
|
||||
|
||||
## [0.51.1] - [2021-06-26]
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ const config = {
|
||||
LBRY_WEB_BUFFER_API: process.env.LBRY_WEB_BUFFER_API,
|
||||
SEARCH_SERVER_API: process.env.SEARCH_SERVER_API,
|
||||
COMMENT_SERVER_API: process.env.COMMENT_SERVER_API,
|
||||
SOCKETY_SERVER_API: process.env.SOCKETY_SERVER_API,
|
||||
WELCOME_VERSION: process.env.WELCOME_VERSION,
|
||||
DOMAIN: process.env.DOMAIN,
|
||||
SHARE_DOMAIN_URL: process.env.SHARE_DOMAIN_URL,
|
||||
@@ -25,8 +24,6 @@ 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,
|
||||
@@ -73,7 +70,7 @@ const config = {
|
||||
BRANDED_SITE: process.env.BRANDED_SITE,
|
||||
};
|
||||
|
||||
config.URL_DEV = `http://localhost:${config.WEBPACK_WEB_PORT}`;
|
||||
config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`;
|
||||
config.URL_DEV = `http://localhost:${config.WEBPACK_WEB_PORT}`;
|
||||
|
||||
module.exports = config;
|
||||
+5
-17
@@ -45,15 +45,9 @@ let daemon;
|
||||
let lbryFirst;
|
||||
|
||||
const appState = {};
|
||||
const PROTOCOL = 'lbry';
|
||||
|
||||
if (isDev && process.platform === 'win32') {
|
||||
// Setting this is required to get this working in dev mode.
|
||||
app.setAsDefaultProtocolClient(PROTOCOL, process.execPath, [
|
||||
path.resolve(process.argv[1]),
|
||||
]);
|
||||
} else {
|
||||
app.setAsDefaultProtocolClient(PROTOCOL);
|
||||
if (process.platform !== 'linux') {
|
||||
app.setAsDefaultProtocolClient('lbry');
|
||||
}
|
||||
|
||||
app.name = 'LBRY';
|
||||
@@ -155,15 +149,9 @@ if (!gotSingleInstanceLock) {
|
||||
app.on('second-instance', (event, argv) => {
|
||||
// Send the url to the app to navigate first, then focus
|
||||
if (rendererWindow) {
|
||||
// External uri (last item on argv):
|
||||
const EXTERNAL_URI = (argv.length) ? argv[argv.length - 1] : '';
|
||||
// Handle protocol requests for windows and linux
|
||||
const platforms = (process.platform === 'win32' || process.platform === 'linux');
|
||||
// Is LBRY protocol
|
||||
const isProtocolURI = String(EXTERNAL_URI).startsWith(PROTOCOL + '://');
|
||||
// External protocol requested:
|
||||
if (platforms && isProtocolURI) {
|
||||
let URI = EXTERNAL_URI;
|
||||
if ((process.platform === 'win32' || process.platform === 'linux') && String(argv[1]).startsWith('lbry')) {
|
||||
let URI = argv[1];
|
||||
|
||||
// Keep only command line / deep linked arguments
|
||||
// Windows normalizes URIs when they're passed in from other apps. On Windows, this tries to
|
||||
// restore the original URI that was typed.
|
||||
|
||||
+2
-2
@@ -54,12 +54,12 @@
|
||||
"electron-notarize": "^1.0.0",
|
||||
"electron-updater": "^4.2.4",
|
||||
"express": "^4.17.1",
|
||||
"feed": "^4.2.2",
|
||||
"if-env": "^1.0.4",
|
||||
"react-datetime-picker": "^3.2.1",
|
||||
"react-plastic": "^1.1.1",
|
||||
"react-top-loading-bar": "^2.0.1",
|
||||
"remove-markdown": "^0.3.0",
|
||||
"rss": "^1.2.2",
|
||||
"source-map-explorer": "^2.5.2",
|
||||
"tempy": "^0.6.0",
|
||||
"videojs-contrib-ads": "^6.9.0",
|
||||
@@ -152,7 +152,7 @@
|
||||
"imagesloaded": "^4.1.4",
|
||||
"json-loader": "^0.5.4",
|
||||
"lbry-format": "https://github.com/lbryio/lbry-format.git",
|
||||
"lbry-redux": "lbryio/lbry-redux#7cc9923ed9ff1940b508842af6be44c8da906a60",
|
||||
"lbry-redux": "lbryio/lbry-redux#a327385cdf71568dbd15a17f3dcf5f4b83e0966d",
|
||||
"lbryinc": "lbryio/lbryinc#8f9a58bfc8312a65614fd7327661cdcc502c4e59",
|
||||
"lint-staged": "^7.0.2",
|
||||
"localforage": "^1.7.1",
|
||||
|
||||
@@ -209,7 +209,6 @@
|
||||
"Your comment": "Your comment",
|
||||
"Post --[button to submit something]--": "Post",
|
||||
"Post --[noun, markdown post tab button]--": "Post",
|
||||
"Livestream --[noun, livestream tab button]--": "Livestream",
|
||||
"Posting...": "Posting...",
|
||||
"Incompatible daemon": "Incompatible daemon",
|
||||
"Incompatible daemon running": "Incompatible daemon running",
|
||||
@@ -2065,11 +2064,9 @@
|
||||
"Skip Navigation": "Skip Navigation",
|
||||
"Reset": "Reset",
|
||||
"Reset to original (previous) publish date": "Reset to original (previous) publish date",
|
||||
"%title% by %channelTitle%": "%title% by %channelTitle%",
|
||||
"%title% by %channelTitle% %ariaDate%": "%title% by %channelTitle% %ariaDate%",
|
||||
"%title% by %channelTitle% %ariaDate%, %mediaDuration%": "%title% by %channelTitle% %ariaDate%, %mediaDuration%",
|
||||
"Search for something...": "Search for something...",
|
||||
"Confirm Comment Deletion": "Confirm Comment Deletion",
|
||||
"Remove Comment": "Remove Comment",
|
||||
"Are you sure you want to remove this comment?": "Are you sure you want to remove this comment?",
|
||||
"This comment has a tip associated with it which cannot be reverted.": "This comment has a tip associated with it which cannot be reverted.",
|
||||
"Recent Comments": "Recent Comments",
|
||||
"--end--": "--end--"
|
||||
}
|
||||
@@ -1,17 +1,11 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import CollectionAddButton from './view';
|
||||
import { makeSelectClaimForUri, makeSelectClaimUrlInCollection } from 'lbry-redux';
|
||||
import { makeSelectClaimForUri } from 'lbry-redux';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claim = makeSelectClaimForUri(props.uri)(state);
|
||||
const permanentUrl = claim && claim.permanent_url;
|
||||
|
||||
return {
|
||||
claim,
|
||||
isSaved: makeSelectClaimUrlInCollection(permanentUrl)(state),
|
||||
};
|
||||
};
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
});
|
||||
|
||||
export default connect(select, {
|
||||
doOpenModal,
|
||||
|
||||
@@ -11,11 +11,10 @@ type Props = {
|
||||
fileAction?: boolean,
|
||||
type?: boolean,
|
||||
claim: Claim,
|
||||
isSaved: boolean,
|
||||
};
|
||||
|
||||
export default function CollectionAddButton(props: Props) {
|
||||
const { doOpenModal, uri, fileAction, type = 'playlist', claim, isSaved } = props;
|
||||
const { doOpenModal, uri, fileAction, type = 'playlist', claim } = props;
|
||||
|
||||
// $FlowFixMe
|
||||
const streamType = (claim && claim.value && claim.value.stream_type) || '';
|
||||
@@ -26,9 +25,9 @@ export default function CollectionAddButton(props: Props) {
|
||||
<Button
|
||||
button={fileAction ? undefined : 'alt'}
|
||||
className={classnames({ 'button--file-action': fileAction })}
|
||||
icon={fileAction ? (!isSaved ? ICONS.ADD : ICONS.STACK) : ICONS.LIBRARY}
|
||||
icon={fileAction ? ICONS.ADD : ICONS.LIBRARY}
|
||||
iconSize={fileAction ? 22 : undefined}
|
||||
label={uri ? (!isSaved ? __('Save') : __('Saved')) : __('New List')}
|
||||
label={uri ? __('Save') : __('New List')}
|
||||
requiresAuth={IS_WEB}
|
||||
title={__('Add this claim to a list')}
|
||||
onClick={(e) => {
|
||||
|
||||
@@ -47,7 +47,6 @@ type Props = {
|
||||
searchOptions?: any,
|
||||
collectionId?: string,
|
||||
showNoSourceClaims?: boolean,
|
||||
onClick?: (e: any, index?: number) => void,
|
||||
};
|
||||
|
||||
export default function ClaimList(props: Props) {
|
||||
@@ -56,7 +55,6 @@ export default function ClaimList(props: Props) {
|
||||
uris,
|
||||
headerAltControls,
|
||||
loading,
|
||||
id,
|
||||
persistedStorageKey,
|
||||
empty,
|
||||
defaultSort,
|
||||
@@ -82,7 +80,6 @@ export default function ClaimList(props: Props) {
|
||||
searchOptions,
|
||||
collectionId,
|
||||
showNoSourceClaims,
|
||||
onClick,
|
||||
} = props;
|
||||
|
||||
const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW);
|
||||
@@ -110,12 +107,6 @@ export default function ClaimList(props: Props) {
|
||||
setCurrentSort(currentSort === SORT_NEW ? SORT_OLD : SORT_NEW);
|
||||
}
|
||||
|
||||
function handleClaimClicked(e, index) {
|
||||
if (onClick) {
|
||||
onClick(e, index);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const handleScroll = debounce((e) => {
|
||||
if (page && pageSize && onScrollBottom) {
|
||||
@@ -200,8 +191,6 @@ export default function ClaimList(props: Props) {
|
||||
{injectedItem && index === 4 && <li>{injectedItem}</li>}
|
||||
<ClaimPreview
|
||||
uri={uri}
|
||||
containerId={id}
|
||||
indexInContainer={index}
|
||||
type={type}
|
||||
active={activeUri && uri === activeUri}
|
||||
hideMenu={hideMenu}
|
||||
@@ -220,7 +209,6 @@ export default function ClaimList(props: Props) {
|
||||
return claim.name.length === 24 && !claim.name.includes(' ') && claim.value.author === 'Spee.ch';
|
||||
}}
|
||||
live={resolveLive(index)}
|
||||
onClick={handleClaimClicked}
|
||||
/>
|
||||
</React.Fragment>
|
||||
))}
|
||||
|
||||
@@ -106,7 +106,7 @@ function ClaimListDiscover(props: Props) {
|
||||
claimType,
|
||||
pageSize,
|
||||
defaultClaimType,
|
||||
streamType = SIMPLE_SITE ? [CS.FILE_VIDEO, CS.FILE_AUDIO] : undefined,
|
||||
streamType = SIMPLE_SITE ? CS.FILE_VIDEO : undefined,
|
||||
defaultStreamType = SIMPLE_SITE ? CS.FILE_VIDEO : undefined, // add param for DEFAULT_STREAM_TYPE
|
||||
freshness,
|
||||
defaultFreshness = CS.FRESH_WEEK,
|
||||
@@ -319,7 +319,7 @@ function ClaimListDiscover(props: Props) {
|
||||
}
|
||||
|
||||
if (streamTypeParam && streamTypeParam !== CS.CONTENT_ALL && claimType !== CS.CLAIM_CHANNEL) {
|
||||
options.stream_types = typeof streamTypeParam === 'string' ? [streamTypeParam] : streamTypeParam;
|
||||
options.stream_types = [streamTypeParam];
|
||||
}
|
||||
|
||||
if (claimTypeParam) {
|
||||
|
||||
@@ -394,13 +394,6 @@ function ClaimMenuList(props: Props) {
|
||||
)}
|
||||
<hr className="menu__separator" />
|
||||
|
||||
<MenuItem className="comment__menu-option" onSelect={handleCopyLink}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.COPY_LINK} />
|
||||
{__('Copy Link')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
|
||||
{isChannelPage && IS_WEB && rssUrl && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleCopyRssLink}>
|
||||
<div className="menu__link">
|
||||
@@ -410,6 +403,13 @@ function ClaimMenuList(props: Props) {
|
||||
</MenuItem>
|
||||
)}
|
||||
|
||||
<MenuItem className="comment__menu-option" onSelect={handleCopyLink}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.SHARE} />
|
||||
{__('Copy Link')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
|
||||
{!claimIsMine && !isMyCollection && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleReportContent}>
|
||||
<div className="menu__link">
|
||||
|
||||
@@ -29,7 +29,6 @@ import ClaimPreviewNoContent from './claim-preview-no-content';
|
||||
import { ENABLE_NO_SOURCE_CLAIMS } from 'config';
|
||||
import Button from 'component/button';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import { CONTAINER_ID } from 'constants/navigation';
|
||||
|
||||
const AbandonedChannelPreview = lazyImport(() =>
|
||||
import('component/abandonedChannelPreview' /* webpackChunkName: "abandonedChannelPreview" */)
|
||||
@@ -46,7 +45,7 @@ type Props = {
|
||||
reflectingProgress?: any, // fxme
|
||||
resolveUri: (string) => void,
|
||||
isResolvingUri: boolean,
|
||||
history: { push: (string | any) => void },
|
||||
history: { push: (string) => void },
|
||||
title: string,
|
||||
nsfw: boolean,
|
||||
placeholder: string,
|
||||
@@ -66,7 +65,7 @@ type Props = {
|
||||
actions: boolean | Node | string | number,
|
||||
properties: boolean | Node | string | number | ((Claim) => Node),
|
||||
empty?: Node,
|
||||
onClick?: (e: any, index?: number) => any,
|
||||
onClick?: (any) => any,
|
||||
streamingUrl: ?string,
|
||||
getFile: (string) => void,
|
||||
customShouldHide?: (Claim) => boolean,
|
||||
@@ -89,8 +88,6 @@ type Props = {
|
||||
disableNavigation?: boolean,
|
||||
mediaDuration?: string,
|
||||
date?: any,
|
||||
containerId?: string, // ID or name of the container (e.g. ClaimList, HOC, etc.) that this is in.
|
||||
indexInContainer?: number, // The index order of this component within 'containerId'.
|
||||
};
|
||||
|
||||
const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
@@ -152,8 +149,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
isCollectionMine,
|
||||
collectionUris,
|
||||
disableNavigation,
|
||||
containerId,
|
||||
indexInContainer,
|
||||
} = props;
|
||||
const isCollection = claim && claim.value_type === 'collection';
|
||||
const collectionClaimId = isCollection && claim && claim.claim_id;
|
||||
@@ -207,21 +202,9 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
collectionParams.set(COLLECTIONS_CONSTS.COLLECTION_ID, listId);
|
||||
navigateUrl = navigateUrl + `?` + collectionParams.toString();
|
||||
}
|
||||
|
||||
const handleNavLinkClick = (e) => {
|
||||
if (onClick) {
|
||||
onClick(e, indexInContainer);
|
||||
}
|
||||
e.stopPropagation();
|
||||
};
|
||||
|
||||
const navLinkProps = {
|
||||
to: {
|
||||
pathname: navigateUrl,
|
||||
state: containerId ? { [CONTAINER_ID]: containerId } : undefined,
|
||||
},
|
||||
onClick: (e) => handleNavLinkClick(e),
|
||||
onAuxClick: (e) => handleNavLinkClick(e),
|
||||
to: navigateUrl,
|
||||
onClick: (e) => e.stopPropagation(),
|
||||
};
|
||||
|
||||
// do not block abandoned and nsfw claims if showUserBlocked is passed
|
||||
@@ -267,14 +250,11 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
|
||||
function handleOnClick(e) {
|
||||
if (onClick) {
|
||||
onClick(e, indexInContainer);
|
||||
onClick(e);
|
||||
}
|
||||
|
||||
if (claim && !pending && !disableNavigation) {
|
||||
history.push({
|
||||
pathname: navigateUrl,
|
||||
state: containerId ? { [CONTAINER_ID]: containerId } : undefined,
|
||||
});
|
||||
history.push(navigateUrl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -159,12 +159,6 @@ function ClaimTilesDiscover(props: Props) {
|
||||
new Set(mutedUris.concat(blockedUris).map((uri) => splitBySeparator(uri)[1]))
|
||||
);
|
||||
const liveUris = [];
|
||||
let streamTypesParam;
|
||||
if (streamTypes) {
|
||||
streamTypesParam = streamTypes;
|
||||
} else if (SIMPLE_SITE && !hasNoSource && streamTypes !== null) {
|
||||
streamTypesParam = [CS.FILE_VIDEO, CS.FILE_AUDIO];
|
||||
}
|
||||
|
||||
const [prevUris, setPrevUris] = React.useState([]);
|
||||
|
||||
@@ -198,7 +192,8 @@ function ClaimTilesDiscover(props: Props) {
|
||||
channel_ids: channelIds || [],
|
||||
not_channel_ids: mutedAndBlockedChannelIds,
|
||||
order_by: orderBy || ['trending_group', 'trending_mixed'],
|
||||
stream_types: streamTypesParam,
|
||||
stream_types:
|
||||
streamTypes === null ? undefined : SIMPLE_SITE && !hasNoSource ? [CS.FILE_VIDEO, CS.FILE_AUDIO] : undefined,
|
||||
};
|
||||
|
||||
if (ENABLE_NO_SOURCE_CLAIMS && hasNoSource) {
|
||||
|
||||
@@ -13,7 +13,6 @@ import usePersistedState from 'effects/use-persisted-state';
|
||||
import { ENABLE_COMMENT_REACTIONS } from 'config';
|
||||
import Empty from 'component/common/empty';
|
||||
import debounce from 'util/debounce';
|
||||
import { useIsMobile } from 'effects/use-screensize';
|
||||
|
||||
const DEBOUNCE_SCROLL_HANDLER_MS = 200;
|
||||
|
||||
@@ -75,8 +74,6 @@ function CommentList(props: Props) {
|
||||
const DEFAULT_SORT = ENABLE_COMMENT_REACTIONS ? SORT_BY.POPULARITY : SORT_BY.NEWEST;
|
||||
const [sort, setSort] = usePersistedState('comment-sort-by', DEFAULT_SORT);
|
||||
const [page, setPage] = React.useState(0);
|
||||
const isMobile = useIsMobile();
|
||||
const [expandedComments, setExpandedComments] = React.useState(!isMobile);
|
||||
const totalFetchedComments = allCommentIds ? allCommentIds.length : 0;
|
||||
|
||||
// Display comments immediately if not fetching reactions
|
||||
@@ -194,7 +191,7 @@ function CommentList(props: Props) {
|
||||
}
|
||||
|
||||
const handleCommentScroll = debounce(() => {
|
||||
if (!isMobile && shouldFetchNextPage(page, topLevelTotalPages, window, document)) {
|
||||
if (shouldFetchNextPage(page, topLevelTotalPages, window, document)) {
|
||||
setPage(page + 1);
|
||||
}
|
||||
}, DEBOUNCE_SCROLL_HANDLER_MS);
|
||||
@@ -208,7 +205,6 @@ function CommentList(props: Props) {
|
||||
}
|
||||
}
|
||||
}, [
|
||||
isMobile,
|
||||
page,
|
||||
moreBelow,
|
||||
spinnerRef,
|
||||
@@ -283,13 +279,7 @@ function CommentList(props: Props) {
|
||||
<Empty padded text={__('That was pretty deep. What do you think?')} />
|
||||
)}
|
||||
|
||||
<ul
|
||||
className={classnames({
|
||||
comments: expandedComments,
|
||||
'comments--contracted': !expandedComments,
|
||||
})}
|
||||
ref={commentRef}
|
||||
>
|
||||
<ul className="comments" ref={commentRef}>
|
||||
{topLevelComments &&
|
||||
displayedComments &&
|
||||
displayedComments.map((comment) => {
|
||||
@@ -317,36 +307,7 @@ function CommentList(props: Props) {
|
||||
})}
|
||||
</ul>
|
||||
|
||||
{isMobile && (
|
||||
<div className="card__bottom-actions--comments">
|
||||
{(!expandedComments || moreBelow) && (
|
||||
<Button
|
||||
button="link"
|
||||
title={!expandedComments ? __('Expand Comments') : __('Load More')}
|
||||
label={!expandedComments ? __('Expand') : __('More')}
|
||||
onClick={() => {
|
||||
if (!expandedComments) {
|
||||
setExpandedComments(true);
|
||||
} else {
|
||||
setPage(page + 1);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{expandedComments && (
|
||||
<Button
|
||||
button="link"
|
||||
title={__('Collapse Thread')}
|
||||
label={__('Collapse')}
|
||||
onClick={() => {
|
||||
setExpandedComments(false);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{(isFetchingComments || (!isMobile && moreBelow)) && (
|
||||
{(isFetchingComments || moreBelow) && (
|
||||
<div className="main--empty" ref={spinnerRef}>
|
||||
<Spinner type="small" />
|
||||
</div>
|
||||
|
||||
@@ -18,16 +18,11 @@ export default function LivestreamLink(props: Props) {
|
||||
const [livestreamClaim, setLivestreamClaim] = React.useState(false);
|
||||
const [isLivestreaming, setIsLivestreaming] = React.useState(false);
|
||||
const livestreamChannelId = (channelClaim && channelClaim.claim_id) || ''; // TODO: fail in a safer way, probably
|
||||
const isChannelEmpty = !channelClaim || !channelClaim.meta || !channelClaim.meta.claims_in_channel;
|
||||
|
||||
React.useEffect(() => {
|
||||
// Don't search empty channels
|
||||
if (livestreamChannelId && !isChannelEmpty) {
|
||||
if (livestreamChannelId) {
|
||||
Lbry.claim_search({
|
||||
channel_ids: [livestreamChannelId],
|
||||
page: 1,
|
||||
page_size: 1,
|
||||
no_totals: true,
|
||||
has_no_source: true,
|
||||
claim_type: ['stream'],
|
||||
order_by: CS.ORDER_BY_NEW_VALUE,
|
||||
@@ -40,7 +35,7 @@ export default function LivestreamLink(props: Props) {
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
}, [livestreamChannelId, isChannelEmpty]);
|
||||
}, [livestreamChannelId]);
|
||||
|
||||
React.useEffect(() => {
|
||||
function fetchIsStreaming() {
|
||||
@@ -58,23 +53,17 @@ export default function LivestreamLink(props: Props) {
|
||||
}
|
||||
|
||||
let interval;
|
||||
// Only call livestream api if channel has livestream claims
|
||||
if (livestreamChannelId && livestreamClaim) {
|
||||
if (livestreamChannelId) {
|
||||
if (!interval) fetchIsStreaming();
|
||||
interval = setInterval(fetchIsStreaming, 10 * 1000);
|
||||
}
|
||||
// Prevent any more api calls on update
|
||||
if (!livestreamChannelId || !livestreamClaim) {
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
};
|
||||
}, [livestreamChannelId, livestreamClaim]);
|
||||
}, [livestreamChannelId]);
|
||||
|
||||
if (!livestreamClaim || !isLivestreaming) {
|
||||
return null;
|
||||
|
||||
@@ -31,17 +31,7 @@ export default function Logo(props: Props) {
|
||||
if (LOGO_TEXT_LIGHT) {
|
||||
return (
|
||||
<>
|
||||
<img className={'embed__overlay-logo'} src={LOGO_TEXT_LIGHT} />
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
return defaultWithLabel;
|
||||
}
|
||||
} else if (type === 'embed-ended') {
|
||||
if (LOGO_TEXT_LIGHT) {
|
||||
return (
|
||||
<>
|
||||
<img className={'embed__overlay-logo'} src={LOGO_TEXT_LIGHT} />
|
||||
<img className={'header__navigation-logo'} src={LOGO_TEXT_LIGHT} />
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimIsNsfw, makeSelectClaimForUri } from 'lbry-redux';
|
||||
import { doRecommendationUpdate, doRecommendationClicked } from 'redux/actions/content';
|
||||
import { doFetchRecommendedContent } from 'redux/actions/search';
|
||||
import { makeSelectRecommendedContentForUri, selectIsSearching } from 'redux/selectors/search';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
@@ -18,9 +17,6 @@ const select = (state, props) => ({
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
doFetchRecommendedContent: (uri, mature) => dispatch(doFetchRecommendedContent(uri, mature)),
|
||||
doRecommendationUpdate: (claimId, urls, id, parentId) =>
|
||||
dispatch(doRecommendationUpdate(claimId, urls, id, parentId)),
|
||||
doRecommendationClicked: (claimId, index) => dispatch(doRecommendationClicked(claimId, index)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(RecommendedContent);
|
||||
@@ -1,8 +1,6 @@
|
||||
// @flow
|
||||
import { SHOW_ADS } from 'config';
|
||||
import React from 'react';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import ClaimList from 'component/claimList';
|
||||
import ClaimListDiscover from 'component/claimListDiscover';
|
||||
import Ads from 'web/component/ads';
|
||||
@@ -10,7 +8,6 @@ import Card from 'component/common/card';
|
||||
import { useIsMobile, useIsMediumScreen } from 'effects/use-screensize';
|
||||
import Button from 'component/button';
|
||||
import classnames from 'classnames';
|
||||
import { CONTAINER_ID } from 'constants/navigation';
|
||||
|
||||
const VIEW_ALL_RELATED = 'view_all_related';
|
||||
const VIEW_MORE_FROM = 'view_more_from';
|
||||
@@ -24,8 +21,6 @@ type Props = {
|
||||
mature: boolean,
|
||||
isAuthenticated: boolean,
|
||||
claim: ?StreamClaim,
|
||||
doRecommendationUpdate: (claimId: string, urls: Array<string>, id: string, parentId: string) => void,
|
||||
doRecommendationClicked: (claimId: string, index: number) => void,
|
||||
};
|
||||
|
||||
export default React.memo<Props>(function RecommendedContent(props: Props) {
|
||||
@@ -38,70 +33,33 @@ export default React.memo<Props>(function RecommendedContent(props: Props) {
|
||||
isSearching,
|
||||
isAuthenticated,
|
||||
claim,
|
||||
doRecommendationUpdate,
|
||||
doRecommendationClicked,
|
||||
} = props;
|
||||
const [viewMode, setViewMode] = React.useState(VIEW_ALL_RELATED);
|
||||
const [recommendationId, setRecommendationId] = React.useState('');
|
||||
const [recommendationUrls, setRecommendationUrls] = React.useState();
|
||||
const history = useHistory();
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
const channelName = signingChannel ? signingChannel.name : null;
|
||||
const isMobile = useIsMobile();
|
||||
const isMedium = useIsMediumScreen();
|
||||
|
||||
React.useEffect(() => {
|
||||
function moveAutoplayNextItemToTop(recommendedContent) {
|
||||
let newList = recommendedContent;
|
||||
if (newList) {
|
||||
const index = newList.indexOf(nextRecommendedUri);
|
||||
if (index > 0) {
|
||||
const a = newList[0];
|
||||
newList[0] = nextRecommendedUri;
|
||||
newList[index] = a;
|
||||
}
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
|
||||
function listEq(prev, next) {
|
||||
if (prev && next) {
|
||||
return prev.length === next.length && prev.every((value, index) => value === next[index]);
|
||||
} else {
|
||||
return prev === next;
|
||||
function reorderList(recommendedContent) {
|
||||
let newList = recommendedContent;
|
||||
if (newList) {
|
||||
const index = newList.indexOf(nextRecommendedUri);
|
||||
if (index === -1) {
|
||||
// This would be weird. Shouldn't happen since it is derived from the same list.
|
||||
} else if (index !== 0) {
|
||||
// Swap the "next" item to the top of the list
|
||||
const a = newList[0];
|
||||
newList[0] = nextRecommendedUri;
|
||||
newList[index] = a;
|
||||
}
|
||||
}
|
||||
|
||||
const newRecommendationUrls = moveAutoplayNextItemToTop(recommendedContent);
|
||||
|
||||
if (claim && !listEq(recommendationUrls, newRecommendationUrls)) {
|
||||
const parentId = (history.location.state && history.location.state[CONTAINER_ID]) || '';
|
||||
const id = uuidv4();
|
||||
setRecommendationId(id);
|
||||
setRecommendationUrls(newRecommendationUrls);
|
||||
|
||||
doRecommendationUpdate(claim.claim_id, newRecommendationUrls, id, parentId);
|
||||
}
|
||||
}, [
|
||||
recommendedContent,
|
||||
nextRecommendedUri,
|
||||
recommendationUrls,
|
||||
setRecommendationUrls,
|
||||
claim,
|
||||
doRecommendationUpdate,
|
||||
history.location.state,
|
||||
]);
|
||||
return newList;
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
doFetchRecommendedContent(uri, mature);
|
||||
}, [uri, mature, doFetchRecommendedContent]);
|
||||
|
||||
function handleRecommendationClicked(e: any, index: number) {
|
||||
if (claim) {
|
||||
doRecommendationClicked(claim.claim_id, index);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Card
|
||||
isBodyList
|
||||
@@ -133,14 +91,12 @@ export default React.memo<Props>(function RecommendedContent(props: Props) {
|
||||
<div>
|
||||
{viewMode === VIEW_ALL_RELATED && (
|
||||
<ClaimList
|
||||
id={recommendationId}
|
||||
type="small"
|
||||
loading={isSearching}
|
||||
uris={recommendationUrls}
|
||||
uris={reorderList(recommendedContent)}
|
||||
hideMenu={isMobile}
|
||||
injectedItem={SHOW_ADS && IS_WEB && !isAuthenticated && <Ads small type={'video'} />}
|
||||
empty={__('No related content found')}
|
||||
onClick={handleRecommendationClicked}
|
||||
/>
|
||||
)}
|
||||
{viewMode === VIEW_MORE_FROM && signingChannel && (
|
||||
|
||||
@@ -9,15 +9,12 @@ 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, TWITTER_ACCOUNT, SHARE_DOMAIN_URL } from 'config';
|
||||
import { URL, 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';
|
||||
|
||||
// Twitter share
|
||||
const TWITTER_INTENT_API = 'https://twitter.com/intent/tweet?';
|
||||
|
||||
type Props = {
|
||||
claim: StreamClaim,
|
||||
title: ?string,
|
||||
@@ -71,21 +68,6 @@ function SocialShare(props: Props) {
|
||||
);
|
||||
const downloadUrl = `${generateDownloadUrl(name, claimId)}`;
|
||||
|
||||
// Tweet params
|
||||
let tweetIntentParams = {
|
||||
url: shareUrl,
|
||||
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();
|
||||
|
||||
function handleWebShareClick() {
|
||||
if (navigator.share) {
|
||||
navigator.share({
|
||||
@@ -133,7 +115,7 @@ function SocialShare(props: Props) {
|
||||
iconSize={24}
|
||||
icon={ICONS.TWITTER}
|
||||
title={__('Share on Twitter')}
|
||||
href={tweetIntent}
|
||||
href={`https://twitter.com/intent/tweet?text=${encodedLbryURL}`}
|
||||
/>
|
||||
<Button
|
||||
className="share"
|
||||
|
||||
@@ -7,7 +7,7 @@ import { makeSelectContentPositionForUri } from 'redux/selectors/content';
|
||||
import VideoViewer from './view';
|
||||
import { withRouter } from 'react-router';
|
||||
import { doClaimEligiblePurchaseRewards } from 'redux/actions/rewards';
|
||||
import { selectDaemonSettings, makeSelectClientSetting, selectHomepageData } from 'redux/selectors/settings';
|
||||
import { makeSelectClientSetting, selectHomepageData } from 'redux/selectors/settings';
|
||||
import { toggleVideoTheaterMode, doSetClientSetting } from 'redux/actions/settings';
|
||||
import { selectUserVerifiedEmail, selectUser } from 'redux/selectors/user';
|
||||
|
||||
@@ -31,7 +31,6 @@ const select = (state, props) => {
|
||||
homepageData: selectHomepageData(state),
|
||||
authenticated: selectUserVerifiedEmail(state),
|
||||
userId: userId,
|
||||
shareTelemetry: IS_WEB || selectDaemonSettings(state).share_usage_data,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
// Created by xander on 6/21/2021
|
||||
import videojs from 'video.js';
|
||||
import {
|
||||
makeSelectRecommendationId,
|
||||
makeSelectRecommendationParentId,
|
||||
makeSelectRecommendedClaimIds,
|
||||
makeSelectRecommendationClicks,
|
||||
} from 'redux/selectors/content';
|
||||
|
||||
import { v4 as uuidV4 } from 'uuid';
|
||||
const VERSION = '0.0.1';
|
||||
|
||||
const recsysEndpoint = 'https://clickstream.odysee.com/log/video/view';
|
||||
@@ -23,28 +17,23 @@ const RecsysData = {
|
||||
};
|
||||
|
||||
function createRecsys(claimId, userId, events, loadedAt, isEmbed) {
|
||||
// TODO: use a UUID generator
|
||||
const uuid = uuidV4();
|
||||
const pageLoadedAt = loadedAt;
|
||||
const pageExitedAt = Date.now();
|
||||
|
||||
if (window.store) {
|
||||
const state = window.store.getState();
|
||||
|
||||
return {
|
||||
uuid: makeSelectRecommendationId(claimId)(state),
|
||||
parentUuid: makeSelectRecommendationParentId(claimId)(state),
|
||||
uid: userId,
|
||||
claimId: claimId,
|
||||
pageLoadedAt: pageLoadedAt,
|
||||
pageExitedAt: pageExitedAt,
|
||||
recsysId: recsysId,
|
||||
recClaimIds: makeSelectRecommendedClaimIds(claimId)(state),
|
||||
recClickedVideoIdx: makeSelectRecommendationClicks(claimId)(state),
|
||||
events: events,
|
||||
isEmbed: isEmbed,
|
||||
};
|
||||
}
|
||||
|
||||
return undefined;
|
||||
return {
|
||||
uuid: uuid,
|
||||
parentUuid: null,
|
||||
uid: userId,
|
||||
claimId: claimId,
|
||||
pageLoadedAt: pageLoadedAt,
|
||||
pageExitedAt: pageExitedAt,
|
||||
recsysId: recsysId,
|
||||
recClaimIds: null,
|
||||
recClickedVideoIdx: null,
|
||||
events: events,
|
||||
isEmbed: isEmbed,
|
||||
};
|
||||
}
|
||||
|
||||
function newRecsysEvent(eventType, offset, arg) {
|
||||
@@ -141,10 +130,7 @@ class RecsysPlugin extends Component {
|
||||
this.loadedAt,
|
||||
false
|
||||
);
|
||||
|
||||
if (event) {
|
||||
sendRecsysEvents(event);
|
||||
}
|
||||
sendRecsysEvents(event);
|
||||
}
|
||||
|
||||
onPlay(event) {
|
||||
@@ -240,7 +226,7 @@ const onPlayerReady = (player, options) => {
|
||||
* @function plugin
|
||||
* @param {Object} [options={}]
|
||||
*/
|
||||
const plugin = function (options) {
|
||||
const plugin = function(options) {
|
||||
this.ready(() => {
|
||||
onPlayerReady(this, videojs.mergeOptions(defaults, options));
|
||||
});
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
// Created by xander on 7/10/2021
|
||||
import videojs from 'video.js';
|
||||
const VERSION = '0.0.1';
|
||||
|
||||
const watchmanEndpoint = 'https://watchman.na-backend.dev.odysee.com';
|
||||
|
||||
let previousEventTime = Date.now();
|
||||
|
||||
/* Watchman */
|
||||
function createWatchmanData(
|
||||
url,
|
||||
duration,
|
||||
position,
|
||||
relPosition,
|
||||
rebufCount,
|
||||
rebufDuration,
|
||||
format,
|
||||
player,
|
||||
userId,
|
||||
device
|
||||
) {
|
||||
return {
|
||||
url: url,
|
||||
duration: duration,
|
||||
rel_position: relPosition,
|
||||
rebuf_count: rebufCount,
|
||||
rebuf_duration: rebufDuration,
|
||||
format: format,
|
||||
player: player,
|
||||
user_id: userId,
|
||||
device: device,
|
||||
};
|
||||
}
|
||||
|
||||
function sendWatchmanData(watchmanData) {
|
||||
const requestOptions = {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'text/plain' }, // application/json
|
||||
body: JSON.stringify(watchmanData),
|
||||
};
|
||||
|
||||
try {
|
||||
fetch(watchmanEndpoint, requestOptions)
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
// Response data
|
||||
});
|
||||
} catch (error) {
|
||||
// Response error
|
||||
}
|
||||
}
|
||||
|
||||
// Plugin default options
|
||||
const defaults = {
|
||||
endpoint: watchmanEndpoint,
|
||||
reportRate: 15,
|
||||
videoUrl: null,
|
||||
userId: 0,
|
||||
debug: false,
|
||||
};
|
||||
|
||||
const Component = videojs.getComponent('Component');
|
||||
const registerPlugin = videojs.registerPlugin || videojs.plugin;
|
||||
|
||||
class WatchmanPlugin extends Component {
|
||||
constructor(player, options) {
|
||||
super(player, options);
|
||||
|
||||
// Plugin started
|
||||
if (options.debug) {
|
||||
this.log(`Created watchman plugin for: videoUrl:${options.videoUrl}, userId:${options.userId}`);
|
||||
}
|
||||
|
||||
// Plugin variables
|
||||
this.player = player;
|
||||
this.loadedAt = Date.now();
|
||||
this.watchmanIntervalId = null;
|
||||
this.bufferEventData = [];
|
||||
|
||||
// Plugin event listeners
|
||||
player.on('tracking:firstplay', (event, data) => this.onTrackingFirstPlay(event, data));
|
||||
player.on('tracking:buffered', (event, data) => this.onTrackingBuffered(event, data));
|
||||
|
||||
// Event trigger to send recsys event
|
||||
player.on('dispose', (event) => this.onDispose(event));
|
||||
}
|
||||
|
||||
sendWatchmanData() {
|
||||
const processedData = this.bufferEventData.reduce((accumulator, current) => {
|
||||
return {
|
||||
secondsToLoad: accumulator.secondsToLoad + current.secondsToLoad,
|
||||
bufferCount: accumulator.bufferCount + current.bufferCount,
|
||||
};
|
||||
}, {
|
||||
secondsToLoad: 0,
|
||||
bufferCount: 0,
|
||||
});
|
||||
|
||||
const timeSinceLastEvent = Date.now() - previousEventTime;
|
||||
previousEventTime = Date.now();
|
||||
|
||||
const currentTime = this.player.currentTime();
|
||||
const totalTime = this.player.duration();
|
||||
|
||||
const event = createWatchmanData(
|
||||
null,
|
||||
timeSinceLastEvent,
|
||||
currentTime,
|
||||
currentTime / totalTime,
|
||||
processedData.bufferCount,
|
||||
processedData.secondsToLoad * 1000,
|
||||
this.player.currentSource().type,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
);
|
||||
|
||||
console.log('[watchman] Data Payload', event);
|
||||
|
||||
// sendWatchmanData(event);
|
||||
}
|
||||
|
||||
onTrackingFirstPlay(event, data) {
|
||||
// data attr: secondsToLoad
|
||||
console.log(`[watchman] First Play Data:`, data);
|
||||
|
||||
// Start analytics interval here
|
||||
this.watchmanIntervalId = setInterval(() => this.onWatchmanInterval(), this.options_.reportRate * 1000);
|
||||
}
|
||||
|
||||
onTrackingBuffered(event, data) {
|
||||
const duration = this.player.duration();
|
||||
|
||||
const reportData = {
|
||||
...data,
|
||||
relativePosition: data.currentTime / duration,
|
||||
};
|
||||
|
||||
// data attr: currentTime, readyState, secondsToLoad, bufferCount
|
||||
console.log(`[watchman] Buffer Data:`, reportData);
|
||||
|
||||
this.bufferEventData.push(data);
|
||||
}
|
||||
|
||||
onWatchmanInterval() {
|
||||
// don't report while player is paused
|
||||
if (this.player.paused()) return;
|
||||
|
||||
// process and send watchman data here
|
||||
console.log('[watchman] interval', this.bufferEventData);
|
||||
|
||||
this.sendWatchmanData();
|
||||
|
||||
// clear processed data
|
||||
this.bufferEventData = [];
|
||||
}
|
||||
|
||||
onDispose(event) {
|
||||
// Stop analytics interval
|
||||
clearInterval(this.watchmanIntervalId);
|
||||
}
|
||||
|
||||
log(...args) {
|
||||
if (this.options_.debug) {
|
||||
console.log(`[watchman] Debug:`, JSON.stringify(args));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
videojs.registerComponent('watchman', WatchmanPlugin);
|
||||
|
||||
const onPlayerReady = (player, options) => {
|
||||
player.recsys = new WatchmanPlugin(player, options);
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize the plugin.
|
||||
*
|
||||
* @function plugin
|
||||
* @param {Object} [options={}]
|
||||
*/
|
||||
const plugin = function(options) {
|
||||
this.ready(() => {
|
||||
onPlayerReady(this, videojs.mergeOptions(defaults, options));
|
||||
});
|
||||
};
|
||||
|
||||
plugin.VERSION = VERSION;
|
||||
|
||||
registerPlugin('watchman', plugin);
|
||||
|
||||
export default plugin;
|
||||
@@ -56,7 +56,6 @@ type Props = {
|
||||
claimId: ?string,
|
||||
userId: ?number,
|
||||
allowPreRoll: ?boolean,
|
||||
shareTelemetry: boolean,
|
||||
};
|
||||
|
||||
// type VideoJSOptions = {
|
||||
@@ -194,7 +193,6 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||
claimId,
|
||||
userId,
|
||||
// allowPreRoll,
|
||||
shareTelemetry,
|
||||
} = props;
|
||||
|
||||
const [reload, setReload] = useState('initial');
|
||||
@@ -566,12 +564,11 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||
});
|
||||
|
||||
// Add recsys plugin
|
||||
if (shareTelemetry) {
|
||||
player.recsys({
|
||||
videoId: claimId,
|
||||
userId: userId,
|
||||
});
|
||||
}
|
||||
// TODO: Add an if(odysee.com) around this function to only use recsys on odysee
|
||||
player.recsys({
|
||||
videoId: claimId,
|
||||
userId: userId,
|
||||
});
|
||||
|
||||
// set playsinline for mobile
|
||||
// TODO: make this better
|
||||
|
||||
@@ -51,7 +51,6 @@ type Props = {
|
||||
authenticated: boolean,
|
||||
userId: number,
|
||||
homepageData?: { [string]: HomepageCat },
|
||||
shareTelemetry: boolean,
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -85,7 +84,6 @@ function VideoViewer(props: Props) {
|
||||
homepageData,
|
||||
authenticated,
|
||||
userId,
|
||||
shareTelemetry,
|
||||
} = props;
|
||||
|
||||
const adApprovedChannelIds = homepageData ? getAllIds(homepageData) : [];
|
||||
@@ -321,7 +319,6 @@ function VideoViewer(props: Props) {
|
||||
claimId={claimId}
|
||||
userId={userId}
|
||||
allowPreRoll={!embedded && !authenticated}
|
||||
shareTelemetry={shareTelemetry}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -98,8 +98,6 @@ export const CLEAR_CONTENT_POSITION = 'CLEAR_CONTENT_POSITION';
|
||||
export const SET_CONTENT_LAST_VIEWED = 'SET_CONTENT_LAST_VIEWED';
|
||||
export const CLEAR_CONTENT_HISTORY_URI = 'CLEAR_CONTENT_HISTORY_URI';
|
||||
export const CLEAR_CONTENT_HISTORY_ALL = 'CLEAR_CONTENT_HISTORY_ALL';
|
||||
export const RECOMMENDATION_UPDATED = 'RECOMMENDATION_UPDATED';
|
||||
export const RECOMMENDATION_CLICKED = 'RECOMMENDATION_CLICKED';
|
||||
|
||||
// Files
|
||||
export const FILE_LIST_STARTED = 'FILE_LIST_STARTED';
|
||||
|
||||
@@ -9,7 +9,7 @@ export const PAGE_PARAM = 'page';
|
||||
export const PAGE_SIZE_PARAM = 'page_size';
|
||||
|
||||
export const INVALID_NAME_ERROR =
|
||||
__('LBRY names cannot contain spaces or reserved symbols') + ' ' + '(?$#@;:/\\="<>%{}|^~[]`)';
|
||||
__('LBRY names cannot contain spaces or reserved symbols') + ' ' + '(?$#@;:/"<>%{}|^~[]`)';
|
||||
|
||||
export const FORCE_CONTENT_TYPE_PLAYER = [
|
||||
'video/quicktime',
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export const CONTAINER_ID = 'CONTAINER_ID';
|
||||
@@ -125,11 +125,9 @@ function DiscoverPage(props: Props) {
|
||||
// Assume wild west page if no dynamicRouteProps
|
||||
// Not a very good solution, but just doing it for now
|
||||
// until we are sure this page will stay around
|
||||
// TODO: find a better way to determine discover / wild west vs other modes release times
|
||||
// for now including && !tags so that
|
||||
releaseTime={
|
||||
SIMPLE_SITE
|
||||
? !dynamicRouteProps && !tags && `>${Math.floor(moment().subtract(1, 'day').startOf('week').unix())}`
|
||||
? !dynamicRouteProps && `>${Math.floor(moment().subtract(1, 'day').startOf('week').unix())}`
|
||||
: undefined
|
||||
}
|
||||
feeAmount={SIMPLE_SITE ? !dynamicRouteProps && CS.FEE_AMOUNT_ANY : undefined}
|
||||
|
||||
@@ -40,9 +40,7 @@ function TopPage(props: Props) {
|
||||
label={__('Repost Here')}
|
||||
/>
|
||||
),
|
||||
publish: (
|
||||
<Button button="secondary" onClick={() => beginPublish(queryName)} label={__('Publish Here')} />
|
||||
),
|
||||
publish: <Button button="secondary" onClick={() => beginPublish(queryName)} label={'Publish Here'} />,
|
||||
}}
|
||||
>
|
||||
%repost% %publish%
|
||||
|
||||
@@ -43,7 +43,7 @@ export function doUpdateLoadStatus(uri: string, outpoint: string) {
|
||||
full_status: true,
|
||||
page: 1,
|
||||
page_size: 1,
|
||||
}).then((result) => {
|
||||
}).then(result => {
|
||||
const { items: fileInfos } = result;
|
||||
const fileInfo = fileInfos[0];
|
||||
if (!fileInfo || fileInfo.written_bytes === 0) {
|
||||
@@ -261,21 +261,3 @@ export function doClearContentHistoryAll() {
|
||||
dispatch({ type: ACTIONS.CLEAR_CONTENT_HISTORY_ALL });
|
||||
};
|
||||
}
|
||||
|
||||
export const doRecommendationUpdate = (claimId: string, urls: Array<string>, id: string, parentId: string) => (
|
||||
dispatch: Dispatch
|
||||
) => {
|
||||
dispatch({
|
||||
type: ACTIONS.RECOMMENDATION_UPDATED,
|
||||
data: { claimId, urls, id, parentId },
|
||||
});
|
||||
};
|
||||
|
||||
export const doRecommendationClicked = (claimId: string, index: number) => (dispatch: Dispatch) => {
|
||||
if (index !== undefined && index !== null) {
|
||||
dispatch({
|
||||
type: ACTIONS.RECOMMENDATION_CLICKED,
|
||||
data: { claimId, index },
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,10 +1,9 @@
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
import { getAuthToken } from 'util/saved-passwords';
|
||||
import { doNotificationList } from 'redux/actions/notifications';
|
||||
import { SOCKETY_SERVER_API } from 'config';
|
||||
|
||||
const NOTIFICATION_WS_URL = `${SOCKETY_SERVER_API}/internal?id=`;
|
||||
const COMMENT_WS_URL = `${SOCKETY_SERVER_API}/commentron?id=`;
|
||||
const NOTIFICATION_WS_URL = 'wss://sockety.lbry.com/ws/internal?id=';
|
||||
const COMMENT_WS_URL = 'wss://sockety.lbry.com/ws/commentron?id=';
|
||||
|
||||
let sockets = {};
|
||||
let closingSockets = {};
|
||||
|
||||
@@ -7,10 +7,6 @@ const defaultState = {
|
||||
channelClaimCounts: {},
|
||||
positions: {},
|
||||
history: [],
|
||||
recommendationId: {}, // { "claimId": "recommendationId" }
|
||||
recommendationParentId: {}, // { "claimId": "referrerId" }
|
||||
recommendationUrls: {}, // { "claimId": [lbryUrls...] }
|
||||
recommendationClicks: {}, // { "claimId": [clicked indices...] }
|
||||
};
|
||||
|
||||
reducers[ACTIONS.SET_PRIMARY_URI] = (state, action) =>
|
||||
@@ -77,7 +73,7 @@ reducers[ACTIONS.SET_CONTENT_LAST_VIEWED] = (state, action) => {
|
||||
const { uri, lastViewed } = action.data;
|
||||
const { history } = state;
|
||||
const historyObj = { uri, lastViewed };
|
||||
const index = history.findIndex((i) => i.uri === uri);
|
||||
const index = history.findIndex(i => i.uri === uri);
|
||||
const newHistory =
|
||||
index === -1
|
||||
? [historyObj].concat(history)
|
||||
@@ -88,7 +84,7 @@ reducers[ACTIONS.SET_CONTENT_LAST_VIEWED] = (state, action) => {
|
||||
reducers[ACTIONS.CLEAR_CONTENT_HISTORY_URI] = (state, action) => {
|
||||
const { uri } = action.data;
|
||||
const { history } = state;
|
||||
const index = history.findIndex((i) => i.uri === uri);
|
||||
const index = history.findIndex(i => i.uri === uri);
|
||||
return index === -1
|
||||
? state
|
||||
: {
|
||||
@@ -97,44 +93,7 @@ reducers[ACTIONS.CLEAR_CONTENT_HISTORY_URI] = (state, action) => {
|
||||
};
|
||||
};
|
||||
|
||||
reducers[ACTIONS.CLEAR_CONTENT_HISTORY_ALL] = (state) => ({ ...state, history: [] });
|
||||
|
||||
reducers[ACTIONS.RECOMMENDATION_UPDATED] = (state, action) => {
|
||||
const { claimId, urls, id, parentId } = action.data;
|
||||
const recommendationId = Object.assign({}, state.recommendationId);
|
||||
const recommendationParentId = Object.assign({}, state.recommendationParentId);
|
||||
const recommendationUrls = Object.assign({}, state.recommendationUrls);
|
||||
const recommendationClicks = Object.assign({}, state.recommendationClicks);
|
||||
|
||||
if (urls && urls.length > 0) {
|
||||
recommendationId[claimId] = id;
|
||||
recommendationParentId[claimId] = parentId;
|
||||
recommendationUrls[claimId] = urls;
|
||||
recommendationClicks[claimId] = [];
|
||||
} else {
|
||||
delete recommendationId[claimId];
|
||||
delete recommendationParentId[claimId];
|
||||
delete recommendationUrls[claimId];
|
||||
delete recommendationClicks[claimId];
|
||||
}
|
||||
|
||||
return { ...state, recommendationId, recommendationParentId, recommendationUrls, recommendationClicks };
|
||||
};
|
||||
|
||||
reducers[ACTIONS.RECOMMENDATION_CLICKED] = (state, action) => {
|
||||
const { claimId, index } = action.data;
|
||||
const recommendationClicks = Object.assign({}, state.recommendationClicks);
|
||||
|
||||
if (state.recommendationUrls[claimId] && index >= 0 && index < state.recommendationUrls[claimId].length) {
|
||||
if (recommendationClicks[claimId]) {
|
||||
recommendationClicks[claimId].push(index);
|
||||
} else {
|
||||
recommendationClicks[claimId] = [index];
|
||||
}
|
||||
}
|
||||
|
||||
return { ...state, recommendationClicks };
|
||||
};
|
||||
reducers[ACTIONS.CLEAR_CONTENT_HISTORY_ALL] = state => ({ ...state, history: [] });
|
||||
|
||||
// reducers[LBRY_REDUX_ACTIONS.PURCHASE_URI_FAILED] = (state, action) => {
|
||||
// return {
|
||||
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
makeSelectFileNameForUri,
|
||||
normalizeURI,
|
||||
selectMyActiveClaims,
|
||||
selectClaimIdsByUri,
|
||||
} from 'lbry-redux';
|
||||
import { makeSelectRecommendedContentForUri } from 'redux/selectors/search';
|
||||
import { selectMutedChannels } from 'redux/selectors/blocked';
|
||||
@@ -248,37 +247,19 @@ export const makeSelectInsufficientCreditsForUri = (uri: string) =>
|
||||
);
|
||||
|
||||
export const makeSelectSigningIsMine = (rawUri: string) => {
|
||||
let uri;
|
||||
try {
|
||||
uri = normalizeURI(rawUri);
|
||||
} catch (e) {}
|
||||
|
||||
return createSelector(selectClaimsByUri, selectMyActiveClaims, (claims, myClaims) => {
|
||||
let uri;
|
||||
try {
|
||||
parseURI(uri);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
const signingChannel = claims && claims[uri] && (claims[uri].signing_channel || claims[uri]);
|
||||
uri = normalizeURI(rawUri);
|
||||
} catch (e) { }
|
||||
|
||||
return signingChannel && myClaims.has(signingChannel.claim_id);
|
||||
});
|
||||
};
|
||||
return createSelector(selectClaimsByUri, selectMyActiveClaims, (claims, myClaims) => {
|
||||
try {
|
||||
parseURI(uri);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
const signingChannel = claims && claims[uri] && (claims[uri].signing_channel || claims[uri]);
|
||||
|
||||
export const makeSelectRecommendationId = (claimId: string) =>
|
||||
createSelector(selectState, (state) => state.recommendationId[claimId]);
|
||||
|
||||
export const makeSelectRecommendationParentId = (claimId: string) =>
|
||||
createSelector(selectState, (state) => state.recommendationParentId[claimId]);
|
||||
|
||||
export const makeSelectRecommendedClaimIds = (claimId: string) =>
|
||||
createSelector(selectState, selectClaimIdsByUri, (state, claimIdsByUri) => {
|
||||
const recommendationUrls = state.recommendationUrls[claimId];
|
||||
if (recommendationUrls) {
|
||||
return recommendationUrls.map((url) => claimIdsByUri[url]);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
|
||||
export const makeSelectRecommendationClicks = (claimId: string) =>
|
||||
createSelector(selectState, (state) => state.recommendationClicks[claimId]);
|
||||
return signingChannel && myClaims.has(signingChannel.claim_id);
|
||||
});
|
||||
};
|
||||
@@ -391,11 +391,6 @@
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.card__bottom-actions--comments {
|
||||
@extend .card__bottom-actions;
|
||||
margin-top: var(--spacing-s);
|
||||
}
|
||||
|
||||
.card__multi-pane {
|
||||
display: flex;
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ $actions-z-index: 2;
|
||||
}
|
||||
|
||||
.channel__title {
|
||||
display: flex;
|
||||
display: inline;
|
||||
margin-right: var(--spacing-s);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
@@ -7,14 +7,6 @@ $thumbnailWidthSmall: 1rem;
|
||||
margin-top: var(--spacing-l);
|
||||
}
|
||||
|
||||
.comments--contracted {
|
||||
@extend .comments;
|
||||
max-height: 5rem;
|
||||
overflow: hidden;
|
||||
-webkit-mask-image: -webkit-gradient(linear, left 30%, left bottom, from(rgba(0, 0, 0, 1)), to(rgba(0, 0, 0, 0)));
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.comments--replies {
|
||||
list-style-type: none;
|
||||
margin-left: var(--spacing-s);
|
||||
|
||||
@@ -60,8 +60,3 @@
|
||||
font-size: var(--font-large);
|
||||
}
|
||||
}
|
||||
|
||||
.embed__overlay-logo {
|
||||
max-height: 3.5rem;
|
||||
max-width: 12rem;
|
||||
}
|
||||
@@ -73,8 +73,6 @@
|
||||
|
||||
.header__navigation-logo {
|
||||
height: var(--height-button);
|
||||
max-width: -webkit-fit-content;
|
||||
max-width: -moz-fit-content;
|
||||
max-width: fit-content;
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +178,6 @@ const sharedStateFilters = {
|
||||
app_welcome_version: { source: 'app', property: 'welcomeVersion' },
|
||||
sharing_3P: { source: 'app', property: 'allowAnalytics' },
|
||||
builtinCollections: { source: 'collections', property: 'builtin' },
|
||||
editedCollections: { source: 'collections', property: 'edited' },
|
||||
// savedCollections: { source: 'collections', property: 'saved' },
|
||||
unpublishedCollections: { source: 'collections', property: 'unpublished' },
|
||||
};
|
||||
|
||||
@@ -286,7 +286,7 @@ export function GetLinksData(
|
||||
? `>${Math.floor(moment().subtract(9, 'months').startOf('week').unix())}`
|
||||
: `>${Math.floor(moment().subtract(1, 'year').startOf('week').unix())}`,
|
||||
pageSize: getPageSize(subscribedChannels.length > 3 ? (subscribedChannels.length > 6 ? 16 : 8) : 4),
|
||||
streamTypes: null,
|
||||
streamTypes: CS.FILE_TYPES,
|
||||
channelIds: subscribedChannels.map((subscription: Subscription) => {
|
||||
const { channelClaimId } = parseURI(subscription.uri);
|
||||
return channelClaimId;
|
||||
|
||||
+2
-8
@@ -3,10 +3,7 @@ const { URL, LBRY_WEB_STREAMING_API } = require('../../config');
|
||||
const CONTINENT_COOKIE = 'continent';
|
||||
|
||||
function generateStreamUrl(claimName, claimId) {
|
||||
return `${LBRY_WEB_STREAMING_API}/content/claims/${encodeURIComponent(claimName)
|
||||
.replace(/'/g, '%27')
|
||||
.replace(/\(/g, '%28')
|
||||
.replace(/\)/g, '%29')}/${claimId}/stream`;
|
||||
return `${LBRY_WEB_STREAMING_API}/content/claims/${claimName}/${claimId}/stream`;
|
||||
}
|
||||
|
||||
function generateEmbedUrl(claimName, claimId, includeStartTime, startTime, referralLink) {
|
||||
@@ -19,10 +16,7 @@ function generateEmbedUrl(claimName, claimId, includeStartTime, startTime, refer
|
||||
urlParams.append('r', referralLink);
|
||||
}
|
||||
|
||||
return `${URL}/$/embed/${encodeURIComponent(claimName)
|
||||
.replace(/'/g, '%27')
|
||||
.replace(/\(/g, '%28')
|
||||
.replace(/\)/g, '%29')}/${claimId}?${urlParams.toString()}`;
|
||||
return `${URL}/$/embed/${encodeURIComponent(claimName).replace(/'/g, '%27')}/${claimId}?${urlParams.toString()}`;
|
||||
}
|
||||
|
||||
function generateDownloadUrl(claimName, claimId) {
|
||||
|
||||
@@ -38,7 +38,7 @@ function FileViewerEmbeddedEnded(props: Props) {
|
||||
<div className="file-viewer__overlay">
|
||||
<div className="file-viewer__overlay-secondary">
|
||||
<Button className="file-viewer__overlay-logo" href={URL}>
|
||||
<Logo type={'embed-ended'} />
|
||||
<Logo type={'embed'} />
|
||||
</Button>
|
||||
</div>
|
||||
<div className="file-viewer__overlay-title">{prompt}</div>
|
||||
|
||||
+7
-11
@@ -23,17 +23,13 @@ const { getJsBundleId } = require('../bundle-id.js');
|
||||
const jsBundleId = getJsBundleId();
|
||||
|
||||
function insertToHead(fullHtml, htmlToInsert) {
|
||||
const beginStr = '<!-- VARIABLE_HEAD_BEGIN -->';
|
||||
const finalStr = '<!-- VARIABLE_HEAD_END -->';
|
||||
|
||||
const beginIndex = fullHtml.indexOf(beginStr);
|
||||
const finalIndex = fullHtml.indexOf(finalStr);
|
||||
|
||||
if (beginIndex > -1 && finalIndex > -1 && finalIndex > beginIndex) {
|
||||
return `${fullHtml.slice(0, beginIndex)}${
|
||||
htmlToInsert || buildOgMetadata()
|
||||
}<script src="/public/ui-${jsBundleId}.js" async></script>${fullHtml.slice(finalIndex + finalStr.length)}`;
|
||||
}
|
||||
return fullHtml.replace(
|
||||
/<!-- VARIABLE_HEAD_BEGIN -->.*<!-- VARIABLE_HEAD_END -->/s,
|
||||
`
|
||||
${htmlToInsert || buildOgMetadata()}
|
||||
<script src="/public/ui-${jsBundleId}.js" async></script>
|
||||
`
|
||||
);
|
||||
}
|
||||
|
||||
function truncateDescription(description) {
|
||||
|
||||
+3
-5
@@ -19,11 +19,9 @@ function getStreamUrl(ctx) {
|
||||
}
|
||||
|
||||
const rssMiddleware = async (ctx) => {
|
||||
const rss = await getRss(ctx);
|
||||
if (rss.startsWith('<?xml')) {
|
||||
ctx.set('Content-Type', 'application/xml');
|
||||
}
|
||||
ctx.body = rss;
|
||||
const xml = await getRss(ctx);
|
||||
ctx.set('Content-Type', 'application/rss+xml');
|
||||
ctx.body = xml;
|
||||
};
|
||||
|
||||
router.get(`/$/api/content/v1/get`, async (ctx) => {
|
||||
|
||||
+75
-201
@@ -1,7 +1,7 @@
|
||||
const { generateStreamUrl } = require('../../ui/util/web');
|
||||
const { URL, SITE_NAME, LBRY_WEB_API } = require('../../config.js');
|
||||
const { generateDownloadUrl } = require('../../ui/util/web');
|
||||
const { URL, SITE_NAME, LBRY_WEB_API, FAVICON } = require('../../config.js');
|
||||
const { Lbry } = require('lbry-redux');
|
||||
const Rss = require('rss');
|
||||
const Feed = require('feed').Feed;
|
||||
|
||||
const SDK_API_PATH = `${LBRY_WEB_API}/api/v1`;
|
||||
const proxyURL = `${SDK_API_PATH}/proxy`;
|
||||
@@ -9,10 +9,6 @@ Lbry.setDaemonConnectionString(proxyURL);
|
||||
|
||||
const NUM_ENTRIES = 500;
|
||||
|
||||
// ****************************************************************************
|
||||
// Fetch claim info
|
||||
// ****************************************************************************
|
||||
|
||||
async function doClaimSearch(options) {
|
||||
let results;
|
||||
try {
|
||||
@@ -23,21 +19,15 @@ async function doClaimSearch(options) {
|
||||
|
||||
async function getChannelClaim(name, claimId) {
|
||||
let claim;
|
||||
let error;
|
||||
|
||||
try {
|
||||
const url = `lbry://${name}#${claimId}`;
|
||||
const response = await Lbry.resolve({ urls: [url] });
|
||||
|
||||
if (response && response[url] && !response[url].error) {
|
||||
claim = response && response[url];
|
||||
}
|
||||
} catch {}
|
||||
|
||||
if (!claim) {
|
||||
error = 'The RSS URL is invalid or is not associated with any channel.';
|
||||
}
|
||||
|
||||
return { claim, error };
|
||||
return claim || 'The RSS URL is invalid or is not associated with any channel.';
|
||||
}
|
||||
|
||||
async function getClaimsFromChannel(claimId, count) {
|
||||
@@ -46,226 +36,110 @@ async function getClaimsFromChannel(claimId, count) {
|
||||
page_size: count,
|
||||
has_source: true,
|
||||
claim_type: 'stream',
|
||||
order_by: ['release_time'],
|
||||
order_by: ['creation_timestamp'],
|
||||
no_totals: true,
|
||||
};
|
||||
|
||||
return await doClaimSearch(options);
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// Helpers
|
||||
// ****************************************************************************
|
||||
async function getFeed(channelClaim, feedLink) {
|
||||
const replaceLineFeeds = (str) => str.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
||||
|
||||
const generateEnclosureForClaimContent = (claim) => {
|
||||
const value = claim.value;
|
||||
if (!value || !value.stream_type) {
|
||||
return undefined;
|
||||
}
|
||||
const fmtDescription = (description) => replaceLineFeeds(description);
|
||||
|
||||
switch (value.stream_type) {
|
||||
case 'video':
|
||||
case 'audio':
|
||||
case 'image':
|
||||
case 'document':
|
||||
case 'software':
|
||||
return {
|
||||
url:
|
||||
generateStreamUrl(claim.name, claim.claim_id) + (value.source && value.source.media_type.split('/')[0]) || '',
|
||||
type: (value.source && value.source.media_type) || undefined,
|
||||
size: (value.source && value.source.size) || 0, // Per spec, 0 is a valid fallback.
|
||||
};
|
||||
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
const getLanguageValue = (claim) => {
|
||||
if (claim && claim.value && claim.value.languages && claim.value.languages.length > 0) {
|
||||
return claim.value.languages[0];
|
||||
}
|
||||
return 'en';
|
||||
};
|
||||
|
||||
const replaceLineFeeds = (str) => str.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
||||
|
||||
const isEmailRoughlyValid = (email) => /^\S+@\S+$/.test(email);
|
||||
|
||||
/**
|
||||
* 'itunes:owner' is required by castfeedvalidator (w3c allows omission), and
|
||||
* both name and email must be defined. The email must also be a "valid" one.
|
||||
*
|
||||
* Use a fallback email when the creator did not specify one. The email will not
|
||||
* be shown to the user; it is just used for administrative purposes.
|
||||
*
|
||||
* @param claim
|
||||
* @returns any
|
||||
*/
|
||||
const generateItunesOwnerElement = (claim) => {
|
||||
let name = '---';
|
||||
let email = 'no-reply@odysee.com';
|
||||
|
||||
if (claim && claim.value) {
|
||||
name = claim.name;
|
||||
if (isEmailRoughlyValid(claim.value.email)) {
|
||||
email = claim.value.email;
|
||||
const sanitizeThumbsUrl = (url) => {
|
||||
if (typeof url === 'string' && url.startsWith('https://')) {
|
||||
return encodeURI(url).replace(/&/g, '%26');
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
'itunes:owner': [{ 'itunes:name': name }, { 'itunes:email': email }],
|
||||
return '';
|
||||
};
|
||||
};
|
||||
|
||||
const generateItunesExplicitElement = (claim) => {
|
||||
const tags = (claim && claim.value && claim.tags) || [];
|
||||
return { 'itunes:explicit': tags.includes('mature') ? 'yes' : 'no' };
|
||||
};
|
||||
|
||||
const getItunesCategory = (claim) => {
|
||||
const itunesCategories = [
|
||||
'Arts',
|
||||
'Business',
|
||||
'Comedy',
|
||||
'Education',
|
||||
'Fiction',
|
||||
'Government',
|
||||
'History',
|
||||
'Health & Fitness',
|
||||
'Kids & Family',
|
||||
'Leisure',
|
||||
'Music',
|
||||
'News',
|
||||
'Religion & Spirituality',
|
||||
'Science',
|
||||
'Society & Culture',
|
||||
'Sports',
|
||||
'Technology',
|
||||
'True Crime',
|
||||
'TV & Film',
|
||||
];
|
||||
|
||||
const tags = (claim && claim.value && claim.tags) || [];
|
||||
for (let i = 0; i < tags.length; ++i) {
|
||||
const tag = tags[i];
|
||||
if (itunesCategories.includes(tag)) {
|
||||
// "Note: Although you can specify more than one category and subcategory
|
||||
// in your RSS feed, Apple Podcasts only recognizes the first category and
|
||||
// subcategory."
|
||||
// --> The only parse the first found tag.
|
||||
return tag.replace('&', '&');
|
||||
const getEnclosure = (claim) => {
|
||||
const value = claim.value;
|
||||
if (!value || !value.stream_type || !value.source || !value.source.media_type) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
// itunes will not accept any other categories, and the element is required
|
||||
// to pass castfeedvalidator. So, fallback to 'Leisure' (closes to "General")
|
||||
// if the creator did not specify a tag.
|
||||
return 'Leisure';
|
||||
};
|
||||
switch (value.stream_type) {
|
||||
case 'video':
|
||||
case 'audio':
|
||||
case 'image':
|
||||
case 'document':
|
||||
case 'software':
|
||||
return {
|
||||
url: encodeURI(generateDownloadUrl(claim.name, claim.claim_id)),
|
||||
type: value.source.media_type,
|
||||
length: value.source.size || 0, // Per spec, 0 is a valid fallback.
|
||||
};
|
||||
|
||||
const generateItunesDurationElement = (claim) => {
|
||||
let duration;
|
||||
if (claim && claim.value) {
|
||||
if (claim.value.video) {
|
||||
duration = claim.value.video.duration;
|
||||
} else if (claim.value.audio) {
|
||||
duration = claim.value.audio.duration;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (duration) {
|
||||
return { 'itunes:duration': `${duration}` };
|
||||
}
|
||||
};
|
||||
const value = channelClaim.value;
|
||||
const title = value ? value.title : channelClaim.name;
|
||||
|
||||
const generateItunesImageElement = (claim) => {
|
||||
const thumbnailUrl = (claim && claim.value && claim.value.thumbnail && claim.value.thumbnail.url) || '';
|
||||
if (thumbnailUrl) {
|
||||
return {
|
||||
'itunes:image': { _attr: { href: thumbnailUrl } },
|
||||
};
|
||||
}
|
||||
};
|
||||
const options = {
|
||||
favicon: FAVICON || URL + '/public/favicon.png',
|
||||
generator: SITE_NAME + ' RSS Feed',
|
||||
title: title + ' on ' + SITE_NAME,
|
||||
description: fmtDescription(value && value.description ? value.description : ''),
|
||||
link: encodeURI(`${URL}/${channelClaim.name}:${channelClaim.claim_id}`),
|
||||
image: sanitizeThumbsUrl(value && value.thumbnail ? value.thumbnail.url : ''),
|
||||
feedLinks: {
|
||||
rss: encodeURI(feedLink),
|
||||
},
|
||||
author: {
|
||||
name: encodeURI(channelClaim.name),
|
||||
link: encodeURI(URL + '/' + channelClaim.name + ':' + channelClaim.claim_id),
|
||||
},
|
||||
};
|
||||
|
||||
const getFormattedDescription = (claim) => {
|
||||
return replaceLineFeeds((claim && claim.value && claim.value.description) || '');
|
||||
};
|
||||
const feed = new Feed(options);
|
||||
const latestClaims = await getClaimsFromChannel(channelClaim.claim_id, NUM_ENTRIES);
|
||||
|
||||
// ****************************************************************************
|
||||
// Generate
|
||||
// ****************************************************************************
|
||||
latestClaims.forEach((c) => {
|
||||
const meta = c.meta;
|
||||
const value = c.value;
|
||||
|
||||
function generateFeed(feedLink, channelClaim, claimsInChannel) {
|
||||
// --- Channel ---
|
||||
const feed = new Rss({
|
||||
title: ((channelClaim.value && channelClaim.value.title) || channelClaim.name) + ' on ' + SITE_NAME,
|
||||
description: getFormattedDescription(channelClaim),
|
||||
feed_url: feedLink,
|
||||
site_url: URL,
|
||||
image_url: (channelClaim.value && channelClaim.value.thumbnail && channelClaim.value.thumbnail.url) || undefined,
|
||||
language: getLanguageValue(channelClaim),
|
||||
custom_namespaces: { itunes: 'http://www.itunes.com/dtds/podcast-1.0.dtd' },
|
||||
custom_elements: [
|
||||
{ 'itunes:author': channelClaim.name },
|
||||
{
|
||||
'itunes:category': [
|
||||
{
|
||||
_attr: {
|
||||
text: getItunesCategory(channelClaim),
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
generateItunesImageElement(channelClaim),
|
||||
generateItunesOwnerElement(channelClaim),
|
||||
generateItunesExplicitElement(channelClaim),
|
||||
],
|
||||
});
|
||||
const title = value && value.title ? value.title : c.name;
|
||||
const thumbnailUrl = value && value.thumbnail ? value.thumbnail.url : '';
|
||||
const thumbnailHtml = thumbnailUrl ? `<p><img src="${thumbnailUrl}" alt="thumbnail" title="${title}" /></p>` : '';
|
||||
|
||||
// --- Content ---
|
||||
claimsInChannel.forEach((c) => {
|
||||
const title = (c.value && c.value.title) || c.name;
|
||||
const thumbnailUrl = (c.value && c.value.thumbnail && c.value.thumbnail.url) || '';
|
||||
const thumbnailHtml = thumbnailUrl
|
||||
? `<p><img src="${thumbnailUrl}" width="480" alt="thumbnail" title="${title}" /></p>`
|
||||
: '';
|
||||
const description = thumbnailHtml + getFormattedDescription(c);
|
||||
|
||||
feed.item({
|
||||
title: title,
|
||||
description: description,
|
||||
url: `${URL}/${c.name}:${c.claim_id}`,
|
||||
guid: undefined, // defaults to 'url'
|
||||
author: undefined, // defaults feed author property
|
||||
date: new Date(c.meta ? c.meta.creation_timestamp * 1000 : null),
|
||||
enclosure: generateEnclosureForClaimContent(c),
|
||||
custom_elements: [
|
||||
{ 'itunes:title': title },
|
||||
{ 'itunes:author': channelClaim.name },
|
||||
generateItunesImageElement(c),
|
||||
generateItunesDurationElement(c),
|
||||
generateItunesExplicitElement(c),
|
||||
],
|
||||
feed.addItem({
|
||||
id: c.claim_id,
|
||||
guid: encodeURI(URL + '/' + c.name + ':' + c.claim_id),
|
||||
title: value && value.title ? value.title : c.name,
|
||||
description: thumbnailHtml + fmtDescription(value && value.description ? value.description : ''),
|
||||
link: encodeURI(URL + '/' + c.name + ':' + c.claim_id),
|
||||
date: new Date(meta ? meta.creation_timestamp * 1000 : null),
|
||||
enclosure: getEnclosure(c),
|
||||
});
|
||||
});
|
||||
|
||||
return feed;
|
||||
}
|
||||
|
||||
function postProcess(feed) {
|
||||
// Handle 'Feed' creating an invalid MIME type when trying to guess
|
||||
// from 'https://thumbnails.lbry.com/UCgQ8eREJzR1dO' style of URLs.
|
||||
return feed.replace(/type="image\/\/.*"\/>/g, 'type="image/*"/>');
|
||||
}
|
||||
|
||||
async function getRss(ctx) {
|
||||
if (!ctx.params.claimName || !ctx.params.claimId) {
|
||||
return 'Invalid URL';
|
||||
}
|
||||
|
||||
const { claim: channelClaim, error } = await getChannelClaim(ctx.params.claimName, ctx.params.claimId);
|
||||
if (error) {
|
||||
return error;
|
||||
const channelClaim = await getChannelClaim(ctx.params.claimName, ctx.params.claimId);
|
||||
if (typeof channelClaim === 'string' || !channelClaim) {
|
||||
return channelClaim;
|
||||
}
|
||||
|
||||
const latestClaimsInChannel = await getClaimsFromChannel(channelClaim.claim_id, NUM_ENTRIES);
|
||||
const feed = generateFeed(`${URL}${ctx.request.url}`, channelClaim, latestClaimsInChannel);
|
||||
return feed.xml();
|
||||
const feed = await getFeed(channelClaim, `${URL}${ctx.request.url}`);
|
||||
return postProcess(feed.rss2());
|
||||
}
|
||||
|
||||
module.exports = { getRss };
|
||||
+15
-15
@@ -1548,9 +1548,9 @@ chokidar@^2.0.2, chokidar@^2.1.8:
|
||||
fsevents "^1.2.7"
|
||||
|
||||
chownr@^1.1.1:
|
||||
version "1.1.4"
|
||||
resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b"
|
||||
integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.3.tgz#42d837d5239688d55f303003a508230fa6727142"
|
||||
integrity sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==
|
||||
|
||||
chrome-trace-event@^1.0.2:
|
||||
version "1.0.2"
|
||||
@@ -3589,16 +3589,16 @@ minimatch@^3.0.4:
|
||||
dependencies:
|
||||
brace-expansion "^1.1.7"
|
||||
|
||||
minimist@0.0.8:
|
||||
version "0.0.8"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
|
||||
integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=
|
||||
|
||||
minimist@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
|
||||
integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=
|
||||
|
||||
minimist@^1.2.5:
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
|
||||
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
|
||||
|
||||
minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0:
|
||||
version "2.9.0"
|
||||
resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6"
|
||||
@@ -3639,11 +3639,11 @@ mixin-deep@^1.2.0:
|
||||
is-extendable "^1.0.1"
|
||||
|
||||
mkdirp@^0.5.0, mkdirp@^0.5.1:
|
||||
version "0.5.5"
|
||||
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def"
|
||||
integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==
|
||||
version "0.5.1"
|
||||
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
|
||||
integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=
|
||||
dependencies:
|
||||
minimist "^1.2.5"
|
||||
minimist "0.0.8"
|
||||
|
||||
moment@^2.22.1:
|
||||
version "2.27.0"
|
||||
@@ -5080,9 +5080,9 @@ tapable@^1.0.0, tapable@^1.1.3:
|
||||
integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==
|
||||
|
||||
tar@^4:
|
||||
version "4.4.15"
|
||||
resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.15.tgz#3caced4f39ebd46ddda4d6203d48493a919697f8"
|
||||
integrity sha512-ItbufpujXkry7bHH9NpQyTXPbJ72iTlXgkBAYsAjDXk3Ds8t/3NfO5P4xZGy7u+sYuQUbimgzswX4uQIEeNVOA==
|
||||
version "4.4.13"
|
||||
resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525"
|
||||
integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==
|
||||
dependencies:
|
||||
chownr "^1.1.1"
|
||||
fs-minipass "^1.2.5"
|
||||
|
||||
@@ -7205,6 +7205,13 @@ fd-slicer@~1.1.0:
|
||||
dependencies:
|
||||
pend "~1.2.0"
|
||||
|
||||
feed@^4.2.2:
|
||||
version "4.2.2"
|
||||
resolved "https://registry.yarnpkg.com/feed/-/feed-4.2.2.tgz#865783ef6ed12579e2c44bbef3c9113bc4956a7e"
|
||||
integrity sha512-u5/sxGfiMfZNtJ3OvQpXcvotFpYkL0n9u9mM2vkui2nGo8b4wvDkJ8gAkYqbA8QpGyFCv3RK0Z+Iv+9veCS9bQ==
|
||||
dependencies:
|
||||
xml-js "^1.6.11"
|
||||
|
||||
figgy-pudding@^3.5.1:
|
||||
version "3.5.2"
|
||||
resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.2.tgz#b4eee8148abb01dcf1d1ac34367d59e12fa61d6e"
|
||||
@@ -10129,9 +10136,9 @@ lazy-val@^1.0.4:
|
||||
yargs "^13.2.2"
|
||||
zstd-codec "^0.1.1"
|
||||
|
||||
lbry-redux@lbryio/lbry-redux#7cc9923ed9ff1940b508842af6be44c8da906a60:
|
||||
lbry-redux@lbryio/lbry-redux#a327385cdf71568dbd15a17f3dcf5f4b83e0966d:
|
||||
version "0.0.1"
|
||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/7cc9923ed9ff1940b508842af6be44c8da906a60"
|
||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/a327385cdf71568dbd15a17f3dcf5f4b83e0966d"
|
||||
dependencies:
|
||||
proxy-polyfill "0.1.6"
|
||||
reselect "^3.0.0"
|
||||
@@ -10901,18 +10908,6 @@ mime-db@1.48.0:
|
||||
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.48.0.tgz#e35b31045dd7eada3aaad537ed88a33afbef2d1d"
|
||||
integrity sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ==
|
||||
|
||||
mime-db@~1.25.0:
|
||||
version "1.25.0"
|
||||
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.25.0.tgz#c18dbd7c73a5dbf6f44a024dc0d165a1e7b1c392"
|
||||
integrity sha1-wY29fHOl2/b0SgJNwNFloeexw5I=
|
||||
|
||||
mime-types@2.1.13:
|
||||
version "2.1.13"
|
||||
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.13.tgz#e07aaa9c6c6b9a7ca3012c69003ad25a39e92a88"
|
||||
integrity sha1-4HqqnGxrmnyjASxpADrSWjnpKog=
|
||||
dependencies:
|
||||
mime-db "~1.25.0"
|
||||
|
||||
mime-types@^2.1.12, mime-types@~2.1.19:
|
||||
version "2.1.31"
|
||||
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.31.tgz#a00d76b74317c61f9c2db2218b8e9f8e9c5c9e6b"
|
||||
@@ -14312,14 +14307,6 @@ roarr@^2.15.3:
|
||||
semver-compare "^1.0.0"
|
||||
sprintf-js "^1.1.2"
|
||||
|
||||
rss@^1.2.2:
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/rss/-/rss-1.2.2.tgz#50a1698876138133a74f9a05d2bdc8db8d27a921"
|
||||
integrity sha1-UKFpiHYTgTOnT5oF0r3I240nqSE=
|
||||
dependencies:
|
||||
mime-types "2.1.13"
|
||||
xml "1.0.1"
|
||||
|
||||
rtlcss@2.5.0:
|
||||
version "2.5.0"
|
||||
resolved "https://registry.yarnpkg.com/rtlcss/-/rtlcss-2.5.0.tgz#455549e49113f9e1cf83169a44de526c816de8a4"
|
||||
@@ -17221,16 +17208,18 @@ xdg-basedir@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-4.0.0.tgz#4bc8d9984403696225ef83a1573cbbcb4e79db13"
|
||||
|
||||
xml-js@^1.6.11:
|
||||
version "1.6.11"
|
||||
resolved "https://registry.yarnpkg.com/xml-js/-/xml-js-1.6.11.tgz#927d2f6947f7f1c19a316dd8eea3614e8b18f8e9"
|
||||
integrity sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==
|
||||
dependencies:
|
||||
sax "^1.2.4"
|
||||
|
||||
xml-name-validator@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-2.0.1.tgz#4d8b8f1eccd3419aa362061becef515e1e559635"
|
||||
integrity sha1-TYuPHszTQZqjYgYb7O9RXh5VljU=
|
||||
|
||||
xml@1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"
|
||||
integrity sha1-eLpyAgApxbyHuKgaPPzXS0ovweU=
|
||||
|
||||
xmlbuilder@^10.0.0:
|
||||
version "10.1.1"
|
||||
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-10.1.1.tgz#8cae6688cc9b38d850b7c8d3c0a4161dcaf475b0"
|
||||
|
||||
Reference in new issue
Block a user