Authentication #170
4 changed files with 10 additions and 9 deletions
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
👍 :+1:
|
||||
title = name;
|
||||
}
|
||||
if (description === '' || title === null) {
|
||||
if (description === '' || description === null) {
|
||||
description = `${name} published via spee.ch`;
|
||||
}
|
||||
// create the publish params
|
||||
|
@ -83,10 +83,11 @@ module.exports = {
|
|||
metadata : {
|
||||
description,
|
||||
title,
|
||||
author : 'spee.ch',
|
||||
language: 'en',
|
||||
author : 'spee.ch',
|
||||
language : 'en',
|
||||
license,
|
||||
nsfw,
|
||||
channel_name: channel,
|
||||
},
|
||||
claim_address: claimAddress,
|
||||
// change_address: changeAddress,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue
description.trim() === ''