Typescript v5 + eslint 8.57 WIP

This commit also improves some type handling in the project.
This commit is contained in:
John Livingston
2024-09-07 14:49:27 +02:00
parent 64a9c7be21
commit 7b3d93b290
41 changed files with 2652 additions and 3054 deletions

View File

@ -86,7 +86,7 @@ async function initRoomApiRouter (options: RegisterServerOptions, router: Router
// Now, we have two different room type: per video or per channel.
if (settings['prosody-room-type'] === 'channel') {
const matches = jid.match(/^channel\.(\d+)$/)
if (!matches || !matches[1]) {
if (!matches?.[1]) {
logger.warn(`Invalid channel room jid '${jid}'.`)
res.sendStatus(403)
return
@ -117,7 +117,7 @@ async function initRoomApiRouter (options: RegisterServerOptions, router: Router
},
await _getChannelSpecificOptions(options, channelId)
),
affiliations: affiliations
affiliations
}
RoomChannel.singleton().link(channelId, jid)
@ -172,7 +172,7 @@ async function initRoomApiRouter (options: RegisterServerOptions, router: Router
},
await _getChannelSpecificOptions(options, video.channelId)
),
affiliations: affiliations
affiliations
}
RoomChannel.singleton().link(video.channelId, jid)

View File

@ -147,7 +147,7 @@ async function initWebchatRouter (options: RegisterServerOptionsV5): Promise<Rou
const additionnalMessage: string = escapeHTML(err.livechatError?.message as string ?? '')
const message: string = escapeHTML(loc('chatroom_not_accessible'))
res.status(code)
res.status(typeof code === 'number' ? code : 500)
res.send(`<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN"><html>
<head><title>${message}</title></head>
<body>
@ -272,7 +272,7 @@ async function initWebchatRouter (options: RegisterServerOptionsV5): Promise<Rou
res.status(200)
const r: ProsodyListRoomsResult = {
ok: true,
rooms: rooms
rooms
}
res.json(r)
}