diff options
Diffstat (limited to 'server/tools/cli.ts')
-rw-r--r-- | server/tools/cli.ts | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/server/tools/cli.ts b/server/tools/cli.ts index 15ac6c6a8..d1a631b69 100644 --- a/server/tools/cli.ts +++ b/server/tools/cli.ts | |||
@@ -31,7 +31,7 @@ async function getAdminTokenOrDie (url: string, username: string, password: stri | |||
31 | } | 31 | } |
32 | 32 | ||
33 | interface Settings { | 33 | interface Settings { |
34 | remotes: any[], | 34 | remotes: any[] |
35 | default: number | 35 | default: number |
36 | } | 36 | } |
37 | 37 | ||
@@ -90,9 +90,9 @@ function getRemoteObjectOrDie ( | |||
90 | if (!program['url'] || !program['username'] || !program['password']) { | 90 | if (!program['url'] || !program['username'] || !program['password']) { |
91 | // No remote and we don't have program parameters: quit | 91 | // No remote and we don't have program parameters: quit |
92 | if (settings.remotes.length === 0 || Object.keys(netrc.machines).length === 0) { | 92 | if (settings.remotes.length === 0 || Object.keys(netrc.machines).length === 0) { |
93 | if (!program[ 'url' ]) console.error('--url field is required.') | 93 | if (!program['url']) console.error('--url field is required.') |
94 | if (!program[ 'username' ]) console.error('--username field is required.') | 94 | if (!program['username']) console.error('--username field is required.') |
95 | if (!program[ 'password' ]) console.error('--password field is required.') | 95 | if (!program['password']) console.error('--password field is required.') |
96 | 96 | ||
97 | return process.exit(-1) | 97 | return process.exit(-1) |
98 | } | 98 | } |
@@ -112,9 +112,9 @@ function getRemoteObjectOrDie ( | |||
112 | } | 112 | } |
113 | 113 | ||
114 | return { | 114 | return { |
115 | url: program[ 'url' ], | 115 | url: program['url'], |
116 | username: program[ 'username' ], | 116 | username: program['username'], |
117 | password: program[ 'password' ] | 117 | password: program['password'] |
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
@@ -150,8 +150,8 @@ async function buildVideoAttributesFromCommander (url: string, command: Command, | |||
150 | const booleanAttributes: { [id in keyof typeof defaultBooleanAttributes]: boolean } | {} = {} | 150 | const booleanAttributes: { [id in keyof typeof defaultBooleanAttributes]: boolean } | {} = {} |
151 | 151 | ||
152 | for (const key of Object.keys(defaultBooleanAttributes)) { | 152 | for (const key of Object.keys(defaultBooleanAttributes)) { |
153 | if (command[ key ] !== undefined) { | 153 | if (command[key] !== undefined) { |
154 | booleanAttributes[key] = command[ key ] | 154 | booleanAttributes[key] = command[key] |
155 | } else if (defaultAttributes[key] !== undefined) { | 155 | } else if (defaultAttributes[key] !== undefined) { |
156 | booleanAttributes[key] = defaultAttributes[key] | 156 | booleanAttributes[key] = defaultAttributes[key] |
157 | } else { | 157 | } else { |
@@ -160,19 +160,19 @@ async function buildVideoAttributesFromCommander (url: string, command: Command, | |||
160 | } | 160 | } |
161 | 161 | ||
162 | const videoAttributes = { | 162 | const videoAttributes = { |
163 | name: command[ 'videoName' ] || defaultAttributes.name, | 163 | name: command['videoName'] || defaultAttributes.name, |
164 | category: command[ 'category' ] || defaultAttributes.category || undefined, | 164 | category: command['category'] || defaultAttributes.category || undefined, |
165 | licence: command[ 'licence' ] || defaultAttributes.licence || undefined, | 165 | licence: command['licence'] || defaultAttributes.licence || undefined, |
166 | language: command[ 'language' ] || defaultAttributes.language || undefined, | 166 | language: command['language'] || defaultAttributes.language || undefined, |
167 | privacy: command[ 'privacy' ] || defaultAttributes.privacy || VideoPrivacy.PUBLIC, | 167 | privacy: command['privacy'] || defaultAttributes.privacy || VideoPrivacy.PUBLIC, |
168 | support: command[ 'support' ] || defaultAttributes.support || undefined, | 168 | support: command['support'] || defaultAttributes.support || undefined, |
169 | description: command[ 'videoDescription' ] || defaultAttributes.description || undefined, | 169 | description: command['videoDescription'] || defaultAttributes.description || undefined, |
170 | tags: command[ 'tags' ] || defaultAttributes.tags || undefined | 170 | tags: command['tags'] || defaultAttributes.tags || undefined |
171 | } | 171 | } |
172 | 172 | ||
173 | Object.assign(videoAttributes, booleanAttributes) | 173 | Object.assign(videoAttributes, booleanAttributes) |
174 | 174 | ||
175 | if (command[ 'channelName' ]) { | 175 | if (command['channelName']) { |
176 | const res = await getVideoChannel(url, command['channelName']) | 176 | const res = await getVideoChannel(url, command['channelName']) |
177 | const videoChannel: VideoChannel = res.body | 177 | const videoChannel: VideoChannel = res.body |
178 | 178 | ||
@@ -188,9 +188,9 @@ async function buildVideoAttributesFromCommander (url: string, command: Command, | |||
188 | 188 | ||
189 | function getServerCredentials (program: any) { | 189 | function getServerCredentials (program: any) { |
190 | return Promise.all([ getSettings(), getNetrc() ]) | 190 | return Promise.all([ getSettings(), getNetrc() ]) |
191 | .then(([ settings, netrc ]) => { | 191 | .then(([ settings, netrc ]) => { |
192 | return getRemoteObjectOrDie(program, settings, netrc) | 192 | return getRemoteObjectOrDie(program, settings, netrc) |
193 | }) | 193 | }) |
194 | } | 194 | } |
195 | 195 | ||
196 | function getLogger (logLevel = 'info') { | 196 | function getLogger (logLevel = 'info') { |