aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-06-21 10:44:40 +0200
committerChocobozzz <me@florianbigard.com>2023-06-21 10:44:40 +0200
commit2c16f5ad5efc11ab47151107d74f2db22af6ff90 (patch)
treeb9284bdf95dc9a9ea340ea70268f81299880418a
parentb4516abc392ed2b38cb7b587929a9249ddeb2b30 (diff)
downloadPeerTube-2c16f5ad5efc11ab47151107d74f2db22af6ff90.tar.gz
PeerTube-2c16f5ad5efc11ab47151107d74f2db22af6ff90.tar.zst
PeerTube-2c16f5ad5efc11ab47151107d74f2db22af6ff90.zip
Fix undefined actor image
-rw-r--r--server/controllers/feeds/shared/common-feed-utils.ts8
-rw-r--r--server/controllers/feeds/video-podcast-feeds.ts4
2 files changed, 6 insertions, 6 deletions
diff --git a/server/controllers/feeds/shared/common-feed-utils.ts b/server/controllers/feeds/shared/common-feed-utils.ts
index 8f35a8b35..9e2f8adbb 100644
--- a/server/controllers/feeds/shared/common-feed-utils.ts
+++ b/server/controllers/feeds/shared/common-feed-utils.ts
@@ -1,10 +1,10 @@
1import express from 'express' 1import express from 'express'
2import { maxBy } from 'lodash'
3import { Feed } from '@peertube/feed' 2import { Feed } from '@peertube/feed'
4import { CustomTag, CustomXMLNS, Person } from '@peertube/feed/lib/typings' 3import { CustomTag, CustomXMLNS, Person } from '@peertube/feed/lib/typings'
5import { mdToOneLinePlainText } from '@server/helpers/markdown' 4import { mdToOneLinePlainText } from '@server/helpers/markdown'
6import { CONFIG } from '@server/initializers/config' 5import { CONFIG } from '@server/initializers/config'
7import { WEBSERVER } from '@server/initializers/constants' 6import { WEBSERVER } from '@server/initializers/constants'
7import { getBiggestActorImage } from '@server/lib/actor-image'
8import { UserModel } from '@server/models/user/user' 8import { UserModel } from '@server/models/user/user'
9import { MAccountDefault, MChannelBannerAccountDefault, MUser, MVideoFullLight } from '@server/types/models' 9import { MAccountDefault, MChannelBannerAccountDefault, MUser, MVideoFullLight } from '@server/types/models'
10import { pick } from '@shared/core-utils' 10import { pick } from '@shared/core-utils'
@@ -105,12 +105,12 @@ export async function buildFeedMetadata (options: {
105 accountLink = videoChannel.Account.getClientUrl() 105 accountLink = videoChannel.Account.getClientUrl()
106 106
107 if (videoChannel.Actor.hasImage(ActorImageType.AVATAR)) { 107 if (videoChannel.Actor.hasImage(ActorImageType.AVATAR)) {
108 const videoChannelAvatar = maxBy(videoChannel.Actor.Avatars, 'width') 108 const videoChannelAvatar = getBiggestActorImage(videoChannel.Actor.Avatars)
109 imageUrl = WEBSERVER.URL + videoChannelAvatar.getStaticPath() 109 imageUrl = WEBSERVER.URL + videoChannelAvatar.getStaticPath()
110 } 110 }
111 111
112 if (videoChannel.Account.Actor.hasImage(ActorImageType.AVATAR)) { 112 if (videoChannel.Account.Actor.hasImage(ActorImageType.AVATAR)) {
113 const accountAvatar = maxBy(videoChannel.Account.Actor.Avatars, 'width') 113 const accountAvatar = getBiggestActorImage(videoChannel.Account.Actor.Avatars)
114 accountImageUrl = WEBSERVER.URL + accountAvatar.getStaticPath() 114 accountImageUrl = WEBSERVER.URL + accountAvatar.getStaticPath()
115 } 115 }
116 116
@@ -123,7 +123,7 @@ export async function buildFeedMetadata (options: {
123 accountLink = link 123 accountLink = link
124 124
125 if (account.Actor.hasImage(ActorImageType.AVATAR)) { 125 if (account.Actor.hasImage(ActorImageType.AVATAR)) {
126 const accountAvatar = maxBy(account.Actor.Avatars, 'width') 126 const accountAvatar = getBiggestActorImage(account.Actor.Avatars)
127 imageUrl = WEBSERVER.URL + accountAvatar?.getStaticPath() 127 imageUrl = WEBSERVER.URL + accountAvatar?.getStaticPath()
128 accountImageUrl = imageUrl 128 accountImageUrl = imageUrl
129 } 129 }
diff --git a/server/controllers/feeds/video-podcast-feeds.ts b/server/controllers/feeds/video-podcast-feeds.ts
index f63f6ee63..5afb51594 100644
--- a/server/controllers/feeds/video-podcast-feeds.ts
+++ b/server/controllers/feeds/video-podcast-feeds.ts
@@ -1,8 +1,8 @@
1import express from 'express' 1import express from 'express'
2import { maxBy } from 'lodash'
3import { extname } from 'path' 2import { extname } from 'path'
4import { Feed } from '@peertube/feed' 3import { Feed } from '@peertube/feed'
5import { CustomTag, CustomXMLNS, LiveItemStatus } from '@peertube/feed/lib/typings' 4import { CustomTag, CustomXMLNS, LiveItemStatus } from '@peertube/feed/lib/typings'
5import { getBiggestActorImage } from '@server/lib/actor-image'
6import { InternalEventEmitter } from '@server/lib/internal-event-emitter' 6import { InternalEventEmitter } from '@server/lib/internal-event-emitter'
7import { Hooks } from '@server/lib/plugins/hooks' 7import { Hooks } from '@server/lib/plugins/hooks'
8import { buildPodcastGroupsCache, cacheRouteFactory, videoFeedsPodcastSetCacheKey } from '@server/middlewares' 8import { buildPodcastGroupsCache, cacheRouteFactory, videoFeedsPodcastSetCacheKey } from '@server/middlewares'
@@ -150,7 +150,7 @@ async function generatePodcastItem (options: {
150 let personImage: string 150 let personImage: string
151 151
152 if (account.Actor.hasImage(ActorImageType.AVATAR)) { 152 if (account.Actor.hasImage(ActorImageType.AVATAR)) {
153 const avatar = maxBy(account.Actor.Avatars, 'width') 153 const avatar = getBiggestActorImage(account.Actor.Avatars, 'width')
154 personImage = WEBSERVER.URL + avatar.getStaticPath() 154 personImage = WEBSERVER.URL + avatar.getStaticPath()
155 } 155 }
156 156