Room list: force channel or video room.
This commit is contained in:
parent
e9d1e55084
commit
3dcbba57e6
@ -130,7 +130,7 @@ function register ({ registerHook, registerSettingsScript, peertubeHelpers }: Re
|
||||
// Here we have a channel chat room
|
||||
// The backend should have added informations here
|
||||
// (because the Peertube API can't work with channelId...)
|
||||
const href = getBaseRoute() + '/webchat/room/' + encodeURIComponent(localpart)
|
||||
const href = getBaseRoute() + '/webchat/room/' + encodeURIComponent(localpart) + '?fromadmin=1'
|
||||
if (room.channel?.name) {
|
||||
aEl.href = href // here we know that the channel still exists, so we can open the webchat.
|
||||
const aVideoEl = document.createElement('a')
|
||||
@ -142,7 +142,7 @@ function register ({ registerHook, registerSettingsScript, peertubeHelpers }: Re
|
||||
} else if (/^[a-zA-A0-9-]+$/.test(localpart)) {
|
||||
// localpart must be a video uuid.
|
||||
const uuid = localpart
|
||||
const href = getBaseRoute() + '/webchat/room/' + encodeURIComponent(uuid)
|
||||
const href = getBaseRoute() + '/webchat/room/' + encodeURIComponent(uuid) + '?fromadmin=1'
|
||||
const p = fetch('/api/v1/videos/' + uuid, {
|
||||
method: 'GET',
|
||||
headers: peertubeHelpers.getAuthHeader()
|
||||
|
@ -52,12 +52,24 @@ async function initWebchatRouter (options: RegisterServerOptions): Promise<Route
|
||||
if (chatType === 'builtin-prosody') {
|
||||
const prosodyDomain = await getProsodyDomain(options)
|
||||
jid = 'anon.' + prosodyDomain
|
||||
if (settings['prosody-room-type'] === 'channel' || /^channel\.\d+$/.test(roomKey)) {
|
||||
// NB: roomKey=~channel.\d+ should normally only happen when user
|
||||
// comes from the room list in the plugin settings.
|
||||
room = 'channel.{{CHANNEL_ID}}@room.' + prosodyDomain
|
||||
if (req.query.fromadmin === '1') {
|
||||
// We come from the room list in the settings page.
|
||||
// Here we don't read the prosody-room-type settings,
|
||||
// but use the roomKey format.
|
||||
// NB: there is no extra security. Any user can add this parameter.
|
||||
// This is not an issue: the setting will be tested at the room creation.
|
||||
// No room can be created in the wrong mode.
|
||||
if (/^channel\.\d+$/.test(roomKey)) {
|
||||
room = 'channel.{{CHANNEL_ID}}@room.' + prosodyDomain
|
||||
} else {
|
||||
room = '{{VIDEO_UUID}}@room.' + prosodyDomain
|
||||
}
|
||||
} else {
|
||||
room = '{{VIDEO_UUID}}@room.' + prosodyDomain
|
||||
if (settings['prosody-room-type'] === 'channel') {
|
||||
room = 'channel.{{CHANNEL_ID}}@room.' + prosodyDomain
|
||||
} else {
|
||||
room = '{{VIDEO_UUID}}@room.' + prosodyDomain
|
||||
}
|
||||
}
|
||||
boshUri = getBaseRouterRoute(options) + 'webchat/http-bind'
|
||||
wsUri = ''
|
||||
|
Loading…
x
Reference in New Issue
Block a user