diff options
author | Chocobozzz <me@florianbigard.com> | 2023-06-21 10:44:40 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-06-21 10:44:40 +0200 |
commit | 2c16f5ad5efc11ab47151107d74f2db22af6ff90 (patch) | |
tree | b9284bdf95dc9a9ea340ea70268f81299880418a /server/controllers | |
parent | b4516abc392ed2b38cb7b587929a9249ddeb2b30 (diff) | |
download | PeerTube-2c16f5ad5efc11ab47151107d74f2db22af6ff90.tar.gz PeerTube-2c16f5ad5efc11ab47151107d74f2db22af6ff90.tar.zst PeerTube-2c16f5ad5efc11ab47151107d74f2db22af6ff90.zip |
Fix undefined actor image
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/feeds/shared/common-feed-utils.ts | 8 | ||||
-rw-r--r-- | server/controllers/feeds/video-podcast-feeds.ts | 4 |
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 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { maxBy } from 'lodash' | ||
3 | import { Feed } from '@peertube/feed' | 2 | import { Feed } from '@peertube/feed' |
4 | import { CustomTag, CustomXMLNS, Person } from '@peertube/feed/lib/typings' | 3 | import { CustomTag, CustomXMLNS, Person } from '@peertube/feed/lib/typings' |
5 | import { mdToOneLinePlainText } from '@server/helpers/markdown' | 4 | import { mdToOneLinePlainText } from '@server/helpers/markdown' |
6 | import { CONFIG } from '@server/initializers/config' | 5 | import { CONFIG } from '@server/initializers/config' |
7 | import { WEBSERVER } from '@server/initializers/constants' | 6 | import { WEBSERVER } from '@server/initializers/constants' |
7 | import { getBiggestActorImage } from '@server/lib/actor-image' | ||
8 | import { UserModel } from '@server/models/user/user' | 8 | import { UserModel } from '@server/models/user/user' |
9 | import { MAccountDefault, MChannelBannerAccountDefault, MUser, MVideoFullLight } from '@server/types/models' | 9 | import { MAccountDefault, MChannelBannerAccountDefault, MUser, MVideoFullLight } from '@server/types/models' |
10 | import { pick } from '@shared/core-utils' | 10 | import { 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 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { maxBy } from 'lodash' | ||
3 | import { extname } from 'path' | 2 | import { extname } from 'path' |
4 | import { Feed } from '@peertube/feed' | 3 | import { Feed } from '@peertube/feed' |
5 | import { CustomTag, CustomXMLNS, LiveItemStatus } from '@peertube/feed/lib/typings' | 4 | import { CustomTag, CustomXMLNS, LiveItemStatus } from '@peertube/feed/lib/typings' |
5 | import { getBiggestActorImage } from '@server/lib/actor-image' | ||
6 | import { InternalEventEmitter } from '@server/lib/internal-event-emitter' | 6 | import { InternalEventEmitter } from '@server/lib/internal-event-emitter' |
7 | import { Hooks } from '@server/lib/plugins/hooks' | 7 | import { Hooks } from '@server/lib/plugins/hooks' |
8 | import { buildPodcastGroupsCache, cacheRouteFactory, videoFeedsPodcastSetCacheKey } from '@server/middlewares' | 8 | import { 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 | ||