Live streaming implementation first step

This commit is contained in:
Chocobozzz
2020-11-09 15:33:04 +01:00
committed by Chocobozzz
parent 110d463fec
commit c6c0fa6cd8
80 changed files with 2752 additions and 1303 deletions
+12 -3
View File
@@ -98,10 +98,12 @@ import {
staticRouter,
lazyStaticRouter,
servicesRouter,
liveRouter,
pluginsRouter,
webfingerRouter,
trackerRouter,
createWebsocketTrackerServer, botsRouter
createWebsocketTrackerServer,
botsRouter
} from './server/controllers'
import { advertiseDoNotTrack } from './server/middlewares/dnt'
import { Redis } from './server/lib/redis'
@@ -119,6 +121,7 @@ import { updateStreamingPlaylistsInfohashesIfNeeded } from './server/lib/hls'
import { PluginsCheckScheduler } from './server/lib/schedulers/plugins-check-scheduler'
import { Hooks } from './server/lib/plugins/hooks'
import { PluginManager } from './server/lib/plugins/plugin-manager'
import { LiveManager } from '@server/lib/live-manager'
// ----------- Command line -----------
@@ -139,14 +142,14 @@ if (isTestInstance()) {
}
// For the logger
morgan.token<express.Request>('remote-addr', req => {
morgan.token('remote-addr', req => {
if (CONFIG.LOG.ANONYMIZE_IP === true || req.get('DNT') === '1') {
return anonymize(req.ip, 16, 16)
}
return req.ip
})
morgan.token<express.Request>('user-agent', req => {
morgan.token('user-agent', req => {
if (req.get('DNT') === '1') {
return useragent.parse(req.get('user-agent')).family
}
@@ -183,6 +186,9 @@ app.use(apiRoute, apiRouter)
// Services (oembed...)
app.use('/services', servicesRouter)
// Live streaming
app.use('/live', liveRouter)
// Plugins & themes
app.use('/', pluginsRouter)
@@ -271,6 +277,9 @@ async function startApplication () {
if (cli.plugins) await PluginManager.Instance.registerPluginsAndThemes()
LiveManager.Instance.init()
if (CONFIG.LIVE.ENABLED) LiveManager.Instance.run()
// Make server listening
server.listen(port, hostname, () => {
logger.info('Server listening on %s:%d', hostname, port)