diff options
author | Alecks Gates <agates@mail.agates.io> | 2023-06-05 02:00:30 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-05 09:00:30 +0200 |
commit | 1ed1994fffb18a2b0bd74e49b50067ab047f8ab8 (patch) | |
tree | 9f06f52d9a376e75066a4a6f01079cb96de1ba6a /server/controllers/feeds/video-podcast-feeds.ts | |
parent | 9a64621975097f648f6bf19f15b03ba3820918f2 (diff) | |
download | PeerTube-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/video-podcast-feeds.ts')
-rw-r--r-- | server/controllers/feeds/video-podcast-feeds.ts | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/server/controllers/feeds/video-podcast-feeds.ts b/server/controllers/feeds/video-podcast-feeds.ts index 45d31c781..f63f6ee63 100644 --- a/server/controllers/feeds/video-podcast-feeds.ts +++ b/server/controllers/feeds/video-podcast-feeds.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { maxBy } from 'lodash' | ||
2 | import { extname } from 'path' | 3 | import { extname } from 'path' |
3 | import { Feed } from '@peertube/feed' | 4 | import { Feed } from '@peertube/feed' |
4 | import { CustomTag, CustomXMLNS, LiveItemStatus } from '@peertube/feed/lib/typings' | 5 | import { CustomTag, CustomXMLNS, LiveItemStatus } from '@peertube/feed/lib/typings' |
@@ -141,8 +142,21 @@ async function generatePodcastItem (options: { | |||
141 | href: account.getClientUrl() | 142 | href: account.getClientUrl() |
142 | } | 143 | } |
143 | 144 | ||
145 | const commonAttributes = getCommonVideoFeedAttributes(video) | ||
146 | const guid = liveItem | ||
147 | ? `${video.uuid}_${video.publishedAt.toISOString()}` | ||
148 | : commonAttributes.link | ||
149 | |||
150 | let personImage: string | ||
151 | |||
152 | if (account.Actor.hasImage(ActorImageType.AVATAR)) { | ||
153 | const avatar = maxBy(account.Actor.Avatars, 'width') | ||
154 | personImage = WEBSERVER.URL + avatar.getStaticPath() | ||
155 | } | ||
156 | |||
144 | return { | 157 | return { |
145 | ...getCommonVideoFeedAttributes(video), | 158 | guid, |
159 | ...commonAttributes, | ||
146 | 160 | ||
147 | trackers: video.getTrackerUrls(), | 161 | trackers: video.getTrackerUrls(), |
148 | 162 | ||
@@ -151,9 +165,7 @@ async function generatePodcastItem (options: { | |||
151 | { | 165 | { |
152 | ...author, | 166 | ...author, |
153 | 167 | ||
154 | img: account.Actor.hasImage(ActorImageType.AVATAR) | 168 | img: personImage |
155 | ? WEBSERVER.URL + account.Actor.Avatars[0].getStaticPath() | ||
156 | : undefined | ||
157 | } | 169 | } |
158 | ], | 170 | ], |
159 | 171 | ||