Skip to content
This repository has been archived by the owner on Feb 23, 2021. It is now read-only.

Commit

Permalink
Merge b88c96c into adb5f09
Browse files Browse the repository at this point in the history
  • Loading branch information
tamarahills committed Mar 4, 2019
2 parents adb5f09 + b88c96c commit 6f85f4c
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions command/CommandController.js
Expand Up @@ -306,7 +306,7 @@ router.post('/webpage', VerifyToken, async function(req, res) {
logger.debug('summary is: ' + summ);

try {
let version = req.body.v ? req.body.v : 1;
let version = 1;
logger.debug('/webpage version is: ' + version);

logger.debug(req.body);
Expand All @@ -316,12 +316,14 @@ router.post('/webpage', VerifyToken, async function(req, res) {
// Make sure it's an article
if (article && article.isArticle && article.isArticle == 1) {
let mData = await getArticleMetadata(article, 1);
logger.debug('Article metadata is: ' + JSON.stringify(mData));

let mobileMetadata = await audioHelper.getMobileFileMetadata(
article.resolved_id,
req.body.locale,
summ
);
logger.debug('Mobile metadata is: ' + JSON.stringify(mobileMetadata));
// Do we have the article cached?
if (mobileMetadata && mobileMetadata.length > 0) {
// We have already processed this article
Expand All @@ -332,7 +334,12 @@ router.post('/webpage', VerifyToken, async function(req, res) {
mobileMetadata,
version
);
mData.audio_url = response.url;
mData['audioUrl'] = response.url;
delete mData.length_minutes;
delete mData.image_url;
mData['iconUrl'] = mData.icon_url;
delete mData.icon_url;
logger.debug('Before response: ' + JSON.stringify(mData));
res.status(200).send(JSON.stringify(mData));
} else {
logger.debug('This article is not cached');
Expand Down Expand Up @@ -400,7 +407,12 @@ router.post('/webpage', VerifyToken, async function(req, res) {
mobileMetadata,
version
);
mData.audio_url = response.url;
mData['audioUrl'] = response.url;
delete mData.length_minutes;
delete mData.image_url;
mData['iconUrl'] = mData.icon_url;
delete mData.icon_url;
console.log('mData is: ' + mData);

// Send it back to the mobile as quick as possible.
res.status(200).send(JSON.stringify(mData));
Expand Down

0 comments on commit 6f85f4c

Please sign in to comment.