]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - shared/extra-utils/videos/channels.ts
a77543c92e2c91e04c3207d5727cdafdc6038d0b
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / videos / channels.ts
1 import { User } from '../../models/users/user.model'
2 import { ServerInfo } from '../server/servers'
3 import { getMyUserInformation } from '../users/users'
4
5 function setDefaultVideoChannel (servers: ServerInfo[]) {
6 const tasks: Promise<any>[] = []
7
8 for (const server of servers) {
9 const p = getMyUserInformation(server.url, server.accessToken)
10 .then(res => { server.videoChannel = (res.body as User).videoChannels[0] })
11
12 tasks.push(p)
13 }
14
15 return Promise.all(tasks)
16 }
17
18 export {
19 setDefaultVideoChannel
20 }