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