This commit is contained in:
John Livingston 2021-04-30 18:03:12 +02:00
parent 9c4cc64dcb
commit a25ef24237

View File

@ -23,17 +23,28 @@ async function initApiRouter (options: RegisterServerOptions): Promise<Router> {
const router = getRouter() const router = getRouter()
const logger = peertubeHelpers.logger const logger = peertubeHelpers.logger
router.get('/room', async (req: Request, res: Response, _next: NextFunction) => { router.get('/room', async (req: Request, res: Response, next: NextFunction) => {
const jid: string = req.query.jid as string || '' try {
logger.info(`Requesting room information for room '${jid}'.`) const jid: string = req.query.jid as string || ''
// TODO: check if room is legit and fill informations logger.info(`Requesting room information for room '${jid}'.`)
const roomDefaults: RoomDefaults = {
name: 'name_of_the_room', const video = await peertubeHelpers.videos.loadByIdOrUUID(jid)
description: 'room description', if (!video) {
public: false, throw new Error('Video not found')
subject: 'subject' }
// FIXME: check settings (chat enabled for this video)
// TODO: check if room is legit and fill informations
const roomDefaults: RoomDefaults = {
name: video.name,
description: '',
public: false,
subject: video.name
}
res.json(roomDefaults)
} catch (error) {
next(error)
} }
res.json(roomDefaults)
}) })
return router return router