diff options
Diffstat (limited to 'server/tools/cli.ts')
-rw-r--r-- | server/tools/cli.ts | 15 |
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' | |||
2 | import { Netrc } from 'netrc-parser' | 2 | import { Netrc } from 'netrc-parser' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { createLogger, format, transports } from 'winston' | 4 | import { createLogger, format, transports } from 'winston' |
5 | import { assignCommands, ServerInfo } from '@shared/extra-utils' | 5 | import { PeerTubeServer } from '@shared/extra-utils' |
6 | import { UserRole } from '@shared/models' | 6 | import { UserRole } from '@shared/models' |
7 | import { VideoPrivacy } from '../../shared/models/videos' | 7 | import { VideoPrivacy } from '../../shared/models/videos' |
8 | import { getAppNumber, isTestInstance, root } from '../helpers/core-utils' | 8 | import { getAppNumber, isTestInstance, root } from '../helpers/core-utils' |
@@ -14,7 +14,7 @@ const config = require('application-config')(configName) | |||
14 | 14 | ||
15 | const version = require('../../../package.json').version | 15 | const version = require('../../../package.json').version |
16 | 16 | ||
17 | async function getAdminTokenOrDie (server: ServerInfo, username: string, password: string) { | 17 | async 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 | ||
127 | async function buildVideoAttributesFromCommander (server: ServerInfo, command: Command, defaultAttributes: any = {}) { | 127 | async 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 | ||
182 | function buildServer (url: string): ServerInfo { | 182 | function 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 | ||
189 | async function assignToken (server: ServerInfo, username: string, password: string) { | 186 | async 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 | ||