aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/server-commands/server/server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'shared/server-commands/server/server.ts')
-rw-r--r--shared/server-commands/server/server.ts45
1 files changed, 31 insertions, 14 deletions
diff --git a/shared/server-commands/server/server.ts b/shared/server-commands/server/server.ts
index 2b4c9c9f8..7096faf21 100644
--- a/shared/server-commands/server/server.ts
+++ b/shared/server-commands/server/server.ts
@@ -13,7 +13,15 @@ import { AbusesCommand } from '../moderation'
13import { OverviewsCommand } from '../overviews' 13import { OverviewsCommand } from '../overviews'
14import { SearchCommand } from '../search' 14import { SearchCommand } from '../search'
15import { SocketIOCommand } from '../socket' 15import { SocketIOCommand } from '../socket'
16import { AccountsCommand, BlocklistCommand, LoginCommand, NotificationsCommand, SubscriptionsCommand, UsersCommand } from '../users' 16import {
17 AccountsCommand,
18 BlocklistCommand,
19 LoginCommand,
20 NotificationsCommand,
21 SubscriptionsCommand,
22 TwoFactorCommand,
23 UsersCommand
24} from '../users'
17import { 25import {
18 BlacklistCommand, 26 BlacklistCommand,
19 CaptionsCommand, 27 CaptionsCommand,
@@ -136,6 +144,7 @@ export class PeerTubeServer {
136 videos?: VideosCommand 144 videos?: VideosCommand
137 videoStats?: VideoStatsCommand 145 videoStats?: VideoStatsCommand
138 views?: ViewsCommand 146 views?: ViewsCommand
147 twoFactor?: TwoFactorCommand
139 148
140 constructor (options: { serverNumber: number } | { url: string }) { 149 constructor (options: { serverNumber: number } | { url: string }) {
141 if ((options as any).url) { 150 if ((options as any).url) {
@@ -182,6 +191,12 @@ export class PeerTubeServer {
182 this.port = parseInt(parsed.port) 191 this.port = parseInt(parsed.port)
183 } 192 }
184 193
194 getDirectoryPath (directoryName: string) {
195 const testDirectory = 'test' + this.internalServerNumber
196
197 return join(root(), testDirectory, directoryName)
198 }
199
185 async flushAndRun (configOverride?: Object, options: RunServerOptions = {}) { 200 async flushAndRun (configOverride?: Object, options: RunServerOptions = {}) {
186 await ServersCommand.flushTests(this.internalServerNumber) 201 await ServersCommand.flushTests(this.internalServerNumber)
187 202
@@ -341,19 +356,20 @@ export class PeerTubeServer {
341 suffix: '_test' + this.internalServerNumber 356 suffix: '_test' + this.internalServerNumber
342 }, 357 },
343 storage: { 358 storage: {
344 tmp: `test${this.internalServerNumber}/tmp/`, 359 tmp: this.getDirectoryPath('tmp') + '/',
345 bin: `test${this.internalServerNumber}/bin/`, 360 bin: this.getDirectoryPath('bin') + '/',
346 avatars: `test${this.internalServerNumber}/avatars/`, 361 avatars: this.getDirectoryPath('avatars') + '/',
347 videos: `test${this.internalServerNumber}/videos/`, 362 videos: this.getDirectoryPath('videos') + '/',
348 streaming_playlists: `test${this.internalServerNumber}/streaming-playlists/`, 363 streaming_playlists: this.getDirectoryPath('streaming-playlists') + '/',
349 redundancy: `test${this.internalServerNumber}/redundancy/`, 364 redundancy: this.getDirectoryPath('redundancy') + '/',
350 logs: `test${this.internalServerNumber}/logs/`, 365 logs: this.getDirectoryPath('logs') + '/',
351 previews: `test${this.internalServerNumber}/previews/`, 366 previews: this.getDirectoryPath('previews') + '/',
352 thumbnails: `test${this.internalServerNumber}/thumbnails/`, 367 thumbnails: this.getDirectoryPath('thumbnails') + '/',
353 torrents: `test${this.internalServerNumber}/torrents/`, 368 torrents: this.getDirectoryPath('torrents') + '/',
354 captions: `test${this.internalServerNumber}/captions/`, 369 captions: this.getDirectoryPath('captions') + '/',
355 cache: `test${this.internalServerNumber}/cache/`, 370 cache: this.getDirectoryPath('cache') + '/',
356 plugins: `test${this.internalServerNumber}/plugins/` 371 plugins: this.getDirectoryPath('plugins') + '/',
372 well_known: this.getDirectoryPath('well-known') + '/'
357 }, 373 },
358 admin: { 374 admin: {
359 email: `admin${this.internalServerNumber}@example.com` 375 email: `admin${this.internalServerNumber}@example.com`
@@ -410,5 +426,6 @@ export class PeerTubeServer {
410 this.videoStudio = new VideoStudioCommand(this) 426 this.videoStudio = new VideoStudioCommand(this)
411 this.videoStats = new VideoStatsCommand(this) 427 this.videoStats = new VideoStatsCommand(this)
412 this.views = new ViewsCommand(this) 428 this.views = new ViewsCommand(this)
429 this.twoFactor = new TwoFactorCommand(this)
413 } 430 }
414} 431}