1
0
Fork 0
peertube/shared/server-commands/videos/channels.ts
kontrollanten d0800f7661
Implement avatar miniatures (#4639)
* client: remove unused file

* refactor(client/my-actor-avatar): size from input

Read size from component input instead of scss, to make it possible to
use smaller avatar images when implemented.

* implement avatar miniatures

close #4560

* fix(test): max file size

* fix(search-index): normalize res acc to avatarMini

* refactor avatars to an array

* client/search: resize channel avatar to 120

* refactor(client/videos): remove unused function

* client(actor-avatar): set default size

* fix tests and avatars full result

When findOne is used only an array containting one avatar is returned.

* update migration version and version notations

* server/search: harmonize normalizing

* Cleanup avatar miniature PR

Co-authored-by: Chocobozzz <me@florianbigard.com>
2022-02-28 08:34:43 +01:00

29 lines
755 B
TypeScript

import { PeerTubeServer } from '../server/server'
function setDefaultVideoChannel (servers: PeerTubeServer[]) {
const tasks: Promise<any>[] = []
for (const server of servers) {
const p = server.users.getMyInfo()
.then(user => { server.store.channel = user.videoChannels[0] })
tasks.push(p)
}
return Promise.all(tasks)
}
async function setDefaultChannelAvatar (serversArg: PeerTubeServer | PeerTubeServer[], channelName: string = 'root_channel') {
const servers = Array.isArray(serversArg)
? serversArg
: [ serversArg ]
for (const server of servers) {
await server.channels.updateImage({ channelName, fixture: 'avatar.png', type: 'avatar' })
}
}
export {
setDefaultVideoChannel,
setDefaultChannelAvatar
}