spee.ch/server/controllers/api/claim/publish/createThumbnailPublishParams.js

36 lines
1 KiB
JavaScript
Raw Normal View History

2018-04-27 18:54:36 +02:00
const logger = require('winston');
2018-06-06 04:34:24 +02:00
const { details, publishing } = require('@config/siteConfig');
2018-04-27 18:54:36 +02:00
2019-02-23 06:52:31 +01:00
const createThumbnailPublishParams = (thumbnailFilePath, claimName, license, licenseUrl, nsfw) => {
2018-04-27 18:54:36 +02:00
if (!thumbnailFilePath) {
return;
}
logger.debug(`Creating Thumbnail Publish Parameters`);
// create the publish params
2019-05-24 22:39:46 +02:00
if (license === null || license.trim() === '') {
license = ''; // default to empty string
}
// provide default for licenseUrl
if (licenseUrl === null || licenseUrl.trim() === '') {
licenseUrl = ''; // default to empty string
}
2018-04-27 18:54:36 +02:00
return {
2019-02-23 06:52:31 +01:00
name: `${claimName}-thumb`,
2018-04-27 18:54:36 +02:00
file_path: thumbnailFilePath,
2019-02-23 06:52:31 +01:00
bid: publishing.fileClaimBidAmount,
title: `${claimName} thumbnail`,
description: `a thumbnail for ${claimName}`,
author: details.title,
languages: ['en'],
license,
license_url: licenseUrl,
2018-04-27 18:54:36 +02:00
claim_address: publishing.primaryClaimAddress,
2019-02-23 06:52:31 +01:00
channel_name: publishing.thumbnailChannel,
channel_id: publishing.thumbnailChannelId,
2018-04-27 18:54:36 +02:00
};
};
module.exports = createThumbnailPublishParams;