diff --git a/server/api/models/event.js b/server/api/models/event.js index 0b226dd0..d4ec1e7f 100644 --- a/server/api/models/event.js +++ b/server/api/models/event.js @@ -86,15 +86,18 @@ Event.prototype.toAPNote = function (username, locale, to = []) { ${tags && tags.map(t => `#${t}`)} ` - // const attachment = [] + const attachment = [] + if (this.media && this.media.length) { + attachment.push({ + type: 'Document', + mediaType: 'image/jpeg', + url: `${config.baseurl}/media/${this.media[0].url}`, + name: this.media[0].name || '', + blurHash: null, + focalPoint: this.media[0].focalPoint || [0, 0] + }) + } // if (this.image_path) { - // attachment.push({ - // type: 'Document', - // mediaType: 'image/jpeg', - // url: `${config.baseurl}/media/${this.image_path}`, - // name: null, - // blurHash: null - // }) // } return { diff --git a/server/federation/helpers.js b/server/federation/helpers.js index e0207152..8267465f 100644 --- a/server/federation/helpers.js +++ b/server/federation/helpers.js @@ -97,7 +97,8 @@ const Helpers = { 'https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1', { - Hashtag: 'as:Hashtag' + Hashtag: 'as:Hashtag', + focalPoint: { '@container': '@list', '@id': 'toot:focalPoint' } }] await Helpers.signAndSend(JSON.stringify(body), sharedInbox) }