added title and description to db.Claim upsert and show page
This commit is contained in:
parent
bb243cf459
commit
188608818c
3 changed files with 22 additions and 10 deletions
|
@ -26,6 +26,8 @@ module.exports = {
|
||||||
fileRecord = {
|
fileRecord = {
|
||||||
name : publishParams.name,
|
name : publishParams.name,
|
||||||
claimId : publishResults.claim_id,
|
claimId : publishResults.claim_id,
|
||||||
|
title : publishParams.metadata.title,
|
||||||
|
description: publishParams.metadata.description,
|
||||||
address : publishParams.claim_address,
|
address : publishParams.claim_address,
|
||||||
outpoint : `${publishResults.txid}:${publishResults.nout}`,
|
outpoint : `${publishResults.txid}:${publishResults.nout}`,
|
||||||
height : 0,
|
height : 0,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const logger = require('winston');
|
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 { getAssetByChannel, getAssetByShortId, getAssetByClaimId, getAssetByName } = require('../controllers/serveController.js');
|
||||||
const { handleRequestError } = require('../helpers/errorHandlers.js');
|
const { handleRequestError } = require('../helpers/errorHandlers.js');
|
||||||
const { postToStats, sendGoogleAnalytics } = require('../controllers/statsController.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)
|
return getShortIdFromClaimId(fileInfo.claimId, fileInfo.height, fileInfo.name)
|
||||||
.then(shortId => {
|
.then(shortId => {
|
||||||
fileInfo['shortId'] = 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);
|
showFile(fileInfo, res);
|
||||||
postToStats('show', originalUrl, ip, fileInfo.name, fileInfo.claimId, 'success');
|
postToStats('show', originalUrl, ip, fileInfo.name, fileInfo.claimId, 'success');
|
||||||
return fileInfo;
|
return fileInfo;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<h2>Name</h2>
|
<h2>Title</h2>
|
||||||
<p>{{fileInfo.name}}</>
|
<p>{{fileInfo.title}}</>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel links">
|
<div class="panel links">
|
||||||
<h2 class="subheader">Links</h2>
|
<h2 class="subheader">Links</h2>
|
||||||
|
@ -54,6 +54,10 @@
|
||||||
</div>
|
</div>
|
||||||
{{/ifConditional}}
|
{{/ifConditional}}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="panel">
|
||||||
|
<h2>Description</h2>
|
||||||
|
<p>{{fileInfo.description}}</>
|
||||||
|
</div>
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<h2 class="subheader">Metadata</h2>
|
<h2 class="subheader">Metadata</h2>
|
||||||
<table class="metadata-table" style="table-layout: fixed">
|
<table class="metadata-table" style="table-layout: fixed">
|
||||||
|
|
Loading…
Reference in a new issue