Fix undefined actor image
This commit is contained in:
parent
b4516abc39
commit
2c16f5ad5e
|
@ -1,10 +1,10 @@
|
||||||
import express from 'express'
|
import express from 'express'
|
||||||
import { maxBy } from 'lodash'
|
|
||||||
import { Feed } from '@peertube/feed'
|
import { Feed } from '@peertube/feed'
|
||||||
import { CustomTag, CustomXMLNS, Person } from '@peertube/feed/lib/typings'
|
import { CustomTag, CustomXMLNS, Person } from '@peertube/feed/lib/typings'
|
||||||
import { mdToOneLinePlainText } from '@server/helpers/markdown'
|
import { mdToOneLinePlainText } from '@server/helpers/markdown'
|
||||||
import { CONFIG } from '@server/initializers/config'
|
import { CONFIG } from '@server/initializers/config'
|
||||||
import { WEBSERVER } from '@server/initializers/constants'
|
import { WEBSERVER } from '@server/initializers/constants'
|
||||||
|
import { getBiggestActorImage } from '@server/lib/actor-image'
|
||||||
import { UserModel } from '@server/models/user/user'
|
import { UserModel } from '@server/models/user/user'
|
||||||
import { MAccountDefault, MChannelBannerAccountDefault, MUser, MVideoFullLight } from '@server/types/models'
|
import { MAccountDefault, MChannelBannerAccountDefault, MUser, MVideoFullLight } from '@server/types/models'
|
||||||
import { pick } from '@shared/core-utils'
|
import { pick } from '@shared/core-utils'
|
||||||
|
@ -105,12 +105,12 @@ export async function buildFeedMetadata (options: {
|
||||||
accountLink = videoChannel.Account.getClientUrl()
|
accountLink = videoChannel.Account.getClientUrl()
|
||||||
|
|
||||||
if (videoChannel.Actor.hasImage(ActorImageType.AVATAR)) {
|
if (videoChannel.Actor.hasImage(ActorImageType.AVATAR)) {
|
||||||
const videoChannelAvatar = maxBy(videoChannel.Actor.Avatars, 'width')
|
const videoChannelAvatar = getBiggestActorImage(videoChannel.Actor.Avatars)
|
||||||
imageUrl = WEBSERVER.URL + videoChannelAvatar.getStaticPath()
|
imageUrl = WEBSERVER.URL + videoChannelAvatar.getStaticPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (videoChannel.Account.Actor.hasImage(ActorImageType.AVATAR)) {
|
if (videoChannel.Account.Actor.hasImage(ActorImageType.AVATAR)) {
|
||||||
const accountAvatar = maxBy(videoChannel.Account.Actor.Avatars, 'width')
|
const accountAvatar = getBiggestActorImage(videoChannel.Account.Actor.Avatars)
|
||||||
accountImageUrl = WEBSERVER.URL + accountAvatar.getStaticPath()
|
accountImageUrl = WEBSERVER.URL + accountAvatar.getStaticPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ export async function buildFeedMetadata (options: {
|
||||||
accountLink = link
|
accountLink = link
|
||||||
|
|
||||||
if (account.Actor.hasImage(ActorImageType.AVATAR)) {
|
if (account.Actor.hasImage(ActorImageType.AVATAR)) {
|
||||||
const accountAvatar = maxBy(account.Actor.Avatars, 'width')
|
const accountAvatar = getBiggestActorImage(account.Actor.Avatars)
|
||||||
imageUrl = WEBSERVER.URL + accountAvatar?.getStaticPath()
|
imageUrl = WEBSERVER.URL + accountAvatar?.getStaticPath()
|
||||||
accountImageUrl = imageUrl
|
accountImageUrl = imageUrl
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import express from 'express'
|
import express from 'express'
|
||||||
import { maxBy } from 'lodash'
|
|
||||||
import { extname } from 'path'
|
import { extname } from 'path'
|
||||||
import { Feed } from '@peertube/feed'
|
import { Feed } from '@peertube/feed'
|
||||||
import { CustomTag, CustomXMLNS, LiveItemStatus } from '@peertube/feed/lib/typings'
|
import { CustomTag, CustomXMLNS, LiveItemStatus } from '@peertube/feed/lib/typings'
|
||||||
|
import { getBiggestActorImage } from '@server/lib/actor-image'
|
||||||
import { InternalEventEmitter } from '@server/lib/internal-event-emitter'
|
import { InternalEventEmitter } from '@server/lib/internal-event-emitter'
|
||||||
import { Hooks } from '@server/lib/plugins/hooks'
|
import { Hooks } from '@server/lib/plugins/hooks'
|
||||||
import { buildPodcastGroupsCache, cacheRouteFactory, videoFeedsPodcastSetCacheKey } from '@server/middlewares'
|
import { buildPodcastGroupsCache, cacheRouteFactory, videoFeedsPodcastSetCacheKey } from '@server/middlewares'
|
||||||
|
@ -150,7 +150,7 @@ async function generatePodcastItem (options: {
|
||||||
let personImage: string
|
let personImage: string
|
||||||
|
|
||||||
if (account.Actor.hasImage(ActorImageType.AVATAR)) {
|
if (account.Actor.hasImage(ActorImageType.AVATAR)) {
|
||||||
const avatar = maxBy(account.Actor.Avatars, 'width')
|
const avatar = getBiggestActorImage(account.Actor.Avatars, 'width')
|
||||||
personImage = WEBSERVER.URL + avatar.getStaticPath()
|
personImage = WEBSERVER.URL + avatar.getStaticPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue