mirror of
https://github.com/dariusk/rss-to-activitypub.git
synced 2024-12-23 06:03:33 +02:00
Support audio attachments
Mastodon 2.9.2 now supports native audio attachments, so any mp3 enclosures detected from a podcast-style feed are converted to an audio attachment of the form "attachment": { "type": "Document", "mediaType": "audio/mpeg", "url": "[URL of the mp3]", "name": null }
This commit is contained in:
parent
4754a0dc92
commit
c3983fe4bc
1 changed files with 10 additions and 1 deletions
|
@ -223,7 +223,16 @@ function createMessage(text, name, domain, item, follower, guidNote) {
|
||||||
// add image attachment
|
// add image attachment
|
||||||
let attachment;
|
let attachment;
|
||||||
console.log('NUM IMAGES',item.urls.length);
|
console.log('NUM IMAGES',item.urls.length);
|
||||||
if (item.urls.length > 0) {
|
if (item.enclosure && item.enclosure.url && item.enclosure.url.includes('.mp3')) {
|
||||||
|
attachment = {
|
||||||
|
'type': 'Document',
|
||||||
|
'mediaType': 'audio/mpeg',
|
||||||
|
'url': item.enclosure.url,
|
||||||
|
'name': null
|
||||||
|
};
|
||||||
|
out.object.attachment = attachment;
|
||||||
|
}
|
||||||
|
else if (item.urls.length > 0) {
|
||||||
attachment = {
|
attachment = {
|
||||||
'type': 'Document',
|
'type': 'Document',
|
||||||
'mediaType': 'image/png', // TODO: update the mediaType to match jpeg,gif,etc
|
'mediaType': 'image/png', // TODO: update the mediaType to match jpeg,gif,etc
|
||||||
|
|
Loading…
Reference in a new issue