mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
Add ability to set avatar to instance
This commit is contained in:
parent
db06d13c67
commit
bb7cb0d2fd
29 changed files with 693 additions and 348 deletions
|
@ -20,6 +20,7 @@ import { CONFIG } from '../../initializers/config.js'
|
|||
import { LAZY_STATIC_PATHS, MIMETYPES, WEBSERVER } from '../../initializers/constants.js'
|
||||
import { SequelizeModel, buildSQLAttributes, throwIfNotValid } from '../shared/index.js'
|
||||
import { ActorModel } from './actor.js'
|
||||
import { getServerActor } from '../application/application.js'
|
||||
|
||||
@Table({
|
||||
tableName: 'actorImage',
|
||||
|
@ -123,6 +124,15 @@ export class ActorImageModel extends SequelizeModel<ActorImageModel> {
|
|||
return ActorImageModel.findAll(query)
|
||||
}
|
||||
|
||||
static async listServerActorImages () {
|
||||
const serverActor = await getServerActor()
|
||||
const promises = [ ActorImageType.AVATAR, ActorImageType.BANNER ].map(type => ActorImageModel.listByActor(serverActor, type))
|
||||
|
||||
const [ avatars, banners ] = await Promise.all(promises)
|
||||
|
||||
return { avatars, banners }
|
||||
}
|
||||
|
||||
static getImageUrl (image: MActorImage) {
|
||||
if (!image) return undefined
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue