import express from 'express'
+import { maxBy } from 'lodash'
import { Feed } from '@peertube/feed'
import { CustomTag, CustomXMLNS, Person } from '@peertube/feed/lib/typings'
import { mdToOneLinePlainText } from '@server/helpers/markdown'
accountLink = videoChannel.Account.getClientUrl()
if (videoChannel.Actor.hasImage(ActorImageType.AVATAR)) {
- imageUrl = WEBSERVER.URL + videoChannel.Actor.Avatars[0].getStaticPath()
+ const videoChannelAvatar = maxBy(videoChannel.Actor.Avatars, 'width')
+ imageUrl = WEBSERVER.URL + videoChannelAvatar.getStaticPath()
}
if (videoChannel.Account.Actor.hasImage(ActorImageType.AVATAR)) {
- accountImageUrl = WEBSERVER.URL + videoChannel.Account.Actor.Avatars[0].getStaticPath()
+ const accountAvatar = maxBy(videoChannel.Account.Actor.Avatars, 'width')
+ accountImageUrl = WEBSERVER.URL + accountAvatar.getStaticPath()
}
user = await UserModel.loadById(videoChannel.Account.userId)
accountLink = link
if (account.Actor.hasImage(ActorImageType.AVATAR)) {
- imageUrl = WEBSERVER.URL + account.Actor.Avatars[0].getStaticPath()
+ const accountAvatar = maxBy(account.Actor.Avatars, 'width')
+ imageUrl = WEBSERVER.URL + accountAvatar?.getStaticPath()
accountImageUrl = imageUrl
}
import express from 'express'
+import { maxBy } from 'lodash'
import { extname } from 'path'
import { Feed } from '@peertube/feed'
import { CustomTag, CustomXMLNS, LiveItemStatus } from '@peertube/feed/lib/typings'
href: account.getClientUrl()
}
+ const commonAttributes = getCommonVideoFeedAttributes(video)
+ const guid = liveItem
+ ? `${video.uuid}_${video.publishedAt.toISOString()}`
+ : commonAttributes.link
+
+ let personImage: string
+
+ if (account.Actor.hasImage(ActorImageType.AVATAR)) {
+ const avatar = maxBy(account.Actor.Avatars, 'width')
+ personImage = WEBSERVER.URL + avatar.getStaticPath()
+ }
+
return {
- ...getCommonVideoFeedAttributes(video),
+ guid,
+ ...commonAttributes,
trackers: video.getTrackerUrls(),
{
...author,
- img: account.Actor.hasImage(ActorImageType.AVATAR)
- ? WEBSERVER.URL + account.Actor.Avatars[0].getStaticPath()
- : undefined
+ img: personImage
}
],
import express from 'express'
import { param, query } from 'express-validator'
-import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
+import { HttpStatusCode } from '@shared/models'
import { isValidRSSFeed } from '../../helpers/custom-validators/feeds'
import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helpers/custom-validators/misc'
import { buildPodcastGroupsCache } from '../cache'
const parser = new XMLParser({ parseAttributeValue: true, ignoreAttributes: false })
const xmlDoc = parser.parse(rss)
+ const itemGuid = xmlDoc.rss.channel.item.guid
+ expect(itemGuid).to.exist
+ expect(itemGuid['@_isPermaLink']).to.equal(true)
+
const enclosure = xmlDoc.rss.channel.item.enclosure
expect(enclosure).to.exist
const alternateEnclosure = xmlDoc.rss.channel.item['podcast:alternateEnclosure']
const parser = new XMLParser({ parseAttributeValue: true, ignoreAttributes: false })
const xmlDoc = parser.parse(rss)
+ const itemGuid = xmlDoc.rss.channel.item.guid
+ expect(itemGuid).to.exist
+ expect(itemGuid['@_isPermaLink']).to.equal(true)
+
const enclosure = xmlDoc.rss.channel.item.enclosure
const alternateEnclosure = xmlDoc.rss.channel.item['podcast:alternateEnclosure']
expect(alternateEnclosure).to.exist
const xmlDoc = parser.parse(rss)
const liveItem = xmlDoc.rss.channel['podcast:liveItem']
expect(liveItem.title).to.equal('live-0')
+ expect(liveItem.guid['@_isPermaLink']).to.equal(false)
+ expect(liveItem.guid['#text']).to.contain(`${uuid}_`)
expect(liveItem['@_status']).to.equal('live')
const enclosure = liveItem.enclosure