aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/feeds/shared
diff options
context:
space:
mode:
authorAlecks Gates <agates@mail.agates.io>2023-06-05 02:00:30 -0500
committerGitHub <noreply@github.com>2023-06-05 09:00:30 +0200
commit1ed1994fffb18a2b0bd74e49b50067ab047f8ab8 (patch)
tree9f06f52d9a376e75066a4a6f01079cb96de1ba6a /server/controllers/feeds/shared
parent9a64621975097f648f6bf19f15b03ba3820918f2 (diff)
downloadPeerTube-1ed1994fffb18a2b0bd74e49b50067ab047f8ab8.tar.gz
PeerTube-1ed1994fffb18a2b0bd74e49b50067ab047f8ab8.tar.zst
PeerTube-1ed1994fffb18a2b0bd74e49b50067ab047f8ab8.zip
Use largest avatar in RSS feeds, unique guid for liveItems (#5817)
* Attempt to get largest avatar size * WIP live guid changes * Use largest avatar version in feeds * Misc variable names/import changes * Update podcast feed tests for guid changes * More <guid> testing * Lint fix * Styling --------- Co-authored-by: Chocobozzz <me@florianbigard.com>
Diffstat (limited to 'server/controllers/feeds/shared')
-rw-r--r--server/controllers/feeds/shared/common-feed-utils.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/server/controllers/feeds/shared/common-feed-utils.ts b/server/controllers/feeds/shared/common-feed-utils.ts
index 375c2814b..8f35a8b35 100644
--- a/server/controllers/feeds/shared/common-feed-utils.ts
+++ b/server/controllers/feeds/shared/common-feed-utils.ts
@@ -1,4 +1,5 @@
1import express from 'express' 1import express from 'express'
2import { maxBy } from 'lodash'
2import { Feed } from '@peertube/feed' 3import { Feed } from '@peertube/feed'
3import { CustomTag, CustomXMLNS, Person } from '@peertube/feed/lib/typings' 4import { CustomTag, CustomXMLNS, Person } from '@peertube/feed/lib/typings'
4import { mdToOneLinePlainText } from '@server/helpers/markdown' 5import { mdToOneLinePlainText } from '@server/helpers/markdown'
@@ -104,11 +105,13 @@ export async function buildFeedMetadata (options: {
104 accountLink = videoChannel.Account.getClientUrl() 105 accountLink = videoChannel.Account.getClientUrl()
105 106
106 if (videoChannel.Actor.hasImage(ActorImageType.AVATAR)) { 107 if (videoChannel.Actor.hasImage(ActorImageType.AVATAR)) {
107 imageUrl = WEBSERVER.URL + videoChannel.Actor.Avatars[0].getStaticPath() 108 const videoChannelAvatar = maxBy(videoChannel.Actor.Avatars, 'width')
109 imageUrl = WEBSERVER.URL + videoChannelAvatar.getStaticPath()
108 } 110 }
109 111
110 if (videoChannel.Account.Actor.hasImage(ActorImageType.AVATAR)) { 112 if (videoChannel.Account.Actor.hasImage(ActorImageType.AVATAR)) {
111 accountImageUrl = WEBSERVER.URL + videoChannel.Account.Actor.Avatars[0].getStaticPath() 113 const accountAvatar = maxBy(videoChannel.Account.Actor.Avatars, 'width')
114 accountImageUrl = WEBSERVER.URL + accountAvatar.getStaticPath()
112 } 115 }
113 116
114 user = await UserModel.loadById(videoChannel.Account.userId) 117 user = await UserModel.loadById(videoChannel.Account.userId)
@@ -120,7 +123,8 @@ export async function buildFeedMetadata (options: {
120 accountLink = link 123 accountLink = link
121 124
122 if (account.Actor.hasImage(ActorImageType.AVATAR)) { 125 if (account.Actor.hasImage(ActorImageType.AVATAR)) {
123 imageUrl = WEBSERVER.URL + account.Actor.Avatars[0].getStaticPath() 126 const accountAvatar = maxBy(account.Actor.Avatars, 'width')
127 imageUrl = WEBSERVER.URL + accountAvatar?.getStaticPath()
124 accountImageUrl = imageUrl 128 accountImageUrl = imageUrl
125 } 129 }
126 130