aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools/cli.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tools/cli.ts')
-rw-r--r--server/tools/cli.ts15
1 files changed, 6 insertions, 9 deletions
diff --git a/server/tools/cli.ts b/server/tools/cli.ts
index 7d5eb72ed..52e6ea593 100644
--- a/server/tools/cli.ts
+++ b/server/tools/cli.ts
@@ -2,7 +2,7 @@ import { Command } from 'commander'
2import { Netrc } from 'netrc-parser' 2import { Netrc } from 'netrc-parser'
3import { join } from 'path' 3import { join } from 'path'
4import { createLogger, format, transports } from 'winston' 4import { createLogger, format, transports } from 'winston'
5import { assignCommands, ServerInfo } from '@shared/extra-utils' 5import { PeerTubeServer } from '@shared/extra-utils'
6import { UserRole } from '@shared/models' 6import { UserRole } from '@shared/models'
7import { VideoPrivacy } from '../../shared/models/videos' 7import { VideoPrivacy } from '../../shared/models/videos'
8import { getAppNumber, isTestInstance, root } from '../helpers/core-utils' 8import { getAppNumber, isTestInstance, root } from '../helpers/core-utils'
@@ -14,7 +14,7 @@ const config = require('application-config')(configName)
14 14
15const version = require('../../../package.json').version 15const version = require('../../../package.json').version
16 16
17async function getAdminTokenOrDie (server: ServerInfo, username: string, password: string) { 17async function getAdminTokenOrDie (server: PeerTubeServer, username: string, password: string) {
18 const token = await server.login.getAccessToken(username, password) 18 const token = await server.login.getAccessToken(username, password)
19 const me = await server.users.getMyInfo({ token }) 19 const me = await server.users.getMyInfo({ token })
20 20
@@ -124,7 +124,7 @@ function buildCommonVideoOptions (command: Command) {
124 .option('-v, --verbose <verbose>', 'Verbosity, from 0/\'error\' to 4/\'debug\'', 'info') 124 .option('-v, --verbose <verbose>', 'Verbosity, from 0/\'error\' to 4/\'debug\'', 'info')
125} 125}
126 126
127async function buildVideoAttributesFromCommander (server: ServerInfo, command: Command, defaultAttributes: any = {}) { 127async function buildVideoAttributesFromCommander (server: PeerTubeServer, command: Command, defaultAttributes: any = {}) {
128 const options = command.opts() 128 const options = command.opts()
129 129
130 const defaultBooleanAttributes = { 130 const defaultBooleanAttributes = {
@@ -179,14 +179,11 @@ function getServerCredentials (program: Command) {
179 }) 179 })
180} 180}
181 181
182function buildServer (url: string): ServerInfo { 182function buildServer (url: string) {
183 const server = { url, internalServerNumber: undefined } 183 return new PeerTubeServer({ url })
184 assignCommands(server)
185
186 return server
187} 184}
188 185
189async function assignToken (server: ServerInfo, username: string, password: string) { 186async function assignToken (server: PeerTubeServer, username: string, password: string) {
190 const bodyClient = await server.login.getClient() 187 const bodyClient = await server.login.getClient()
191 const client = { id: bodyClient.client_id, secret: bodyClient.client_secret } 188 const client = { id: bodyClient.client_id, secret: bodyClient.client_secret }
192 189