Fix #48: Proper 404 and 403 pages when trying to open non-existant chatroom (WIP).

This commit is contained in:
John Livingston
2024-04-04 10:58:16 +02:00
parent 972306aa3e
commit 0719d25f35
12 changed files with 198 additions and 104 deletions

View File

@ -18,9 +18,17 @@ async function initConfigurationApiRouter (options: RegisterServerOptions, route
router.get('/configuration/room/:roomKey', asyncMiddleware(
async (req: Request, res: Response, _next: NextFunction): Promise<void> => {
const roomKey = req.params.roomKey
const initConverseJSParam = await getConverseJSParams(options, roomKey, {
forcetype: req.query.forcetype === '1'
})
const user = await options.peertubeHelpers.user.getAuthUser(res)
const initConverseJSParam = await getConverseJSParams(
options,
roomKey,
{
forcetype: req.query.forcetype === '1'
},
!!user
)
if (('isError' in initConverseJSParam) && initConverseJSParam.isError) {
res.sendStatus(initConverseJSParam.code)
return