diff --git a/client/src/containers/AssetInfo/view.jsx b/client/src/containers/AssetInfo/view.jsx index a84e7062..63d16e10 100644 --- a/client/src/containers/AssetInfo/view.jsx +++ b/client/src/containers/AssetInfo/view.jsx @@ -90,7 +90,7 @@ class AssetInfo extends React.Component { {(contentType === 'video/mp4') ? ( `} + value={``} /> ) : ( { + config.classNames.push('bottom'); + return; + }, + 'right': async (config) => { + config.classNames.push('right'); + return; + }, + 'pad': async (config, val) => { + config.classNames.push(padSizes[val]); + return; + }, + 'logoClaim': async (config, val) => { + config.logoUrl = `${host}/${val}`; + return; + }, + 'link': async (config, val) => { + config.logoLink = val; + return; + } +}; + +const parseLogoConfigParam = async (rawConfig) => { + if(rawConfig) { + let parsedConfig = { + classNames: ['logoLink'], + logoUrl: thumbnail, + }; + let splitConfig; + try { + splitConfig = rawConfig.split(','); + } catch(e) { } + + if(!splitConfig) { + return false; + } + + for(let i = 0; i < splitConfig.length; i++) { + let currentArgument = splitConfig[i]; + + if(argumentProcessors[currentArgument]) { + await argumentProcessors[currentArgument](parsedConfig); + } else { + const splitArgument = currentArgument.split(':'); + if(argumentProcessors[splitArgument[0]]) { + await argumentProcessors[splitArgument[0]](parsedConfig, splitArgument[1]); + } + } + } + + parsedConfig.classNames = parsedConfig.classNames.join(' '); + + return parsedConfig; + } + + return false; +} + +const sendVideoEmbedPage = async ({ params }, res) => { + const { + claimId, + config, + name, + } = params; + + const logoConfig = await parseLogoConfigParam(config); -const sendVideoEmbedPage = ({ params }, res) => { - const claimId = params.claimId; - const name = params.name; // test setting response headers console.log('removing x-frame-options'); res.removeHeader('X-Frame-Options'); // get and render the content - res.status(200).render('embed', { host, claimId, name }); + res.status(200).render('embed', { host, claimId, name, logoConfig }); }; module.exports = sendVideoEmbedPage; diff --git a/server/routes/pages/index.js b/server/routes/pages/index.js index 30f84a32..fc742b42 100644 --- a/server/routes/pages/index.js +++ b/server/routes/pages/index.js @@ -16,5 +16,5 @@ module.exports = { '/popular': { controller: handlePageRequest }, '/new': { controller: handlePageRequest }, '/multisite': { controller: handlePageRequest }, - '/video-embed/:name/:claimId': { controller: handleVideoEmbedRequest }, // for twitter + '/video-embed/:name/:claimId/:config?': { controller: handleVideoEmbedRequest }, // for twitter }; diff --git a/server/views/embed.handlebars b/server/views/embed.handlebars index 6b1a4ed6..5dd2f283 100644 --- a/server/views/embed.handlebars +++ b/server/views/embed.handlebars @@ -1,4 +1,7 @@ -