From e304a99ba76550582908251f3b5066944046b825 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Tue, 8 Aug 2017 11:01:01 -0700 Subject: [PATCH] added twitter embed route --- helpers/serveHelpers.js | 8 +++---- routes/page-routes.js | 4 ++-- speech.js | 4 ++-- ...tterPlayer.handlebars => embed.handlebars} | 0 views/layouts/embed.handlebars | 21 +++++++++++++++++++ views/layouts/show.handlebars | 2 +- views/layouts/twitterPlayer.handlebars | 16 -------------- 7 files changed, 30 insertions(+), 25 deletions(-) rename views/{twitterPlayer.handlebars => embed.handlebars} (100%) create mode 100644 views/layouts/embed.handlebars delete mode 100644 views/layouts/twitterPlayer.handlebars diff --git a/helpers/serveHelpers.js b/helpers/serveHelpers.js index 017d485c..62a5447d 100644 --- a/helpers/serveHelpers.js +++ b/helpers/serveHelpers.js @@ -62,10 +62,10 @@ function checkLocalDbForClaims (name, shortUrl) { function createOpenGraphInfo ({ fileType, claimId, name, fileName, fileExt }) { return { - twitterPlayerUrl: `https://spee.ch/twitterPlayer/${claimId}/${name}`, - showUrl : `https://spee.ch/${claimId}/${name}`, - source : `https://spee.ch/${claimId}/${name}${fileExt}`, - directFileUrl : `https://spee.ch/media/${fileName}`, + 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}`, }; } diff --git a/routes/page-routes.js b/routes/page-routes.js index 7907e907..dbfd83fb 100644 --- a/routes/page-routes.js +++ b/routes/page-routes.js @@ -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) => { diff --git a/speech.js b/speech.js index cc2f0d4b..576d81c0 100644 --- a/speech.js +++ b/speech.js @@ -82,12 +82,12 @@ const hbs = expressHandlebars.create({ ); } }, - addTwitterCard (mimeType, source, twitterPlayerUrl, directFileUrl) { + addTwitterCard (mimeType, source, embedUrl, directFileUrl) { let basicTwitterTags = ``; if (mimeType === 'video/mp4') { return new Handlebars.SafeString( `${basicTwitterTags} - diff --git a/views/twitterPlayer.handlebars b/views/embed.handlebars similarity index 100% rename from views/twitterPlayer.handlebars rename to views/embed.handlebars diff --git a/views/layouts/embed.handlebars b/views/layouts/embed.handlebars new file mode 100644 index 00000000..bbf8e91a --- /dev/null +++ b/views/layouts/embed.handlebars @@ -0,0 +1,21 @@ + + + + + + + + + + + +{{{body}}} + + + \ No newline at end of file diff --git a/views/layouts/show.handlebars b/views/layouts/show.handlebars index 15575e9f..0c33c424 100644 --- a/views/layouts/show.handlebars +++ b/views/layouts/show.handlebars @@ -8,7 +8,7 @@ - {{{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}}} diff --git a/views/layouts/twitterPlayer.handlebars b/views/layouts/twitterPlayer.handlebars deleted file mode 100644 index 1c3f0d44..00000000 --- a/views/layouts/twitterPlayer.handlebars +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - -{{{body}}} - - - \ No newline at end of file