Merge branch 'open-graph'

This commit is contained in:
bill bittner 2017-08-08 11:01:49 -07:00
commit b36c9d7681
7 changed files with 30 additions and 25 deletions

View file

@ -62,10 +62,10 @@ function checkLocalDbForClaims (name, shortUrl) {
function createOpenGraphInfo ({ fileType, claimId, name, fileName, fileExt }) {
return {
twitterPlayerUrl: `https://spee.ch/twitterPlayer/${claimId}/${name}`,
embedUrl : `https://spee.ch/embed/${claimId}/${name}`,
showUrl : `https://spee.ch/${claimId}/${name}`,
source : `https://spee.ch/${claimId}/${name}${fileExt}`,
directFileUrl : `https://spee.ch/media/${fileName}`,
directFileUrl: `https://spee.ch/media/${fileName}`,
};
}

View file

@ -36,12 +36,12 @@ module.exports = (app) => {
});
});
// route to display all free public claims at a given name
app.get('/twitterPlayer/:claimId/:fileName', ({ params }, res) => {
app.get('/embed/:claimId/:fileName', ({ params }, res) => {
const claimId = params.claimId;
const fileName = params.fileName;
const fileExtension = '.mp4';
// get and render the content
res.status(200).render('twitterPlayer', { layout: 'twitterPlayer', claimId, fileName, fileExtension });
res.status(200).render('embed', { layout: 'embed', claimId, fileName, fileExtension });
});
// route to display all free public claims at a given name
app.get('/:name/all', ({ ip, originalUrl, params }, res) => {

View file

@ -82,12 +82,12 @@ const hbs = expressHandlebars.create({
);
}
},
addTwitterCard (mimeType, source, twitterPlayerUrl, directFileUrl) {
addTwitterCard (mimeType, source, embedUrl, directFileUrl) {
let basicTwitterTags = `<meta name="twitter:site" content="@lbryio" />`;
if (mimeType === 'video/mp4') {
return new Handlebars.SafeString(
`${basicTwitterTags} <meta name="twitter:card" content="player" />
<meta name="twitter:player" content="${twitterPlayerUrl}>
<meta name="twitter:player" content="${embedUrl}>
<meta name="twitter:player:width" content="480" />
<meta name="twitter:player:height" content="480" />
<meta name="twitter:player:stream" content="${directFileUrl}" />

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
</head>
<body>
<style type="text/css">
video {
width:100%;
max-width:600px;
height:auto;
}
</style>
{{{body}}}
</body>
</html>

View file

@ -8,7 +8,7 @@
<link rel="stylesheet" href="/assets/css/generalStyle.css" type="text/css">
<link rel="stylesheet" href="/assets/css/componentStyle.css" type="text/css">
<meta property="fb:app_id" content="1371961932852223">
{{{addTwitterCard fileInfo.fileType openGraphInfo.source openGraphInfo.twitterPlayerUrl openGraphInfo.directFileUrl}}}
{{{addTwitterCard fileInfo.fileType openGraphInfo.source openGraphInfo.embedUrl openGraphInfo.directFileUrl}}}
{{{addOpenGraph fileInfo.name fileInfo.fileType openGraphInfo.showUrl openGraphInfo.source}}}
</head>
<body>

View file

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html>
<body>
<style type="text/css">
video {
width:100%;
max-width:600px;
height:auto;
}
</style>
{{{body}}}
</body>
</html>