aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools/peertube-upload.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-13 11:44:16 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commitd0a0fa429d4651710ed951a3c11af0219e408964 (patch)
treec0638f2604e3442d1f15715b9b0f01ecab17ab20 /server/tools/peertube-upload.ts
parent41d1d075011174e73dccb74006181a92a618d7b4 (diff)
downloadPeerTube-d0a0fa429d4651710ed951a3c11af0219e408964.tar.gz
PeerTube-d0a0fa429d4651710ed951a3c11af0219e408964.tar.zst
PeerTube-d0a0fa429d4651710ed951a3c11af0219e408964.zip
Adapt CLI to new commands
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) {