403 status when video invalid.
This commit is contained in:
parent
ef05583fba
commit
b225148dfb
@ -37,7 +37,9 @@ async function initApiRouter (options: RegisterServerOptions): Promise<Router> {
|
|||||||
|
|
||||||
const video = await peertubeHelpers.videos.loadByIdOrUUID(jid)
|
const video = await peertubeHelpers.videos.loadByIdOrUUID(jid)
|
||||||
if (!video) {
|
if (!video) {
|
||||||
throw new Error('Video not found')
|
logger.warn(`Video ${jid} not found`)
|
||||||
|
res.sendStatus(403)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
// check settings (chat enabled for this video?)
|
// check settings (chat enabled for this video?)
|
||||||
const settings = await options.settingsManager.getSettings([
|
const settings = await options.settingsManager.getSettings([
|
||||||
@ -52,7 +54,9 @@ async function initApiRouter (options: RegisterServerOptions): Promise<Router> {
|
|||||||
'chat-all-non-lives': settings['chat-all-non-lives'] as boolean,
|
'chat-all-non-lives': settings['chat-all-non-lives'] as boolean,
|
||||||
'chat-videos-list': settings['chat-videos-list'] as string
|
'chat-videos-list': settings['chat-videos-list'] as string
|
||||||
}, video)) {
|
}, video)) {
|
||||||
throw new Error('Chat is not activated for this video')
|
logger.warn(`Video ${jid} has not chat activated`)
|
||||||
|
res.sendStatus(403)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: fill missing informations
|
// TODO: fill missing informations
|
||||||
|
Loading…
x
Reference in New Issue
Block a user