aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils')
-rw-r--r--shared/extra-utils/server/config-command.ts12
-rw-r--r--shared/extra-utils/server/plugins-command.ts5
-rw-r--r--shared/extra-utils/server/server.ts12
-rw-r--r--shared/extra-utils/users/blocklist-command.ts25
-rw-r--r--shared/extra-utils/videos/videos.ts1
5 files changed, 48 insertions, 7 deletions
diff --git a/shared/extra-utils/server/config-command.ts b/shared/extra-utils/server/config-command.ts
index 7a768b4df..a061ca89e 100644
--- a/shared/extra-utils/server/config-command.ts
+++ b/shared/extra-utils/server/config-command.ts
@@ -194,6 +194,18 @@ export class ConfigCommand extends AbstractCommand {
194 whitelisted: true 194 whitelisted: true
195 } 195 }
196 }, 196 },
197 client: {
198 videos: {
199 miniature: {
200 preferAuthorDisplayName: false
201 }
202 },
203 menu: {
204 login: {
205 redirectOnSingleExternalAuth: false
206 }
207 }
208 },
197 cache: { 209 cache: {
198 previews: { 210 previews: {
199 size: 2 211 size: 2
diff --git a/shared/extra-utils/server/plugins-command.ts b/shared/extra-utils/server/plugins-command.ts
index b944475a2..9bf24afff 100644
--- a/shared/extra-utils/server/plugins-command.ts
+++ b/shared/extra-utils/server/plugins-command.ts
@@ -158,15 +158,16 @@ export class PluginsCommand extends AbstractCommand {
158 install (options: OverrideCommandOptions & { 158 install (options: OverrideCommandOptions & {
159 path?: string 159 path?: string
160 npmName?: string 160 npmName?: string
161 pluginVersion?: string
161 }) { 162 }) {
162 const { npmName, path } = options 163 const { npmName, path, pluginVersion } = options
163 const apiPath = '/api/v1/plugins/install' 164 const apiPath = '/api/v1/plugins/install'
164 165
165 return this.postBodyRequest({ 166 return this.postBodyRequest({
166 ...options, 167 ...options,
167 168
168 path: apiPath, 169 path: apiPath,
169 fields: { npmName, path }, 170 fields: { npmName, path, pluginVersion },
170 implicitToken: true, 171 implicitToken: true,
171 defaultExpectedStatus: HttpStatusCode.OK_200 172 defaultExpectedStatus: HttpStatusCode.OK_200
172 }) 173 })
diff --git a/shared/extra-utils/server/server.ts b/shared/extra-utils/server/server.ts
index 31224ebe9..9da293877 100644
--- a/shared/extra-utils/server/server.ts
+++ b/shared/extra-utils/server/server.ts
@@ -220,10 +220,11 @@ export class PeerTubeServer {
220 220
221 return new Promise<void>((res, rej) => { 221 return new Promise<void>((res, rej) => {
222 const self = this 222 const self = this
223 let aggregatedLogs = ''
223 224
224 this.app = fork(join(root(), 'dist', 'server.js'), options.peertubeArgs || [], forkOptions) 225 this.app = fork(join(root(), 'dist', 'server.js'), options.peertubeArgs || [], forkOptions)
225 226
226 const onPeerTubeExit = () => rej(new Error('Process exited')) 227 const onPeerTubeExit = () => rej(new Error('Process exited:\n' + aggregatedLogs))
227 const onParentExit = () => { 228 const onParentExit = () => {
228 if (!this.app || !this.app.pid) return 229 if (!this.app || !this.app.pid) return
229 230
@@ -238,10 +239,13 @@ export class PeerTubeServer {
238 this.app.stdout.on('data', function onStdout (data) { 239 this.app.stdout.on('data', function onStdout (data) {
239 let dontContinue = false 240 let dontContinue = false
240 241
242 const log: string = data.toString()
243 aggregatedLogs += log
244
241 // Capture things if we want to 245 // Capture things if we want to
242 for (const key of Object.keys(regexps)) { 246 for (const key of Object.keys(regexps)) {
243 const regexp = regexps[key] 247 const regexp = regexps[key]
244 const matches = data.toString().match(regexp) 248 const matches = log.match(regexp)
245 if (matches !== null) { 249 if (matches !== null) {
246 if (key === 'client_id') self.store.client.id = matches[1] 250 if (key === 'client_id') self.store.client.id = matches[1]
247 else if (key === 'client_secret') self.store.client.secret = matches[1] 251 else if (key === 'client_secret') self.store.client.secret = matches[1]
@@ -252,7 +256,7 @@ export class PeerTubeServer {
252 256
253 // Check if all required sentences are here 257 // Check if all required sentences are here
254 for (const key of Object.keys(serverRunString)) { 258 for (const key of Object.keys(serverRunString)) {
255 if (data.toString().indexOf(key) !== -1) serverRunString[key] = true 259 if (log.includes(key)) serverRunString[key] = true
256 if (serverRunString[key] === false) dontContinue = true 260 if (serverRunString[key] === false) dontContinue = true
257 } 261 }
258 262
@@ -260,7 +264,7 @@ export class PeerTubeServer {
260 if (dontContinue === true) return 264 if (dontContinue === true) return
261 265
262 if (options.hideLogs === false) { 266 if (options.hideLogs === false) {
263 console.log(data.toString()) 267 console.log(log)
264 } else { 268 } else {
265 process.removeListener('exit', onParentExit) 269 process.removeListener('exit', onParentExit)
266 self.app.stdout.removeListener('data', onStdout) 270 self.app.stdout.removeListener('data', onStdout)
diff --git a/shared/extra-utils/users/blocklist-command.ts b/shared/extra-utils/users/blocklist-command.ts
index 14491a1ae..2e7ed074d 100644
--- a/shared/extra-utils/users/blocklist-command.ts
+++ b/shared/extra-utils/users/blocklist-command.ts
@@ -1,6 +1,6 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import { AccountBlock, HttpStatusCode, ResultList, ServerBlock } from '@shared/models' 3import { AccountBlock, BlockStatus, HttpStatusCode, ResultList, ServerBlock } from '@shared/models'
4import { AbstractCommand, OverrideCommandOptions } from '../shared' 4import { AbstractCommand, OverrideCommandOptions } from '../shared'
5 5
6type ListBlocklistOptions = OverrideCommandOptions & { 6type ListBlocklistOptions = OverrideCommandOptions & {
@@ -37,6 +37,29 @@ export class BlocklistCommand extends AbstractCommand {
37 37
38 // --------------------------------------------------------------------------- 38 // ---------------------------------------------------------------------------
39 39
40 getStatus (options: OverrideCommandOptions & {
41 accounts?: string[]
42 hosts?: string[]
43 }) {
44 const { accounts, hosts } = options
45
46 const path = '/api/v1/blocklist/status'
47
48 return this.getRequestBody<BlockStatus>({
49 ...options,
50
51 path,
52 query: {
53 accounts,
54 hosts
55 },
56 implicitToken: false,
57 defaultExpectedStatus: HttpStatusCode.OK_200
58 })
59 }
60
61 // ---------------------------------------------------------------------------
62
40 addToMyBlocklist (options: OverrideCommandOptions & { 63 addToMyBlocklist (options: OverrideCommandOptions & {
41 account?: string 64 account?: string
42 server?: string 65 server?: string
diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts
index 4d2784dde..c05c2be6c 100644
--- a/shared/extra-utils/videos/videos.ts
+++ b/shared/extra-utils/videos/videos.ts
@@ -217,6 +217,7 @@ async function completeVideoCheck (
217 expect(torrent.files).to.be.an('array') 217 expect(torrent.files).to.be.an('array')
218 expect(torrent.files.length).to.equal(1) 218 expect(torrent.files.length).to.equal(1)
219 expect(torrent.files[0].path).to.exist.and.to.not.equal('') 219 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
220 expect(torrent.files[0].name).to.equal(`${videoDetails.name} ${file.resolution.id}p${extension}`)
220 } 221 }
221 222
222 expect(videoDetails.thumbnailPath).to.exist 223 expect(videoDetails.thumbnailPath).to.exist