]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server.ts
Merge branch 'release/3.3.0' into develop
[github/Chocobozzz/PeerTube.git] / server.ts
index 9376a08755e4546102a16dc7cfaf9ea786f61fa3..bfc7ee1450867bfdddf45d54f18ade4ff5f92fd8 100644 (file)
--- a/server.ts
+++ b/server.ts
@@ -14,7 +14,7 @@ import * as cookieParser from 'cookie-parser'
 import * as helmet from 'helmet'
 import * as useragent from 'useragent'
 import * as anonymize from 'ip-anonymize'
-import * as cli from 'commander'
+import { program as cli } from 'commander'
 
 process.title = 'peertube'
 
@@ -125,7 +125,7 @@ import { PeerTubeVersionCheckScheduler } from './server/lib/schedulers/peertube-
 import { Hooks } from './server/lib/plugins/hooks'
 import { PluginManager } from './server/lib/plugins/plugin-manager'
 import { LiveManager } from './server/lib/live'
-import { HttpStatusCode } from './shared/core-utils/miscs/http-error-codes'
+import { HttpStatusCode } from './shared/models/http/http-error-codes'
 import { VideosTorrentCache } from '@server/lib/files-cache/videos-torrent-cache'
 import { ServerConfigManager } from '@server/lib/server-config-manager'
 
@@ -164,7 +164,7 @@ morgan.token('user-agent', (req: express.Request) => {
 })
 app.use(morgan('combined', {
   stream: {
-    write: (str: string) => logger.info(str, { tags: [ 'http' ] })
+    write: (str: string) => logger.info(str.trim(), { tags: [ 'http' ] })
   },
   skip: req => CONFIG.LOG.LOG_PING_REQUESTS === false && req.originalUrl === '/api/v1/ping'
 }))
@@ -305,13 +305,19 @@ async function startApplication () {
   updateStreamingPlaylistsInfohashesIfNeeded()
     .catch(err => logger.error('Cannot update streaming playlist infohashes.', { err }))
 
-  if (cliOptions.plugins) await PluginManager.Instance.registerPluginsAndThemes()
-
   LiveManager.Instance.init()
   if (CONFIG.LIVE.ENABLED) LiveManager.Instance.run()
 
   // Make server listening
-  server.listen(port, hostname, () => {
+  server.listen(port, hostname, async () => {
+    if (cliOptions.plugins) {
+      try {
+        await PluginManager.Instance.registerPluginsAndThemes()
+      } catch (err) {
+        logger.error('Cannot register plugins and themes.', { err })
+      }
+    }
+
     logger.info('HTTP server listening on %s:%d', hostname, port)
     logger.info('Web server: %s', WEBSERVER.URL)