aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools/peertube-upload.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tools/peertube-upload.ts')
-rw-r--r--server/tools/peertube-upload.ts9
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()
4import { program } from 'commander' 4import { program } from 'commander'
5import { access, constants } from 'fs-extra' 5import { access, constants } from 'fs-extra'
6import { isAbsolute } from 'path' 6import { isAbsolute } from 'path'
7import { getAccessToken } from '../../shared/extra-utils'
8import { uploadVideo } from '../../shared/extra-utils/' 7import { uploadVideo } from '../../shared/extra-utils/'
9import { buildCommonVideoOptions, buildServer, buildVideoAttributesFromCommander, getServerCredentials } from './cli' 8import { assignToken, buildCommonVideoOptions, buildServer, buildVideoAttributesFromCommander, getServerCredentials } from './cli'
10 9
11let command = program 10let 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
48async function run (url: string, username: string, password: string) { 47async 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) {