X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=server.ts;h=b75c78b0764b506038a5abce15c18a25154c2062;hb=9b474844e85cce916370693cc24f53339a695570;hp=aa4382ee74f68329447fbb81d855b5cc7acbef6e;hpb=97567dd81f508dd6295ac4d73d849aa2ce0a6549;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server.ts b/server.ts index aa4382ee7..b75c78b07 100644 --- a/server.ts +++ b/server.ts @@ -1,4 +1,6 @@ // FIXME: https://github.com/nodejs/node/pull/16853 +import { PluginManager } from './server/lib/plugins/plugin-manager' + require('tls').DEFAULT_ECDH_CURVE = 'auto' import { isTestInstance } from './server/helpers/core-utils' @@ -27,9 +29,9 @@ const app = express() import { checkMissedConfig, checkFFmpeg } from './server/initializers/checker-before-init' // Do not use barrels because we don't want to load all modules here (we need to initialize database first) -import { logger } from './server/helpers/logger' -import { API_VERSION, FILES_CACHE, WEBSERVER, loadLanguages } from './server/initializers/constants' import { CONFIG } from './server/initializers/config' +import { API_VERSION, FILES_CACHE, WEBSERVER, loadLanguages } from './server/initializers/constants' +import { logger } from './server/helpers/logger' const missed = checkMissedConfig() if (missed.length !== 0) { @@ -94,6 +96,7 @@ import { feedsRouter, staticRouter, servicesRouter, + pluginsRouter, webfingerRouter, trackerRouter, createWebsocketTrackerServer, botsRouter @@ -110,11 +113,13 @@ import { RemoveOldHistoryScheduler } from './server/lib/schedulers/remove-old-hi import { isHTTPSignatureDigestValid } from './server/helpers/peertube-crypto' import { PeerTubeSocket } from './server/lib/peertube-socket' import { updateStreamingPlaylistsInfohashesIfNeeded } from './server/lib/hls' +import { PluginsCheckScheduler } from './server/lib/schedulers/plugins-check-scheduler' // ----------- Command line ----------- cli .option('--no-client', 'Start PeerTube without client interface') + .option('--no-plugins', 'Start PeerTube without plugins/themes enabled') .parse(process.argv) // ----------- App ----------- @@ -173,6 +178,9 @@ app.use(apiRoute, apiRouter) // Services (oembed...) app.use('/services', servicesRouter) +// Plugins & themes +app.use('/', pluginsRouter) + app.use('/', activityPubRouter) app.use('/', feedsRouter) app.use('/', webfingerRouter) @@ -244,6 +252,7 @@ async function startApplication () { VideosRedundancyScheduler.Instance.enable() RemoveOldHistoryScheduler.Instance.enable() RemoveOldViewsScheduler.Instance.enable() + PluginsCheckScheduler.Instance.enable() // Redis initialization Redis.Instance.init() @@ -253,10 +262,14 @@ async function startApplication () { updateStreamingPlaylistsInfohashesIfNeeded() .catch(err => logger.error('Cannot update streaming playlist infohashes.', { err })) + if (cli.plugins) await PluginManager.Instance.registerPluginsAndThemes() + // Make server listening server.listen(port, hostname, () => { logger.info('Server listening on %s:%d', hostname, port) logger.info('Web server: %s', WEBSERVER.URL) + + PluginManager.Instance.runHook('action:application.listening') }) process.on('exit', () => {