2024-05-23 11:42:14 +02:00
|
|
|
// SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2022-01-11 01:29:33 +01:00
|
|
|
import type { RegisterServerOptions } from '@peertube/peertube-types'
|
2021-04-09 19:29:44 +02:00
|
|
|
import type { NextFunction, Request, Response } from 'express'
|
|
|
|
import { initWebchatRouter } from './webchat'
|
2021-04-09 21:28:16 +02:00
|
|
|
import { initSettingsRouter } from './settings'
|
2021-04-29 18:31:48 +02:00
|
|
|
import { initApiRouter } from './api'
|
2024-04-16 18:49:23 +02:00
|
|
|
import { initOIDCRouter } from './oidc'
|
2021-04-09 19:29:44 +02:00
|
|
|
|
2021-04-09 19:39:40 +02:00
|
|
|
async function initRouters (options: RegisterServerOptions): Promise<void> {
|
|
|
|
const { getRouter } = options
|
2021-04-09 19:29:44 +02:00
|
|
|
|
|
|
|
const router = getRouter()
|
|
|
|
router.get('/ping', (req: Request, res: Response, _next: NextFunction) => res.json({ message: 'pong' }))
|
|
|
|
|
2021-04-09 19:39:40 +02:00
|
|
|
router.use('/webchat', await initWebchatRouter(options))
|
2021-04-09 21:28:16 +02:00
|
|
|
router.use('/settings', await initSettingsRouter(options))
|
2021-04-29 18:31:48 +02:00
|
|
|
router.use('/api', await initApiRouter(options))
|
2024-04-16 18:49:23 +02:00
|
|
|
router.use('/oidc', await initOIDCRouter(options))
|
2021-04-09 19:29:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
initRouters
|
|
|
|
}
|