added availability check based on multiple claim addresses
This commit is contained in:
parent
188706ca31
commit
d018f58d8d
3 changed files with 12 additions and 12 deletions
|
@ -1,7 +1,4 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
wallet: {
|
|
||||||
lbryClaimAddress: null, // choose an address from your lbry wallet
|
|
||||||
},
|
|
||||||
analytics: {
|
analytics: {
|
||||||
googleId: null, // google id for analytics tracking; leave `null` if not applicable
|
googleId: null, // google id for analytics tracking; leave `null` if not applicable
|
||||||
},
|
},
|
||||||
|
@ -29,8 +26,10 @@ module.exports = {
|
||||||
description: 'Open-source, decentralized image and video sharing.'
|
description: 'Open-source, decentralized image and video sharing.'
|
||||||
},
|
},
|
||||||
publish: {
|
publish: {
|
||||||
thumbnailChannel : '@channelName', // create a channel to use for thumbnail images
|
primaryClaimAddress : null, // choose any address from your lbry wallet
|
||||||
thumbnailChannelId: 'xyz123...', // the channel_id (claim id) for the channel above
|
additionalClaimAddresses: [], // // optional: add previously used claim addresses
|
||||||
|
thumbnailChannel : '@channelName', // create a channel to use for thumbnail images
|
||||||
|
thumbnailChannelId : 'xyz123...', // the channel_id (claim id) for the channel above
|
||||||
}
|
}
|
||||||
claim: {
|
claim: {
|
||||||
defaultTitle : 'Spee.ch',
|
defaultTitle : 'Spee.ch',
|
||||||
|
|
|
@ -2,7 +2,7 @@ const logger = require('winston');
|
||||||
const db = require('../models');
|
const db = require('../models');
|
||||||
const lbryApi = require('../helpers/lbryApi.js');
|
const lbryApi = require('../helpers/lbryApi.js');
|
||||||
const publishHelpers = require('../helpers/publishHelpers.js');
|
const publishHelpers = require('../helpers/publishHelpers.js');
|
||||||
const config = require('../config/speechConfig.js');
|
const { publish : { primaryClaimAddress, additionalClaimAddresses } } = require('../config/speechConfig.js');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
publish (publishParams, fileName, fileType) {
|
publish (publishParams, fileName, fileType) {
|
||||||
|
@ -95,10 +95,11 @@ module.exports = {
|
||||||
})
|
})
|
||||||
.then(result => {
|
.then(result => {
|
||||||
if (result.length >= 1) {
|
if (result.length >= 1) {
|
||||||
const claimAddress = config.wallet.lbryClaimAddress;
|
const claimAddresses = additionalClaimAddresses || [];
|
||||||
|
claimAddresses.push(primaryClaimAddress);
|
||||||
// filter out any that were not published from this address
|
// filter out any that were not published from this address
|
||||||
const filteredResult = result.filter((claim) => {
|
const filteredResult = result.filter(({ address }) => {
|
||||||
return (claim.address === claimAddress);
|
return (claimAddresses.includes(address));
|
||||||
});
|
});
|
||||||
if (filteredResult.length >= 1) {
|
if (filteredResult.length >= 1) {
|
||||||
throw new Error('That claim is already in use');
|
throw new Error('That claim is already in use');
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const logger = require('winston');
|
const logger = require('winston');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const { site, wallet, publish } = require('../config/speechConfig.js');
|
const { site, publish } = require('../config/speechConfig.js');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
parsePublishApiRequestBody ({name, nsfw, license, title, description, thumbnail}) {
|
parsePublishApiRequestBody ({name, nsfw, license, title, description, thumbnail}) {
|
||||||
|
@ -114,7 +114,7 @@ module.exports = {
|
||||||
license,
|
license,
|
||||||
nsfw,
|
nsfw,
|
||||||
},
|
},
|
||||||
claim_address: wallet.lbryClaimAddress,
|
claim_address: publish.primaryClaimAddress,
|
||||||
};
|
};
|
||||||
// add thumbnail to channel if video
|
// add thumbnail to channel if video
|
||||||
if (thumbnail) {
|
if (thumbnail) {
|
||||||
|
@ -140,7 +140,7 @@ module.exports = {
|
||||||
license,
|
license,
|
||||||
nsfw,
|
nsfw,
|
||||||
},
|
},
|
||||||
claim_address: wallet.lbryClaimAddress,
|
claim_address: publish.primaryClaimAddress,
|
||||||
channel_name : publish.thumbnailChannel,
|
channel_name : publish.thumbnailChannel,
|
||||||
channel_id : publish.thumbnailChannelId,
|
channel_id : publish.thumbnailChannelId,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue