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