aboutsummaryrefslogtreecommitdiffhomepage
path: root/server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server.ts')
-rw-r--r--server.ts15
1 files changed, 12 insertions, 3 deletions
diff --git a/server.ts b/server.ts
index e83fabb98..e2ff6327b 100644
--- a/server.ts
+++ b/server.ts
@@ -98,10 +98,12 @@ import {
98 staticRouter, 98 staticRouter,
99 lazyStaticRouter, 99 lazyStaticRouter,
100 servicesRouter, 100 servicesRouter,
101 liveRouter,
101 pluginsRouter, 102 pluginsRouter,
102 webfingerRouter, 103 webfingerRouter,
103 trackerRouter, 104 trackerRouter,
104 createWebsocketTrackerServer, botsRouter 105 createWebsocketTrackerServer,
106 botsRouter
105} from './server/controllers' 107} from './server/controllers'
106import { advertiseDoNotTrack } from './server/middlewares/dnt' 108import { advertiseDoNotTrack } from './server/middlewares/dnt'
107import { Redis } from './server/lib/redis' 109import { Redis } from './server/lib/redis'
@@ -119,6 +121,7 @@ import { updateStreamingPlaylistsInfohashesIfNeeded } from './server/lib/hls'
119import { PluginsCheckScheduler } from './server/lib/schedulers/plugins-check-scheduler' 121import { PluginsCheckScheduler } from './server/lib/schedulers/plugins-check-scheduler'
120import { Hooks } from './server/lib/plugins/hooks' 122import { Hooks } from './server/lib/plugins/hooks'
121import { PluginManager } from './server/lib/plugins/plugin-manager' 123import { PluginManager } from './server/lib/plugins/plugin-manager'
124import { LiveManager } from '@server/lib/live-manager'
122 125
123// ----------- Command line ----------- 126// ----------- Command line -----------
124 127
@@ -139,14 +142,14 @@ if (isTestInstance()) {
139} 142}
140 143
141// For the logger 144// For the logger
142morgan.token<express.Request>('remote-addr', req => { 145morgan.token('remote-addr', req => {
143 if (CONFIG.LOG.ANONYMIZE_IP === true || req.get('DNT') === '1') { 146 if (CONFIG.LOG.ANONYMIZE_IP === true || req.get('DNT') === '1') {
144 return anonymize(req.ip, 16, 16) 147 return anonymize(req.ip, 16, 16)
145 } 148 }
146 149
147 return req.ip 150 return req.ip
148}) 151})
149morgan.token<express.Request>('user-agent', req => { 152morgan.token('user-agent', req => {
150 if (req.get('DNT') === '1') { 153 if (req.get('DNT') === '1') {
151 return useragent.parse(req.get('user-agent')).family 154 return useragent.parse(req.get('user-agent')).family
152 } 155 }
@@ -183,6 +186,9 @@ app.use(apiRoute, apiRouter)
183// Services (oembed...) 186// Services (oembed...)
184app.use('/services', servicesRouter) 187app.use('/services', servicesRouter)
185 188
189// Live streaming
190app.use('/live', liveRouter)
191
186// Plugins & themes 192// Plugins & themes
187app.use('/', pluginsRouter) 193app.use('/', pluginsRouter)
188 194
@@ -271,6 +277,9 @@ async function startApplication () {
271 277
272 if (cli.plugins) await PluginManager.Instance.registerPluginsAndThemes() 278 if (cli.plugins) await PluginManager.Instance.registerPluginsAndThemes()
273 279
280 LiveManager.Instance.init()
281 if (CONFIG.LIVE.ENABLED) LiveManager.Instance.run()
282
274 // Make server listening 283 // Make server listening
275 server.listen(port, hostname, () => { 284 server.listen(port, hostname, () => {
276 logger.info('Server listening on %s:%d', hostname, port) 285 logger.info('Server listening on %s:%d', hostname, port)