added channel_name to publish params

This commit is contained in:
bill bittner 2017-09-21 09:18:19 -07:00
parent 18f16e4cce
commit b1f4bbeaf3
4 changed files with 10 additions and 9 deletions

View file

@ -7,14 +7,14 @@ module.exports = {
publish (publishParams, fileName, fileType) { publish (publishParams, fileName, fileType) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let publishResults = {}; let publishResults = {};
// 1. make sure the name is available // 1. make sure the name is (still) available
publishHelpers.checkClaimNameAvailability(publishParams.name) publishHelpers.checkClaimNameAvailability(publishParams.name)
// 2. publish the file // 2. publish the file
.then(result => { .then(result => {
if (result === true) { if (result === true) {
return lbryApi.publishClaim(publishParams); return lbryApi.publishClaim(publishParams);
} else { } else {
return new Error('That name has already been claimed by spee.ch.'); return new Error('That name has already been claimed on spee.ch.');
} }
}) })
// 3. upsert File record (update is in case the claim has been published before by this daemon) // 3. upsert File record (update is in case the claim has been published before by this daemon)

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, title, description, license, nsfw) { createPublishParams (name, filePath, title, description, license, nsfw, channel) {
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
@ -72,7 +72,7 @@ module.exports = {
if (title === '' || title === null) { if (title === '' || title === null) {
title = name; title = name;
} }
if (description === '' || title === null) { if (description === '' || description === null) {
description = `${name} published via spee.ch`; description = `${name} published via spee.ch`;
} }
// create the publish params // create the publish params
@ -84,9 +84,10 @@ module.exports = {
description, description,
title, title,
author : 'spee.ch', author : 'spee.ch',
language: 'en', language : 'en',
license, license,
nsfw, nsfw,
channel_name: channel,
}, },
claim_address: claimAddress, claim_address: claimAddress,
// change_address: changeAddress, // change_address: changeAddress,

View file

@ -161,7 +161,7 @@ function validateFilePublishSubmission(stagedFiles, claimName, channelName){
return reject(error); return reject(error);
} }
// 3. validate that a channel was chosen // 3. validate that a channel was chosen
if (channelName === 'new') { if (channelName === 'new' || channelName === 'login') {
return reject(new ChannelNameError("Please select a valid channel")); return reject(new ChannelNameError("Please select a valid channel"));
}; };
// 4. validate the claim name // 4. validate the claim name

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.title, file.meta.description, 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, file.meta.channel);
// 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 => {
@ -52,7 +52,7 @@ module.exports = (app, siofu, hostedContentPath) => {
logger.error(`An error occurred in uploading the client's file`); logger.error(`An error occurred in uploading the client's file`);
socket.emit('publish-failure', 'File uploaded, but with errors'); socket.emit('publish-failure', 'File uploaded, but with errors');
postToStats('PUBLISH', '/', null, null, null, 'File uploaded, but with errors'); postToStats('PUBLISH', '/', null, null, null, 'File uploaded, but with errors');
// to-do: remove the file if not done automatically // to-do: remove the file, if not done automatically
} }
}); });
// handle disconnect // handle disconnect