mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-23 17:47:24 +00:00
Naomi comment websockets increase slow mode time to 5 seconds fix to prevent duplicate comments update livestream details fix channel pin electron boom fix rebase prune unused icons updating meme updating meme update livestream for naomi fix rebase DigitalCashNetwork remove electroboom pin Slavguns Joel So he can edit his claims add streamTypes param to claimTilesDiscover so following section can search for all types of content fix typo update meme fixes publish page fixes pending fix notifications fix comments finally fix claim preview no mature for simplesite Revert "no mature for simplesite" This reverts commit 9f89242d85e0cacf44cbf0a683bebbe50840c466. fix livestream preview click no mature on simple site try fixing invite page crash probably needs more changes.
81 lines
2.7 KiB
JavaScript
81 lines
2.7 KiB
JavaScript
import * as PAGES from 'constants/pages';
|
|
import { DOMAIN } from 'config';
|
|
import { connect } from 'react-redux';
|
|
import { PAGE_SIZE } from 'constants/claim';
|
|
import {
|
|
doResolveUri,
|
|
makeSelectClaimForUri,
|
|
makeSelectIsUriResolving,
|
|
makeSelectTotalPagesForChannel,
|
|
makeSelectTitleForUri,
|
|
normalizeURI,
|
|
makeSelectClaimIsMine,
|
|
makeSelectClaimIsPending,
|
|
makeSelectClaimIsStreamPlaceholder,
|
|
doClearPublish,
|
|
doPrepareEdit,
|
|
} from 'lbry-redux';
|
|
import { push } from 'connected-react-router';
|
|
import { makeSelectChannelInSubscriptions } from 'redux/selectors/subscriptions';
|
|
import { selectBlackListedOutpoints } from 'lbryinc';
|
|
import ShowPage from './view';
|
|
|
|
const select = (state, props) => {
|
|
const { pathname, hash, search } = props.location;
|
|
const urlPath = pathname + hash;
|
|
// Remove the leading "/" added by the browser
|
|
let path = urlPath.slice(1).replace(/:/g, '#');
|
|
|
|
// Google cache url
|
|
// ex: webcache.googleusercontent.com/search?q=cache:MLwN3a8fCbYJ:https://lbry.tv/%40Bombards_Body_Language:f+&cd=12&hl=en&ct=clnk&gl=us
|
|
// Extract the lbry url and use that instead
|
|
// Without this it will try to render lbry://search
|
|
if (search && search.startsWith('?q=cache:')) {
|
|
const googleCacheRegex = new RegExp(`(https://${DOMAIN}/)([^+]*)`);
|
|
const [x, y, googleCachedUrl] = search.match(googleCacheRegex); // eslint-disable-line
|
|
if (googleCachedUrl) {
|
|
const actualUrl = decodeURIComponent(googleCachedUrl);
|
|
if (actualUrl) {
|
|
path = actualUrl.replace(/:/g, '#');
|
|
}
|
|
}
|
|
}
|
|
|
|
let uri;
|
|
try {
|
|
uri = normalizeURI(path);
|
|
} catch (e) {
|
|
const match = path.match(/[#/:]/);
|
|
|
|
if (path === '$/') {
|
|
props.history.replace(`/`);
|
|
} else if (!path.startsWith('$/') && match && match.index) {
|
|
uri = `lbry://${path.slice(0, match.index)}`;
|
|
props.history.replace(`/${path.slice(0, match.index)}`);
|
|
}
|
|
}
|
|
|
|
return {
|
|
uri,
|
|
claim: makeSelectClaimForUri(uri)(state),
|
|
isResolvingUri: makeSelectIsUriResolving(uri)(state),
|
|
blackListedOutpoints: selectBlackListedOutpoints(state),
|
|
totalPages: makeSelectTotalPagesForChannel(uri, PAGE_SIZE)(state),
|
|
isSubscribed: makeSelectChannelInSubscriptions(uri)(state),
|
|
title: makeSelectTitleForUri(uri)(state),
|
|
claimIsMine: makeSelectClaimIsMine(uri)(state),
|
|
claimIsPending: makeSelectClaimIsPending(uri)(state),
|
|
isLivestream: makeSelectClaimIsStreamPlaceholder(uri)(state),
|
|
};
|
|
};
|
|
|
|
const perform = (dispatch) => ({
|
|
resolveUri: (uri) => dispatch(doResolveUri(uri)),
|
|
beginPublish: (name) => {
|
|
dispatch(doClearPublish());
|
|
dispatch(doPrepareEdit({ name }));
|
|
dispatch(push(`/$/${PAGES.PUBLISH}`));
|
|
},
|
|
});
|
|
|
|
export default connect(select, perform)(ShowPage);
|