replaced all /asset/ urls with .ext urls

This commit is contained in:
bill bittner 2018-07-17 14:53:26 -07:00
parent 4cd3eb851a
commit ce26bc89b8
6 changed files with 11 additions and 11 deletions

View file

@ -60,6 +60,7 @@ function (_React$Component) {
contentType = _this$props$asset$cla2.contentType, contentType = _this$props$asset$cla2.contentType,
fileExt = _this$props$asset$cla2.fileExt, fileExt = _this$props$asset$cla2.fileExt,
thumbnail = _this$props$asset$cla2.thumbnail; thumbnail = _this$props$asset$cla2.thumbnail;
var sourceUrl = "/".concat(claimId, "/").concat(name, ".").concat(fileExt);
return _react.default.createElement("div", { return _react.default.createElement("div", {
className: 'asset-display' className: 'asset-display'
}, status === _asset_display_states.LOCAL_CHECK && _react.default.createElement("div", null, _react.default.createElement("p", null, "Checking to see if Spee.ch has your asset locally...")), status === _asset_display_states.UNAVAILABLE && _react.default.createElement("div", null, _react.default.createElement("p", null, "Sit tight, we're searching the LBRY blockchain for your asset!"), _react.default.createElement(_ProgressBar.default, { }, status === _asset_display_states.LOCAL_CHECK && _react.default.createElement("div", null, _react.default.createElement("p", null, "Checking to see if Spee.ch has your asset locally...")), status === _asset_display_states.UNAVAILABLE && _react.default.createElement("div", null, _react.default.createElement("p", null, "Sit tight, we're searching the LBRY blockchain for your asset!"), _react.default.createElement(_ProgressBar.default, {
@ -82,7 +83,7 @@ function (_React$Component) {
case 'image/gif': case 'image/gif':
return _react.default.createElement("img", { return _react.default.createElement("img", {
className: "asset-image", className: "asset-image",
src: "/asset/".concat(name, "/").concat(claimId), src: sourceUrl,
alt: name alt: name
}); });
@ -92,11 +93,11 @@ function (_React$Component) {
controls: true, controls: true,
poster: thumbnail poster: thumbnail
}, _react.default.createElement("source", { }, _react.default.createElement("source", {
src: "/asset/".concat(name, "/").concat(claimId) src: sourceUrl
}), _react.default.createElement("p", null, "Your browser does not support the ", _react.default.createElement("code", null, "video"), " element.")); }), _react.default.createElement("p", null, "Your browser does not support the ", _react.default.createElement("code", null, "video"), " element."));
default: default:
return _react.default.createElement("p", null, "Unsupported file type"); return _react.default.createElement("p", null, "Unsupported content type");
} }
}()); }());
} }

View file

@ -103,7 +103,7 @@ var createAssetMetaTags = function createAssetMetaTags(_ref3) {
var contentType = claimData.contentType; var contentType = claimData.contentType;
var videoEmbedUrl = "".concat(siteHost, "/video-embed/").concat(claimData.name, "/").concat(claimData.claimId); var videoEmbedUrl = "".concat(siteHost, "/video-embed/").concat(claimData.name, "/").concat(claimData.claimId);
var showUrl = "".concat(siteHost, "/").concat(claimData.claimId, "/").concat(claimData.name); var showUrl = "".concat(siteHost, "/").concat(claimData.claimId, "/").concat(claimData.name);
var source = "".concat(siteHost, "/asset/").concat(claimData.name, "/").concat(claimData.claimId); var source = "".concat(siteHost, "/").concat(claimData.claimId, "/").concat(claimData.name, ".").concat(claimData.fileExt);
var ogTitle = claimData.title || claimData.name; var ogTitle = claimData.title || claimData.name;
var ogDescription = claimData.description || defaultDescription; var ogDescription = claimData.description || defaultDescription;
var ogThumbnailContentType = determineOgThumbnailContentType(claimData.thumbnail); var ogThumbnailContentType = determineOgThumbnailContentType(claimData.thumbnail);

View file

@ -9,6 +9,7 @@ class AssetDisplay extends React.Component {
} }
render () { render () {
const { status, error, asset: { claimData: { name, claimId, contentType, fileExt, thumbnail } } } = this.props; const { status, error, asset: { claimData: { name, claimId, contentType, fileExt, thumbnail } } } = this.props;
const sourceUrl = `/${claimId}/${name}.${fileExt}`;
return ( return (
<div className={'asset-display'}> <div className={'asset-display'}>
{(status === LOCAL_CHECK) && {(status === LOCAL_CHECK) &&
@ -39,7 +40,7 @@ class AssetDisplay extends React.Component {
return ( return (
<img <img
className='asset-image' className='asset-image'
src={`/asset/${name}/${claimId}`} src={sourceUrl}
alt={name} alt={name}
/> />
); );
@ -50,14 +51,14 @@ class AssetDisplay extends React.Component {
controls poster={thumbnail} controls poster={thumbnail}
> >
<source <source
src={`/asset/${name}/${claimId}`} src={sourceUrl}
/> />
<p>Your browser does not support the <code>video</code> element.</p> <p>Your browser does not support the <code>video</code> element.</p>
</video> </video>
); );
default: default:
return ( return (
<p>Unsupported file type</p> <p>Unsupported content type</p>
); );
} }
})() })()

View file

@ -48,7 +48,7 @@ const createAssetMetaTags = ({siteHost, siteTitle, siteTwitter, asset, defaultDe
const { contentType } = claimData; const { contentType } = claimData;
const videoEmbedUrl = `${siteHost}/video-embed/${claimData.name}/${claimData.claimId}`; const videoEmbedUrl = `${siteHost}/video-embed/${claimData.name}/${claimData.claimId}`;
const showUrl = `${siteHost}/${claimData.claimId}/${claimData.name}`; const showUrl = `${siteHost}/${claimData.claimId}/${claimData.name}`;
const source = `${siteHost}/asset/${claimData.name}/${claimData.claimId}`; const source = `${siteHost}/${claimData.claimId}/${claimData.name}.${claimData.fileExt}`;
const ogTitle = claimData.title || claimData.name; const ogTitle = claimData.title || claimData.name;
const ogDescription = claimData.description || defaultDescription; const ogDescription = claimData.description || defaultDescription;
const ogThumbnailContentType = determineOgThumbnailContentType(claimData.thumbnail); const ogThumbnailContentType = determineOgThumbnailContentType(claimData.thumbnail);

View file

@ -1,9 +1,7 @@
const serveByClaim = require('../../controllers/assets/serveByClaim'); const serveByClaim = require('../../controllers/assets/serveByClaim');
const serveByIdentifierAndClaim = require('../../controllers/assets/serveByIdentifierAndClaim'); const serveByIdentifierAndClaim = require('../../controllers/assets/serveByIdentifierAndClaim');
const serveAsset = require('../../controllers/assets/serveAsset');
module.exports = (app) => { module.exports = (app) => {
app.get('/asset/:claimName/:claimId/', serveAsset);
app.get('/:identifier/:claim', serveByIdentifierAndClaim); app.get('/:identifier/:claim', serveByIdentifierAndClaim);
app.get('/:claim', serveByClaim); app.get('/:claim', serveByClaim);
}; };

View file

@ -1 +1 @@
<video width="100%" controls src="{{host}}/asset/{{name}}/{{claimId}}" type="video/mp4"></video> <video width="100%" controls src="{{host}}/{{claimId}}/{{name}}.mp4" type="video/mp4"></video>