Titles and descriptions #148
6 changed files with 26 additions and 11 deletions
|
@ -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,
|
||||
},
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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'/>
|
||||
<button class="copy-button" data-elementtocopy="gifv-text" onclick="copyToClipboard(event)">copy</button>
|
||||
</div>
|
||||
{{/ifConditional}}
|
||||
{{!-- html text for embedding asset--}}
|
||||
<div class="share-option">
|
||||
Embed HTML
|
||||
|
@ -41,7 +42,6 @@
|
|||
{{/ifConditional}}
|
||||
<button class="copy-button" data-elementtocopy="embed-text" onclick="copyToClipboard(event)">copy</button>
|
||||
</div>
|
||||
{{/ifConditional}}
|
||||
{{!--markdown text using asset--}}
|
||||
{{#ifConditional fileInfo.fileType '===' 'video/mp4'}}
|
||||
{{else}}
|
||||
|
|
|
@ -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"/>
|
||||
</div>
|
||||
<div id="asset-preview-holder"></div>`;
|
||||
// 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;
|
||||
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue