aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos/channels.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-09 11:21:30 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commita54618880c394ad7571f3f3222dc96ec2dd10d9a (patch)
treec9f7b05e578abc2383bccd707c11438c61857c72 /shared/extra-utils/videos/channels.ts
parent57f879a540551c3b958b0991c8e1e3657a4481d8 (diff)
downloadPeerTube-a54618880c394ad7571f3f3222dc96ec2dd10d9a.tar.gz
PeerTube-a54618880c394ad7571f3f3222dc96ec2dd10d9a.tar.zst
PeerTube-a54618880c394ad7571f3f3222dc96ec2dd10d9a.zip
Introduce channels command
Diffstat (limited to 'shared/extra-utils/videos/channels.ts')
-rw-r--r--shared/extra-utils/videos/channels.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/shared/extra-utils/videos/channels.ts b/shared/extra-utils/videos/channels.ts
new file mode 100644
index 000000000..a77543c92
--- /dev/null
+++ b/shared/extra-utils/videos/channels.ts
@@ -0,0 +1,20 @@
1import { User } from '../../models/users/user.model'
2import { ServerInfo } from '../server/servers'
3import { getMyUserInformation } from '../users/users'
4
5function 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
18export {
19 setDefaultVideoChannel
20}