serve static assets on urls with file extension #538
6 changed files with 11 additions and 11 deletions
|
@ -60,6 +60,7 @@ function (_React$Component) {
|
|||
contentType = _this$props$asset$cla2.contentType,
|
||||
fileExt = _this$props$asset$cla2.fileExt,
|
||||
thumbnail = _this$props$asset$cla2.thumbnail;
|
||||
var sourceUrl = "/".concat(claimId, "/").concat(name, ".").concat(fileExt);
|
||||
return _react.default.createElement("div", {
|
||||
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, {
|
||||
|
@ -82,7 +83,7 @@ function (_React$Component) {
|
|||
case 'image/gif':
|
||||
return _react.default.createElement("img", {
|
||||
className: "asset-image",
|
||||
src: "/asset/".concat(name, "/").concat(claimId),
|
||||
src: sourceUrl,
|
||||
alt: name
|
||||
});
|
||||
|
||||
|
@ -92,11 +93,11 @@ function (_React$Component) {
|
|||
controls: true,
|
||||
poster: thumbnail
|
||||
}, _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."));
|
||||
|
||||
default:
|
||||
return _react.default.createElement("p", null, "Unsupported file type");
|
||||
return _react.default.createElement("p", null, "Unsupported content type");
|
||||
}
|
||||
}());
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ var createAssetMetaTags = function createAssetMetaTags(_ref3) {
|
|||
var contentType = claimData.contentType;
|
||||
var videoEmbedUrl = "".concat(siteHost, "/video-embed/").concat(claimData.name, "/").concat(claimData.claimId);
|
||||
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 ogDescription = claimData.description || defaultDescription;
|
||||
var ogThumbnailContentType = determineOgThumbnailContentType(claimData.thumbnail);
|
||||
|
|
|
@ -9,6 +9,7 @@ class AssetDisplay extends React.Component {
|
|||
}
|
||||
render () {
|
||||
const { status, error, asset: { claimData: { name, claimId, contentType, fileExt, thumbnail } } } = this.props;
|
||||
const sourceUrl = `/${claimId}/${name}.${fileExt}`;
|
||||
return (
|
||||
<div className={'asset-display'}>
|
||||
{(status === LOCAL_CHECK) &&
|
||||
|
@ -39,7 +40,7 @@ class AssetDisplay extends React.Component {
|
|||
return (
|
||||
<img
|
||||
className='asset-image'
|
||||
src={`/asset/${name}/${claimId}`}
|
||||
src={sourceUrl}
|
||||
alt={name}
|
||||
/>
|
||||
);
|
||||
|
@ -50,14 +51,14 @@ class AssetDisplay extends React.Component {
|
|||
controls poster={thumbnail}
|
||||
>
|
||||
<source
|
||||
src={`/asset/${name}/${claimId}`}
|
||||
src={sourceUrl}
|
||||
/>
|
||||
<p>Your browser does not support the <code>video</code> element.</p>
|
||||
</video>
|
||||
);
|
||||
default:
|
||||
return (
|
||||
<p>Unsupported file type</p>
|
||||
<p>Unsupported content type</p>
|
||||
);
|
||||
}
|
||||
})()
|
||||
|
|
|
@ -48,7 +48,7 @@ const createAssetMetaTags = ({siteHost, siteTitle, siteTwitter, asset, defaultDe
|
|||
const { contentType } = claimData;
|
||||
const videoEmbedUrl = `${siteHost}/video-embed/${claimData.name}/${claimData.claimId}`;
|
||||
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 ogDescription = claimData.description || defaultDescription;
|
||||
const ogThumbnailContentType = determineOgThumbnailContentType(claimData.thumbnail);
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
const serveByClaim = require('../../controllers/assets/serveByClaim');
|
||||
const serveByIdentifierAndClaim = require('../../controllers/assets/serveByIdentifierAndClaim');
|
||||
const serveAsset = require('../../controllers/assets/serveAsset');
|
||||
|
||||
module.exports = (app) => {
|
||||
app.get('/asset/:claimName/:claimId/', serveAsset);
|
||||
app.get('/:identifier/:claim', serveByIdentifierAndClaim);
|
||||
app.get('/:claim', serveByClaim);
|
||||
};
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue