Fix #48: Proper 404 and 403 pages when trying to open non-existant chatroom.:
* error page on the old endpoint, when anonymous users are disabled.
This commit is contained in:
parent
0719d25f35
commit
33bc346e83
@ -113,7 +113,8 @@ async function initConverse (
|
|||||||
remoteRoomAnonymousParams(initConverseParams, auth, params)
|
remoteRoomAnonymousParams(initConverseParams, auth, params)
|
||||||
isRemoteWithNicknameSet = true
|
isRemoteWithNicknameSet = true
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Remote server does not allow remote connection')
|
console.error('Remote server does not allow remote connection')
|
||||||
|
params.jid = null
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!isRemoteChat) {
|
if (!isRemoteChat) {
|
||||||
@ -121,7 +122,21 @@ async function initConverse (
|
|||||||
} else if (remoteAnonymousXMPPServer) {
|
} else if (remoteAnonymousXMPPServer) {
|
||||||
remoteRoomAnonymousParams(initConverseParams, null, params)
|
remoteRoomAnonymousParams(initConverseParams, null, params)
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Remote server does not allow remote connection')
|
console.error('Remote server does not allow remote connection')
|
||||||
|
params.jid = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.jid === null) {
|
||||||
|
if (chatIncludeMode === 'chat-only') {
|
||||||
|
// Special use case: when mode=chat-only, and no params.jid: display an error page.
|
||||||
|
// Note: this can happen if anonymous users are not allowed on the server.
|
||||||
|
console.error('Seems that anonymous users are not allowed on the target server')
|
||||||
|
// FIXME: localize?
|
||||||
|
document.body.innerHTML = '<h1>This chatroom does not exist, or is not accessible to you.</h1>'
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
throw new Error('Can\'t connect, no JID')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ async function getConverseJSParams (
|
|||||||
staticBaseUrl,
|
staticBaseUrl,
|
||||||
assetsPath: staticBaseUrl + 'conversejs/',
|
assetsPath: staticBaseUrl + 'conversejs/',
|
||||||
isRemoteChat: !!(roomInfos.video?.remote),
|
isRemoteChat: !!(roomInfos.video?.remote),
|
||||||
localAnonymousJID: localAnonymousJID,
|
localAnonymousJID: !settings['chat-no-anonymous'] ? localAnonymousJID : null,
|
||||||
remoteAnonymousJID: remoteConnectionInfos?.anonymous?.userJID ?? null,
|
remoteAnonymousJID: remoteConnectionInfos?.anonymous?.userJID ?? null,
|
||||||
remoteAnonymousXMPPServer: !!(remoteConnectionInfos?.anonymous),
|
remoteAnonymousXMPPServer: !!(remoteConnectionInfos?.anonymous),
|
||||||
remoteAuthenticatedXMPPServer: !!(remoteConnectionInfos?.authenticated),
|
remoteAuthenticatedXMPPServer: !!(remoteConnectionInfos?.authenticated),
|
||||||
|
@ -2,7 +2,7 @@ type ConverseJSTheme = 'peertube' | 'default' | 'concord'
|
|||||||
|
|
||||||
interface InitConverseJSParams {
|
interface InitConverseJSParams {
|
||||||
isRemoteChat: boolean
|
isRemoteChat: boolean
|
||||||
localAnonymousJID: string
|
localAnonymousJID: string | null
|
||||||
remoteAnonymousJID: string | null
|
remoteAnonymousJID: string | null
|
||||||
remoteAnonymousXMPPServer: boolean
|
remoteAnonymousXMPPServer: boolean
|
||||||
remoteAuthenticatedXMPPServer: boolean
|
remoteAuthenticatedXMPPServer: boolean
|
||||||
|
Loading…
x
Reference in New Issue
Block a user