diff --git a/controllers/publishController.js b/controllers/publishController.js index f6e84fac..431c3020 100644 --- a/controllers/publishController.js +++ b/controllers/publishController.js @@ -24,15 +24,17 @@ module.exports = { publishResults = result; logger.info(`Successfully published ${fileName}`, publishResults); fileRecord = { - name : publishParams.name, - claimId : publishResults.claim_id, - address : publishParams.claim_address, - outpoint: `${publishResults.txid}:${publishResults.nout}`, - height : 0, + name : publishParams.name, + claimId : publishResults.claim_id, + title : publishParams.metadata.title, + description: publishParams.metadata.description, + address : publishParams.claim_address, + outpoint : `${publishResults.txid}:${publishResults.nout}`, + height : 0, fileName, - filePath: publishParams.file_path, + filePath : publishParams.file_path, fileType, - nsfw : publishParams.metadata.nsfw, + nsfw : publishParams.metadata.nsfw, }; upsertCriteria = { name : publishParams.name, diff --git a/helpers/publishHelpers.js b/helpers/publishHelpers.js index 63de7afe..ab0828c4 100644 --- a/helpers/publishHelpers.js +++ b/helpers/publishHelpers.js @@ -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, license, nsfw) { + createPublishParams (name, filePath, title, description, license, nsfw) { logger.debug(`Creating Publish Parameters for "${name}"`); const claimAddress = config.get('WalletConfig.LbryClaimAddress'); // filter nsfw and ensure it is a boolean @@ -68,15 +68,23 @@ module.exports = { } else { nsfw = true; } + // provide defaults for title & description + if (title === '' || title === null) { + title = name; + } + if (description === '' || title === null) { + description = `${name} published via spee.ch`; + } + // create the publish params const publishParams = { name, file_path: filePath, bid : 0.01, metadata : { - description: `${name} published via spee.ch`, - title : name, - author : 'spee.ch', - language : 'en', + description, + title, + author : 'spee.ch', + language: 'en', license, nsfw, }, diff --git a/public/assets/css/componentStyle.css b/public/assets/css/componentStyle.css index 61af9e66..2aefbb13 100644 --- a/public/assets/css/componentStyle.css +++ b/public/assets/css/componentStyle.css @@ -29,7 +29,8 @@ #drop-zone { border: 1px dashed lightgrey; padding: 1em; - height: 6em; + height: 13em; + background: #F5F0EF; } #asset-preview-holder { @@ -37,13 +38,22 @@ margin-bottom: 1em; } -.claim-name-input-area { +#claim-name-input-area { border-bottom: 1px blue solid; float: left; margin-bottom: 1em; font-weight: bold; } +.publish-input, #publish-license { + border: 1px solid lightgrey; +} + +.publish-input { + padding: 1%; + width: 90% +} + #claim-name-input { border: 0px; } diff --git a/public/assets/css/generalStyle.css b/public/assets/css/generalStyle.css index 6a3f9dbe..70cfcf0b 100644 --- a/public/assets/css/generalStyle.css +++ b/public/assets/css/generalStyle.css @@ -1,3 +1,6 @@ +body, button, input, textarea, label, select, option { + font-family: serif; +} /* Containters */ .wrapper { margin-left: 20%; diff --git a/routes/serve-routes.js b/routes/serve-routes.js index 9e4cc154..cfbab943 100644 --- a/routes/serve-routes.js +++ b/routes/serve-routes.js @@ -1,5 +1,5 @@ const logger = require('winston'); -const { serveFile, showFile, showFileLite, getShortIdFromClaimId } = require('../helpers/serveHelpers.js'); +const { serveFile, showFile, showFileLite, getShortIdFromClaimId, resolveAgainstClaimTable } = require('../helpers/serveHelpers.js'); const { getAssetByChannel, getAssetByShortId, getAssetByClaimId, getAssetByName } = require('../controllers/serveController.js'); const { handleRequestError } = require('../helpers/errorHandlers.js'); const { postToStats, sendGoogleAnalytics } = require('../controllers/statsController.js'); @@ -48,6 +48,12 @@ function serveOrShowAsset (fileInfo, extension, method, headers, originalUrl, ip return getShortIdFromClaimId(fileInfo.claimId, fileInfo.height, fileInfo.name) .then(shortId => { fileInfo['shortId'] = shortId; + return resolveAgainstClaimTable(fileInfo.name, fileInfo.claimId); + }) + .then(resolveResult => { + logger.debug('resolve result', resolveResult); + fileInfo['title'] = resolveResult.title; + fileInfo['description'] = resolveResult.description; showFile(fileInfo, res); postToStats('show', originalUrl, ip, fileInfo.name, fileInfo.claimId, 'success'); return fileInfo; @@ -135,6 +141,7 @@ module.exports = (app) => { getAsset(claimType, channelName, shortId, fullClaimId, name) // 2. serve or show .then(fileInfo => { + logger.debug('fileInfo', fileInfo); if (!fileInfo) { res.status(200).render('noClaims'); } else { diff --git a/routes/sockets-routes.js b/routes/sockets-routes.js index 7a1ade72..ecef3fc4 100644 --- a/routes/sockets-routes.js +++ b/routes/sockets-routes.js @@ -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.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); // publish the file publishController.publish(publishParams, file.name, file.meta.type) .then(result => { diff --git a/speech.js b/speech.js index a4dad0ba..be0de1ab 100644 --- a/speech.js +++ b/speech.js @@ -48,11 +48,11 @@ const hbs = expressHandlebars.create({ ` ); }, - addOpenGraph (title, mimeType, showUrl, source) { + addOpenGraph (title, mimeType, showUrl, source, description) { let basicTags = ` - `; + `; if (mimeType === 'video/mp4') { return new Handlebars.SafeString( `${basicTags} diff --git a/views/index.handlebars b/views/index.handlebars index 125deae6..3a82aecd 100644 --- a/views/index.handlebars +++ b/views/index.handlebars @@ -3,7 +3,6 @@
{{fileInfo.name}}> +
{{fileInfo.title}}>
{{fileInfo.description}}> +
+ | + |
+ | + |
+ | + + | +
+ | + |
+
+ + + +By clicking 'Publish' I attest that I have read and agree to the LBRY terms of service.
-
-
-
-
-
-
-
- - - -By clicking 'Publish' I attest that I have read and agree to the LBRY terms of service.