diff options
Diffstat (limited to 'server/tools/peertube-upload.ts')
-rw-r--r-- | server/tools/peertube-upload.ts | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/server/tools/peertube-upload.ts b/server/tools/peertube-upload.ts index d1c5348d1..c94b05857 100644 --- a/server/tools/peertube-upload.ts +++ b/server/tools/peertube-upload.ts | |||
@@ -4,9 +4,8 @@ registerTSPaths() | |||
4 | import { program } from 'commander' | 4 | import { program } from 'commander' |
5 | import { access, constants } from 'fs-extra' | 5 | import { access, constants } from 'fs-extra' |
6 | import { isAbsolute } from 'path' | 6 | import { isAbsolute } from 'path' |
7 | import { getAccessToken } from '../../shared/extra-utils' | ||
8 | import { uploadVideo } from '../../shared/extra-utils/' | 7 | import { uploadVideo } from '../../shared/extra-utils/' |
9 | import { buildCommonVideoOptions, buildServer, buildVideoAttributesFromCommander, getServerCredentials } from './cli' | 8 | import { assignToken, buildCommonVideoOptions, buildServer, buildVideoAttributesFromCommander, getServerCredentials } from './cli' |
10 | 9 | ||
11 | let command = program | 10 | let command = program |
12 | .name('upload') | 11 | .name('upload') |
@@ -46,8 +45,8 @@ getServerCredentials(command) | |||
46 | .catch(err => console.error(err)) | 45 | .catch(err => console.error(err)) |
47 | 46 | ||
48 | async function run (url: string, username: string, password: string) { | 47 | async function run (url: string, username: string, password: string) { |
49 | const token = await getAccessToken(url, username, password) | 48 | const server = buildServer(url) |
50 | const server = buildServer(url, token) | 49 | await assignToken(server, username, password) |
51 | 50 | ||
52 | await access(options.file, constants.F_OK) | 51 | await access(options.file, constants.F_OK) |
53 | 52 | ||
@@ -62,7 +61,7 @@ async function run (url: string, username: string, password: string) { | |||
62 | }) | 61 | }) |
63 | 62 | ||
64 | try { | 63 | try { |
65 | await uploadVideo(url, token, videoAttributes) | 64 | await uploadVideo(url, server.accessToken, videoAttributes) |
66 | console.log(`Video ${options.videoName} uploaded.`) | 65 | console.log(`Video ${options.videoName} uploaded.`) |
67 | process.exit(0) | 66 | process.exit(0) |
68 | } catch (err) { | 67 | } catch (err) { |