2021-07-16 03:47:51 -04:00
|
|
|
import { PeerTubeServer } from '../server/server'
|
2019-07-11 11:23:24 -04:00
|
|
|
|
2021-07-16 03:47:51 -04:00
|
|
|
function setAccessTokensToServers (servers: PeerTubeServer[]) {
|
2017-09-04 15:21:47 -04:00
|
|
|
const tasks: Promise<any>[] = []
|
|
|
|
|
|
|
|
for (const server of servers) {
|
2021-07-16 03:04:35 -04:00
|
|
|
const p = server.login.getAccessToken()
|
2021-07-13 05:05:15 -04:00
|
|
|
.then(t => { server.accessToken = t })
|
2017-09-04 15:21:47 -04:00
|
|
|
tasks.push(p)
|
|
|
|
}
|
|
|
|
|
|
|
|
return Promise.all(tasks)
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
2021-07-13 05:05:15 -04:00
|
|
|
setAccessTokensToServers
|
2017-09-04 15:21:47 -04:00
|
|
|
}
|