mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
Adapt CLI to new commands
This commit is contained in:
parent
41d1d07501
commit
d0a0fa429d
8 changed files with 55 additions and 52 deletions
|
@ -4,9 +4,8 @@ registerTSPaths()
|
|||
import { program } from 'commander'
|
||||
import { access, constants } from 'fs-extra'
|
||||
import { isAbsolute } from 'path'
|
||||
import { getAccessToken } from '../../shared/extra-utils'
|
||||
import { uploadVideo } from '../../shared/extra-utils/'
|
||||
import { buildCommonVideoOptions, buildServer, buildVideoAttributesFromCommander, getServerCredentials } from './cli'
|
||||
import { assignToken, buildCommonVideoOptions, buildServer, buildVideoAttributesFromCommander, getServerCredentials } from './cli'
|
||||
|
||||
let command = program
|
||||
.name('upload')
|
||||
|
@ -46,8 +45,8 @@ getServerCredentials(command)
|
|||
.catch(err => console.error(err))
|
||||
|
||||
async function run (url: string, username: string, password: string) {
|
||||
const token = await getAccessToken(url, username, password)
|
||||
const server = buildServer(url, token)
|
||||
const server = buildServer(url)
|
||||
await assignToken(server, username, password)
|
||||
|
||||
await access(options.file, constants.F_OK)
|
||||
|
||||
|
@ -62,7 +61,7 @@ async function run (url: string, username: string, password: string) {
|
|||
})
|
||||
|
||||
try {
|
||||
await uploadVideo(url, token, videoAttributes)
|
||||
await uploadVideo(url, server.accessToken, videoAttributes)
|
||||
console.log(`Video ${options.videoName} uploaded.`)
|
||||
process.exit(0)
|
||||
} catch (err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue