createdAt: Date | string
- // TODO: remove, deprecated in 4.2
- avatar: never
-
avatars: ActorImage[]
isLocal: boolean
nameWithHost: string
nameWithHostForced: string
- // TODO: remove, deprecated in 4.2
- banner: never
-
banners: ActorImage[]
bannerUrl: string
url: string
host: string
- // TODO: remove, deprecated in 4.2
- avatar: ActorImage
-
avatars: ActorImage[]
}
url: string
host: string
- // TODO: remove, deprecated in 4.2
- avatar: ActorImage
-
avatars: ActorImage[]
}
import 'multer'
import express from 'express'
import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger'
-import { getBiggestActorImage } from '@server/lib/actor-image'
import { Hooks } from '@server/lib/plugins/hooks'
import { pick } from '@shared/core-utils'
import { ActorImageType, HttpStatusCode, UserUpdateMe, UserVideoQuota, UserVideoRate as FormattedUserVideoRate } from '@shared/models'
)
return res.json({
- // TODO: remove, deprecated in 4.2
- avatar: getBiggestActorImage(avatars).toFormattedJSON(),
avatars: avatars.map(avatar => avatar.toFormattedJSON())
})
}
import express from 'express'
import { pickCommonVideoQuery } from '@server/helpers/query'
-import { getBiggestActorImage } from '@server/lib/actor-image'
import { Hooks } from '@server/lib/plugins/hooks'
import { ActorFollowModel } from '@server/models/actor/actor-follow'
import { getServerActor } from '@server/models/application/application'
auditLogger.update(getAuditIdFromRes(res), new VideoChannelAuditView(videoChannel.toFormattedJSON()), oldVideoChannelAuditKeys)
return res.json({
- // TODO: remove, deprecated in 4.2
- banner: getBiggestActorImage(banners).toFormattedJSON(),
banners: banners.map(b => b.toFormattedJSON())
})
}
auditLogger.update(getAuditIdFromRes(res), new VideoChannelAuditView(videoChannel.toFormattedJSON()), oldVideoChannelAuditKeys)
return res.json({
- // TODO: remove, deprecated in 4.2
- avatar: getBiggestActorImage(avatars).toFormattedJSON(),
avatars: avatars.map(a => a.toFormattedJSON())
})
}
function getImagesInfoFromObject (actorObject: ActivityPubActor, type: ActorImageType) {
const iconsOrImages = type === ActorImageType.AVATAR
- ? actorObject.icons || actorObject.icon
+ ? actorObject.icon
: actorObject.image
return normalizeIconOrImage(iconsOrImages)
language: 'sc:inLanguage',
identifier: 'sc:identifier',
- // TODO: remove in a few versions, introduced in 4.2
- icons: 'as:icon',
-
isLiveBroadcast: 'sc:isLiveBroadcast',
liveSaveReplay: {
'@type': 'sc:Boolean',
name: actor.name,
url: actor.url,
host: actor.host,
- avatars: actor.avatars,
-
- // TODO: remove, deprecated in 4.2
- avatar: actor.avatar
+ avatars: actor.avatars
}
}
url: this.url,
name: this.preferredUsername,
host: this.getHost(),
- avatars: (this.Avatars || []).map(a => a.toFormattedJSON()),
-
- // TODO: remove, deprecated in 4.2
- avatar: this.hasImage(ActorImageType.AVATAR)
- ? this.Avatars[0].toFormattedJSON()
- : undefined
+ avatars: (this.Avatars || []).map(a => a.toFormattedJSON())
}
}
followersCount: this.followersCount,
createdAt: this.getCreatedAt(),
- banners: (this.Banners || []).map(b => b.toFormattedJSON()),
-
- // TODO: remove, deprecated in 4.2
- banner: this.hasImage(ActorImageType.BANNER)
- ? this.Banners[0].toFormattedJSON()
- : undefined
+ banners: (this.Banners || []).map(b => b.toFormattedJSON())
}
}
toActivityPubObject (this: MActorAPChannel | MActorAPAccount, name: string) {
- let icon: ActivityIconObject
- let icons: ActivityIconObject[]
+ let icon: ActivityIconObject[]
let image: ActivityIconObject
if (this.hasImage(ActorImageType.AVATAR)) {
- icon = getBiggestActorImage(this.Avatars).toActivityPubObject()
- icons = this.Avatars.map(a => a.toActivityPubObject())
+ icon = this.Avatars.map(a => a.toActivityPubObject())
}
if (this.hasImage(ActorImageType.BANNER)) {
published: this.getCreatedAt().toISOString(),
icon,
- icons,
image
}
displayName: this.getDisplayName(),
url: actor.url,
host: actor.host,
- avatars: actor.avatars,
-
- // TODO: remove, deprecated in 4.2
- avatar: actor.avatar
+ avatars: actor.avatars
}
}
viewsPerDay,
totalViews,
- avatars: actor.avatars,
-
- // TODO: remove, deprecated in 4.2
- avatar: actor.avatar
+ avatars: actor.avatars
}
if (this.Account) videoChannel.ownerAccount = this.Account.toFormattedJSON()
expect(video.account.host).to.equal('framatube.org')
expect(video.account.name).to.equal('framasoft')
expect(video.account.url).to.equal('https://framatube.org/accounts/framasoft')
- // TODO: remove, deprecated in 4.2
- expect(video.account.avatar).to.exist
expect(video.account.avatars.length).to.equal(2, 'Account should have one avatar image')
expect(video.channel.host).to.equal('framatube.org')
expect(video.channel.name).to.equal('joinpeertube')
expect(video.channel.url).to.equal('https://framatube.org/video-channels/joinpeertube')
- // TODO: remove, deprecated in 4.2
- expect(video.channel.avatar).to.exist
expect(video.channel.avatars.length).to.equal(2, 'Channel should have one avatar image')
}
const videoChannel = body.data[0]
expect(videoChannel.url).to.equal('https://framatube.org/video-channels/bf54d359-cfad-4935-9d45-9d6be93f63e8')
expect(videoChannel.host).to.equal('framatube.org')
- // TODO: remove, deprecated in 4.2
- expect(videoChannel.avatar).to.exist
expect(videoChannel.avatars.length).to.equal(2, 'Channel should have two avatar images')
expect(videoChannel.displayName).to.exist
expect(videoChannel.ownerAccount.url).to.equal('https://framatube.org/accounts/framasoft')
expect(videoChannel.ownerAccount.name).to.equal('framasoft')
expect(videoChannel.ownerAccount.host).to.equal('framatube.org')
- // TODO: remove, deprecated in 4.2
- expect(videoChannel.ownerAccount.avatar).to.exist
expect(videoChannel.ownerAccount.avatars.length).to.equal(2, 'Account should have two avatar images')
}
expect(videoPlaylist.ownerAccount.url).to.equal('https://peertube2.cpy.re/accounts/chocobozzz')
expect(videoPlaylist.ownerAccount.name).to.equal('chocobozzz')
expect(videoPlaylist.ownerAccount.host).to.equal('peertube2.cpy.re')
- // TODO: remove, deprecated in 4.2
- expect(videoPlaylist.ownerAccount.avatar).to.exist
expect(videoPlaylist.ownerAccount.avatars.length).to.equal(2, 'Account should have two avatar images')
expect(videoPlaylist.videoChannel.url).to.equal('https://peertube2.cpy.re/video-channels/chocobozzz_channel')
expect(videoPlaylist.videoChannel.name).to.equal('chocobozzz_channel')
expect(videoPlaylist.videoChannel.host).to.equal('peertube2.cpy.re')
- // TODO: remove, deprecated in 4.2
- expect(videoPlaylist.videoChannel.avatar).to.exist
expect(videoPlaylist.videoChannel.avatars.length).to.equal(2, 'Channel should have two avatar images')
}
}
image?: ActivityIconObject | ActivityIconObject[]
-
icon?: ActivityIconObject | ActivityIconObject[]
- // TODO: migrate to `icon`, introduced in 4.2
- icons?: ActivityIconObject[]
published?: string
}
host: string
avatars: ActorImage[]
-
- // TODO: remove, deprecated in 4.2
- avatar: ActorImage
}
createdAt: Date | string
avatars: ActorImage[]
-
- // TODO: remove, deprecated in 4.2
- avatar: ActorImage
}
totalViews?: number
banners: ActorImage[]
-
- // TODO: remove, deprecated in 4.2
- banner: ActorImage
}
export interface VideoChannelSummary {
host: string
avatars: ActorImage[]
-
- // TODO: remove, deprecated in 4.2
- avatar: ActorImage
}