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 @@
{{> publish}} {{> learnMore}} - {{> trendingAssets}}
{{> footer}} @@ -21,9 +20,13 @@ /* socketio-file-upload listeners */ uploader.addEventListener('start', function(event){ var name = document.getElementById('claim-name-input').value; + var title = document.getElementById('publish-title').value; + var description = document.getElementById('publish-description').value; var license = document.getElementById('publish-license').value; var nsfw = document.getElementById('publish-nsfw').checked; event.file.meta.name = name; + event.file.meta.title = title; + event.file.meta.description = description; event.file.meta.license = license; event.file.meta.nsfw = nsfw; event.file.meta.type = stagedFiles[0].type; diff --git a/views/layouts/show.handlebars b/views/layouts/show.handlebars index 51d552a2..47e183a5 100644 --- a/views/layouts/show.handlebars +++ b/views/layouts/show.handlebars @@ -10,7 +10,7 @@ {{#unless fileInfo.nsfw}} {{{addTwitterCard fileInfo.fileType openGraphInfo.source openGraphInfo.embedUrl openGraphInfo.directFileUrl}}} - {{{addOpenGraph fileInfo.name fileInfo.fileType openGraphInfo.showUrl openGraphInfo.source}}} + {{{addOpenGraph fileInfo.title fileInfo.fileType openGraphInfo.showUrl openGraphInfo.source fileInfo.description}}} {{/unless}} diff --git a/views/partials/assetInfo.handlebars b/views/partials/assetInfo.handlebars index dc5beda2..6dd0a0e6 100644 --- a/views/partials/assetInfo.handlebars +++ b/views/partials/assetInfo.handlebars @@ -1,6 +1,6 @@
-

Name

-

{{fileInfo.name}} +

Title

+

{{fileInfo.title}}

+ {{/ifConditional}} {{!-- html text for embedding asset--}}
Embed HTML @@ -41,7 +42,6 @@ {{/ifConditional}}
- {{/ifConditional}} {{!--markdown text using asset--}} {{#ifConditional fileInfo.fileType '===' 'video/mp4'}} {{else}} @@ -54,6 +54,10 @@ {{/ifConditional}} +
+

Description

+

{{fileInfo.description}} +

Metadata

diff --git a/views/partials/publish.handlebars b/views/partials/publish.handlebars index e17816e3..c329ad10 100644 --- a/views/partials/publish.handlebars +++ b/views/partials/publish.handlebars @@ -1,36 +1,53 @@

Publish

-
-
-

Drag and drop your file here, or choose your file below.

- - -
-
-
-
-
- -
- Spee.ch/ - +
+
+
+

Drag and drop your file here, or choose your file below.

+ + +
+
+
+
+
+ +
+ Spee.ch/ + +
+
+
+ + + + + + + + + + + + + + + + +
+ +
+
+

+

+ + +

+

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.

@@ -44,17 +61,19 @@
`; - // reset + // reset inputs document.getElementById('claim-name-input').value = ''; - // remove staged files + document.getElementById('publish-title').value = ''; + document.getElementById('publish-description').value = ''; + document.getElementById('publish-nsfw').checked = false; + // remove staged files stagedFiles = null; // clear any errors document.getElementById('input-error-file-selection').innerHTML = ''; document.getElementById('input-error-claim-name').innerHTML = ''; document.getElementById('input-error-publish-submit').innerHTML = ''; - // remove nsfw check document.getElementById('claim-name-available').hidden = true; // remove nsfw check - document.getElementById('publish-nsfw').checked = false; + } diff --git a/views/partials/topBar.handlebars b/views/partials/topBar.handlebars index bffb3b14..0f424b12 100644 --- a/views/partials/topBar.handlebars +++ b/views/partials/topBar.handlebars @@ -1,6 +1,7 @@

Spee.ch

(beta) + trending source help
Open-source, decentralized image and video hosting.