2021-07-16 03:47:51 -04:00
|
|
|
import { PeerTubeServer } from '../server/server'
|
2021-07-09 05:21:30 -04:00
|
|
|
|
2021-07-16 03:47:51 -04:00
|
|
|
function setDefaultVideoChannel (servers: PeerTubeServer[]) {
|
2021-07-09 05:21:30 -04:00
|
|
|
const tasks: Promise<any>[] = []
|
|
|
|
|
|
|
|
for (const server of servers) {
|
2021-07-16 03:04:35 -04:00
|
|
|
const p = server.users.getMyInfo()
|
|
|
|
.then(user => { server.store.channel = user.videoChannels[0] })
|
2021-07-09 05:21:30 -04:00
|
|
|
|
|
|
|
tasks.push(p)
|
|
|
|
}
|
|
|
|
|
|
|
|
return Promise.all(tasks)
|
|
|
|
}
|
|
|
|
|
2022-02-28 02:34:43 -05:00
|
|
|
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' })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-09 05:21:30 -04:00
|
|
|
export {
|
2022-02-28 02:34:43 -05:00
|
|
|
setDefaultVideoChannel,
|
|
|
|
setDefaultChannelAvatar
|
2021-07-09 05:21:30 -04:00
|
|
|
}
|