peertube-plugin-livechat/server/lib/routers/api/federation-server-infos.ts

26 lines
907 B
TypeScript
Raw Normal View History

import type { RegisterServerOptions } from '@peertube/peertube-types'
import type { Router, Request, Response, NextFunction } from 'express'
import { asyncMiddleware } from '../../middlewares/async'
import { serverBuildInfos } from '../../federation/outgoing'
/**
* Instanciate the authentication API.
* This API is used by the frontend to get current user's XMPP credentials.
* @param options server register options
*/
async function initFederationServerInfosApiRouter (options: RegisterServerOptions, router: Router): Promise<void> {
const logger = options.peertubeHelpers.logger
router.get('/federation_server_infos', asyncMiddleware(
async (req: Request, res: Response, _next: NextFunction) => {
logger.info('federation_server_infos api call')
const result = await serverBuildInfos(options)
res.json(result)
}
))
}
export {
initFederationServerInfosApiRouter
}