diff options
Diffstat (limited to 'server/tools/peertube-get-access-token.ts')
-rw-r--r-- | server/tools/peertube-get-access-token.ts | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/server/tools/peertube-get-access-token.ts b/server/tools/peertube-get-access-token.ts index 85660de2c..103495347 100644 --- a/server/tools/peertube-get-access-token.ts +++ b/server/tools/peertube-get-access-token.ts | |||
@@ -1,12 +1,5 @@ | |||
1 | import * as program from 'commander' | 1 | import * as program from 'commander' |
2 | 2 | import { getClient, Server, serverLogin } from '../../shared/extra-utils' | |
3 | import { | ||
4 | getClient, | ||
5 | serverLogin, | ||
6 | Server, | ||
7 | Client, | ||
8 | User | ||
9 | } from '../../shared/extra-utils' | ||
10 | 3 | ||
11 | program | 4 | program |
12 | .option('-u, --url <url>', 'Server url') | 5 | .option('-u, --url <url>', 'Server url') |
@@ -22,6 +15,7 @@ if ( | |||
22 | if (!program['url']) console.error('--url field is required.') | 15 | if (!program['url']) console.error('--url field is required.') |
23 | if (!program['username']) console.error('--username field is required.') | 16 | if (!program['username']) console.error('--username field is required.') |
24 | if (!program['password']) console.error('--password field is required.') | 17 | if (!program['password']) console.error('--password field is required.') |
18 | |||
25 | process.exit(-1) | 19 | process.exit(-1) |
26 | } | 20 | } |
27 | 21 | ||
@@ -32,11 +26,11 @@ getClient(program.url) | |||
32 | user: { | 26 | user: { |
33 | username: program['username'], | 27 | username: program['username'], |
34 | password: program['password'] | 28 | password: program['password'] |
35 | } as User, | 29 | }, |
36 | client: { | 30 | client: { |
37 | id: res.body.client_id as string, | 31 | id: res.body.client_id, |
38 | secret: res.body.client_secret as string | 32 | secret: res.body.client_secret |
39 | } as Client | 33 | } |
40 | } as Server | 34 | } as Server |
41 | 35 | ||
42 | return serverLogin(server) | 36 | return serverLogin(server) |