Titles and descriptions #148

Merged
bones7242 merged 5 commits from titles-and-descriptions into master 2017-08-21 05:21:41 +02:00
6 changed files with 26 additions and 11 deletions
Showing only changes of commit bb243cf459 - Show all commits

View file

@ -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"'); 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}"`); logger.debug(`Creating Publish Parameters for "${name}"`);
const claimAddress = config.get('WalletConfig.LbryClaimAddress'); const claimAddress = config.get('WalletConfig.LbryClaimAddress');
// filter nsfw and ensure it is a boolean // filter nsfw and ensure it is a boolean
@ -68,15 +68,23 @@ module.exports = {
} else { } else {
nsfw = true; 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 = { const publishParams = {
name, name,
file_path: filePath, file_path: filePath,
bid : 0.01, bid : 0.01,
metadata : { metadata : {
description: `${name} published via spee.ch`, description,
title : name, title,
author : 'spee.ch', author : 'spee.ch',
language : 'en', language: 'en',
license, license,
nsfw, nsfw,
}, },

View file

@ -135,6 +135,7 @@ module.exports = (app) => {
getAsset(claimType, channelName, shortId, fullClaimId, name) getAsset(claimType, channelName, shortId, fullClaimId, name)
// 2. serve or show // 2. serve or show
.then(fileInfo => { .then(fileInfo => {
logger.debug('fileInfo', fileInfo);
if (!fileInfo) { if (!fileInfo) {
res.status(200).render('noClaims'); res.status(200).render('noClaims');
} else { } else {

View file

@ -36,7 +36,7 @@ module.exports = (app, siofu, hostedContentPath) => {
logger.debug(`Client successfully uploaded ${file.name}`); 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)...'); socket.emit('publish-status', 'File upload successfully completed. Your image is being published to LBRY (this might take a second)...');
// prepare the publish parameters // 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 // publish the file
publishController.publish(publishParams, file.name, file.meta.type) publishController.publish(publishParams, file.name, file.meta.type)
.then(result => { .then(result => {

View file

@ -20,9 +20,13 @@
/* socketio-file-upload listeners */ /* socketio-file-upload listeners */
uploader.addEventListener('start', function(event){ uploader.addEventListener('start', function(event){
var name = document.getElementById('claim-name-input').value; 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 license = document.getElementById('publish-license').value;
var nsfw = document.getElementById('publish-nsfw').checked; var nsfw = document.getElementById('publish-nsfw').checked;
event.file.meta.name = name; event.file.meta.name = name;
event.file.meta.title = title;
event.file.meta.description = description;
event.file.meta.license = license; event.file.meta.license = license;
event.file.meta.nsfw = nsfw; event.file.meta.nsfw = nsfw;
event.file.meta.type = stagedFiles[0].type; event.file.meta.type = stagedFiles[0].type;

View file

@ -29,6 +29,7 @@
<input type="text" id="gifv-text" class="link" readonly onclick="select()" spellcheck="false" value='https://spee.ch/{{fileInfo.shortId}}/{{fileInfo.name}}.gifv'/> <input type="text" id="gifv-text" class="link" readonly onclick="select()" spellcheck="false" value='https://spee.ch/{{fileInfo.shortId}}/{{fileInfo.name}}.gifv'/>
<button class="copy-button" data-elementtocopy="gifv-text" onclick="copyToClipboard(event)">copy</button> <button class="copy-button" data-elementtocopy="gifv-text" onclick="copyToClipboard(event)">copy</button>
</div> </div>
{{/ifConditional}}
{{!-- html text for embedding asset--}} {{!-- html text for embedding asset--}}
<div class="share-option"> <div class="share-option">
Embed HTML Embed HTML
@ -41,7 +42,6 @@
{{/ifConditional}} {{/ifConditional}}
<button class="copy-button" data-elementtocopy="embed-text" onclick="copyToClipboard(event)">copy</button> <button class="copy-button" data-elementtocopy="embed-text" onclick="copyToClipboard(event)">copy</button>
</div> </div>
{{/ifConditional}}
{{!--markdown text using asset--}} {{!--markdown text using asset--}}
{{#ifConditional fileInfo.fileType '===' 'video/mp4'}} {{#ifConditional fileInfo.fileType '===' 'video/mp4'}}
{{else}} {{else}}

View file

@ -61,17 +61,19 @@
<input type="file" id="siofu_input" name="file" accept="video/*,image/*" onchange="previewAndStageFile(event.target.files[0])" enctype="multipart/form-data"/> <input type="file" id="siofu_input" name="file" accept="video/*,image/*" onchange="previewAndStageFile(event.target.files[0])" enctype="multipart/form-data"/>
</div> </div>
<div id="asset-preview-holder"></div>`; <div id="asset-preview-holder"></div>`;
// reset // reset inputs
document.getElementById('claim-name-input').value = ''; document.getElementById('claim-name-input').value = '';
document.getElementById('publish-title').value = '';
document.getElementById('publish-description').value = '';
document.getElementById('publish-nsfw').checked = false;
// remove staged files // remove staged files
stagedFiles = null; stagedFiles = null;
// clear any errors // clear any errors
document.getElementById('input-error-file-selection').innerHTML = ''; document.getElementById('input-error-file-selection').innerHTML = '';
document.getElementById('input-error-claim-name').innerHTML = ''; document.getElementById('input-error-claim-name').innerHTML = '';
document.getElementById('input-error-publish-submit').innerHTML = ''; document.getElementById('input-error-publish-submit').innerHTML = '';
// remove nsfw check
document.getElementById('claim-name-available').hidden = true; document.getElementById('claim-name-available').hidden = true;
// remove nsfw check // remove nsfw check
document.getElementById('publish-nsfw').checked = false;
} }
</script> </script>