diff --git a/helpers/publishHelpers.js b/helpers/publishHelpers.js index 63de7afe..ab0828c4 100644 --- a/helpers/publishHelpers.js +++ b/helpers/publishHelpers.js @@ -51,7 +51,7 @@ module.exports = { throw new Error('NSFW value was not accepted. NSFW must be set to either true, false, "on", or "off"'); } }, - createPublishParams (name, filePath, license, nsfw) { + createPublishParams (name, filePath, title, description, license, nsfw) { logger.debug(`Creating Publish Parameters for "${name}"`); const claimAddress = config.get('WalletConfig.LbryClaimAddress'); // filter nsfw and ensure it is a boolean @@ -68,15 +68,23 @@ module.exports = { } else { nsfw = true; } + // provide defaults for title & description + if (title === '' || title === null) { + title = name; + } + if (description === '' || title === null) { + description = `${name} published via spee.ch`; + } + // create the publish params const publishParams = { name, file_path: filePath, bid : 0.01, metadata : { - description: `${name} published via spee.ch`, - title : name, - author : 'spee.ch', - language : 'en', + description, + title, + author : 'spee.ch', + language: 'en', license, nsfw, }, diff --git a/routes/serve-routes.js b/routes/serve-routes.js index 9e4cc154..487eb875 100644 --- a/routes/serve-routes.js +++ b/routes/serve-routes.js @@ -135,6 +135,7 @@ module.exports = (app) => { getAsset(claimType, channelName, shortId, fullClaimId, name) // 2. serve or show .then(fileInfo => { + logger.debug('fileInfo', fileInfo); if (!fileInfo) { res.status(200).render('noClaims'); } else { diff --git a/routes/sockets-routes.js b/routes/sockets-routes.js index 7a1ade72..ecef3fc4 100644 --- a/routes/sockets-routes.js +++ b/routes/sockets-routes.js @@ -36,7 +36,7 @@ module.exports = (app, siofu, hostedContentPath) => { logger.debug(`Client successfully uploaded ${file.name}`); socket.emit('publish-status', 'File upload successfully completed. Your image is being published to LBRY (this might take a second)...'); // prepare the publish parameters - const publishParams = publishHelpers.createPublishParams(file.meta.name, file.pathName, file.meta.license, file.meta.nsfw); + const publishParams = publishHelpers.createPublishParams(file.meta.name, file.pathName, file.meta.title, file.meta.description, file.meta.license, file.meta.nsfw); // publish the file publishController.publish(publishParams, file.name, file.meta.type) .then(result => { diff --git a/views/index.handlebars b/views/index.handlebars index c3723c70..3a82aecd 100644 --- a/views/index.handlebars +++ b/views/index.handlebars @@ -20,9 +20,13 @@ /* socketio-file-upload listeners */ uploader.addEventListener('start', function(event){ var name = document.getElementById('claim-name-input').value; + var title = document.getElementById('publish-title').value; + var description = document.getElementById('publish-description').value; var license = document.getElementById('publish-license').value; var nsfw = document.getElementById('publish-nsfw').checked; event.file.meta.name = name; + event.file.meta.title = title; + event.file.meta.description = description; event.file.meta.license = license; event.file.meta.nsfw = nsfw; event.file.meta.type = stagedFiles[0].type; diff --git a/views/partials/assetInfo.handlebars b/views/partials/assetInfo.handlebars index dc5beda2..ef223e89 100644 --- a/views/partials/assetInfo.handlebars +++ b/views/partials/assetInfo.handlebars @@ -29,6 +29,7 @@ + {{/ifConditional}} {{!-- html text for embedding asset--}}
Embed HTML @@ -41,7 +42,6 @@ {{/ifConditional}}
- {{/ifConditional}} {{!--markdown text using asset--}} {{#ifConditional fileInfo.fileType '===' 'video/mp4'}} {{else}} diff --git a/views/partials/publish.handlebars b/views/partials/publish.handlebars index 684d7f3c..c329ad10 100644 --- a/views/partials/publish.handlebars +++ b/views/partials/publish.handlebars @@ -61,17 +61,19 @@
`; - // reset + // reset inputs document.getElementById('claim-name-input').value = ''; - // remove staged files + document.getElementById('publish-title').value = ''; + document.getElementById('publish-description').value = ''; + document.getElementById('publish-nsfw').checked = false; + // remove staged files stagedFiles = null; // clear any errors document.getElementById('input-error-file-selection').innerHTML = ''; document.getElementById('input-error-claim-name').innerHTML = ''; document.getElementById('input-error-publish-submit').innerHTML = ''; - // remove nsfw check document.getElementById('claim-name-available').hidden = true; // remove nsfw check - document.getElementById('publish-nsfw').checked = false; + }