]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/server-commands/server/server.ts
Display live info in my videos
[github/Chocobozzz/PeerTube.git] / shared / server-commands / server / server.ts
index 339b9cabb8a13abb14b63e0a89cd80f7e3de5b65..0ad818a11f9d19e711379a8571bb89f5974db510 100644 (file)
@@ -1,14 +1,14 @@
 import { ChildProcess, fork } from 'child_process'
 import { copy } from 'fs-extra'
 import { join } from 'path'
-import { root, randomInt } from '@shared/core-utils'
-import { Video, VideoChannel, VideoCreateResult, VideoDetails } from '../../models/videos'
+import { parallelTests, randomInt, root } from '@shared/core-utils'
+import { Video, VideoChannel, VideoCreateResult, VideoDetails } from '@shared/models'
 import { BulkCommand } from '../bulk'
 import { CLICommand } from '../cli'
 import { CustomPagesCommand } from '../custom-pages'
 import { FeedCommand } from '../feeds'
 import { LogsCommand } from '../logs'
-import { parallelTests, SQLCommand } from '../miscs'
+import { SQLCommand } from '../miscs'
 import { AbusesCommand } from '../moderation'
 import { OverviewsCommand } from '../overviews'
 import { SearchCommand } from '../search'
@@ -25,19 +25,22 @@ import {
   PlaylistsCommand,
   ServicesCommand,
   StreamingPlaylistsCommand,
-  VideosCommand
+  VideosCommand,
+  VideoStudioCommand,
+  ViewsCommand
 } from '../videos'
 import { CommentsCommand } from '../videos/comments-command'
+import { VideoStatsCommand } from '../videos/video-stats-command'
 import { ConfigCommand } from './config-command'
 import { ContactFormCommand } from './contact-form-command'
 import { DebugCommand } from './debug-command'
 import { FollowsCommand } from './follows-command'
 import { JobsCommand } from './jobs-command'
+import { ObjectStorageCommand } from './object-storage-command'
 import { PluginsCommand } from './plugins-command'
 import { RedundancyCommand } from './redundancy-command'
 import { ServersCommand } from './servers-command'
 import { StatsCommand } from './stats-command'
-import { ObjectStorageCommand } from './object-storage-command'
 
 export type RunServerOptions = {
   hideLogs?: boolean
@@ -124,7 +127,10 @@ export class PeerTubeServer {
   login?: LoginCommand
   users?: UsersCommand
   objectStorage?: ObjectStorageCommand
+  videoStudio?: VideoStudioCommand
   videos?: VideosCommand
+  videoStats?: VideoStatsCommand
+  views?: ViewsCommand
 
   constructor (options: { serverNumber: number } | { url: string }) {
     if ((options as any).url) {
@@ -210,18 +216,24 @@ export class PeerTubeServer {
       Object.assign(env, options.env)
     }
 
+    const execArgv = options.nodeArgs || []
+    // FIXME: too slow :/
+    // execArgv.push('--enable-source-maps')
+
     const forkOptions = {
       silent: true,
       env,
       detached: true,
-      execArgv: options.nodeArgs || []
+      execArgv
     }
 
+    const peertubeArgs = options.peertubeArgs || []
+
     return new Promise<void>((res, rej) => {
       const self = this
       let aggregatedLogs = ''
 
-      this.app = fork(join(root(), 'dist', 'server.js'), options.peertubeArgs || [], forkOptions)
+      this.app = fork(join(root(), 'dist', 'server.js'), peertubeArgs, forkOptions)
 
       const onPeerTubeExit = () => rej(new Error('Process exited:\n' + aggregatedLogs))
       const onParentExit = () => {
@@ -388,5 +400,8 @@ export class PeerTubeServer {
     this.users = new UsersCommand(this)
     this.videos = new VideosCommand(this)
     this.objectStorage = new ObjectStorageCommand(this)
+    this.videoStudio = new VideoStudioCommand(this)
+    this.videoStats = new VideoStatsCommand(this)
+    this.views = new ViewsCommand(this)
   }
 }