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) {
return new Promise((resolve, reject) => {
let publishResults = {};
// 1. make sure the name is available
// 1. make sure the name is (still) available
publishHelpers.checkClaimNameAvailability(publishParams.name)
// 2. publish the file
.then(result => {
if (result === true) {
return lbryApi.publishClaim(publishParams);
} 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)

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, title, description, license, nsfw) {
createPublishParams (name, filePath, title, description, license, nsfw, channel) {
logger.debug(`Creating Publish Parameters for "${name}"`);
const claimAddress = config.get('WalletConfig.LbryClaimAddress');
// filter nsfw and ensure it is a boolean
@ -72,7 +72,7 @@ module.exports = {
if (title === '' || title === null) {
title = name;
}
if (description === '' || title === null) {
if (description === '' || description === null) {
description = `${name} published via spee.ch`;
}
// create the publish params
@ -87,6 +87,7 @@ module.exports = {
language : 'en',
license,
nsfw,
channel_name: channel,
},
claim_address: claimAddress,
// change_address: changeAddress,

View file

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

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.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
publishController.publish(publishParams, file.name, file.meta.type)
.then(result => {
@ -52,7 +52,7 @@ module.exports = (app, siofu, hostedContentPath) => {
logger.error(`An error occurred in uploading the client's file`);
socket.emit('publish-failure', '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