fixed html embed on img show route

This commit is contained in:
bill bittner 2017-08-20 16:56:37 -07:00
parent a5ff2bcfd1
commit bb243cf459
6 changed files with 26 additions and 11 deletions

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"');
}
},
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,
},

View file

@ -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 {

View file

@ -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 => {

View file

@ -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;

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'/>
<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}}

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"/>
</div>
<div id="asset-preview-holder"></div>`;
// reset
// reset inputs
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
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>