Removing a hack:

* replacing loadByUrl by loadByIdOrUuid
* breaks compatibility with peertube 3.0.1
* simpler webchat route
* fix uuid escaping in iframe uri
This commit is contained in:
John Livingston
2021-04-30 17:39:27 +02:00
parent fbfd86aab0
commit 9dc0ce6383
5 changed files with 14 additions and 28 deletions

View File

@ -43,16 +43,10 @@ function register ({ registerHook, peertubeHelpers }: RegisterOptions): void {
let iframeUri = ''
if (settings['chat-use-prosody'] || settings['chat-use-builtin']) {
// Using the builtin converseJS
// FIXME: with Peertube 3.0.1 there is no loadByIdOrUUID method,
// we need to pass the complete url.
const video = videoCache[uuid]
if (video) {
const url: string = video.originInstanceUrl + '/videos/watch/' + uuid
iframeUri = getBaseRoute() + '/webchat?url=' + encodeURIComponent(url)
}
iframeUri = getBaseRoute() + '/webchat/room/' + encodeURIComponent(uuid)
} else if (!settings['chat-use-builtin']) {
iframeUri = settings['chat-uri'] || ''
iframeUri = iframeUri.replace(/{{VIDEO_UUID}}/g, uuid)
iframeUri = iframeUri.replace(/{{VIDEO_UUID}}/g, encodeURIComponent(uuid))
if (!/^https?:\/\//.test(iframeUri)) {
logger.error('The webchaturi must begin with https://')
return null