diff --git a/updateFeeds.js b/updateFeeds.js index c33737d..9dc2075 100644 --- a/updateFeeds.js +++ b/updateFeeds.js @@ -173,7 +173,7 @@ function signAndSend(message, name, domain, req, res, targetDomain, inbox) { } } -function createMessage(text, name, domain, item) { +function createMessage(text, name, domain, item, follower) { const guid = crypto.randomBytes(16).toString('hex'); let d = new Date(); @@ -184,6 +184,8 @@ function createMessage(text, name, domain, item) { 'type': 'Create', 'actor': `https://${domain}/u/${name}`, + 'to': [ follower ], + 'object': { 'id': `https://${domain}/${guid}`, 'type': 'Note', @@ -196,8 +198,8 @@ function createMessage(text, name, domain, item) { // add image attachment let attachment; + console.log('NUM IMAGES',item.urls.length); if (item.urls.length > 0) { - //console.log('appending'); attachment = { 'type': 'Document', 'mediaType': 'image/png', // TODO: update the mediaType to match jpeg,gif,etc @@ -206,12 +208,24 @@ function createMessage(text, name, domain, item) { }; out.object.attachment = attachment; } + else if (item.urls.length > 1) { + attachment = []; + let lengthFourMax = Math.min(item.urls.length, 4); + for (var i=0; i