Slow mode (related to #385):

The slow mode duration on the channel option page is now a default value for new rooms. Streamers can change the value room per room in the room's configuration.
This commit is contained in:
John Livingston
2024-05-17 15:32:31 +02:00
parent da75765bdb
commit 4afc6ec4c6
5 changed files with 32 additions and 35 deletions

View File

@ -4,7 +4,6 @@ import { fillVideoCustomFields } from '../../custom-fields'
import { videoHasWebchat } from '../../../../shared/lib/video'
import { updateProsodyRoom } from '../../prosody/api/manage-rooms'
import { getChannelInfosById } from '../../database/channel'
import { getChannelConfigurationOptions, getDefaultChannelConfigurationOptions } from './storage'
/**
* Register stuffs related to channel configuration
@ -107,11 +106,8 @@ async function initChannelConfiguration (options: RegisterServerOptions): Promis
// FIXME: this piece of code should not be in this file (nothing to do with initChannelConfiguration,
// but will be more efficient to add here, as we already tested hasChat).
// Note: no need to await here, would only degrade performances.
const channelOptions = await getChannelConfigurationOptions(options, video.channelId) ??
getDefaultChannelConfigurationOptions(options)
updateProsodyRoom(options, video.uuid, {
name: video.name,
slow_mode_duration: channelOptions.slowMode.duration
name: video.name
}).then(
() => {},
(err) => logger.error(err)
@ -137,11 +133,8 @@ async function initChannelConfiguration (options: RegisterServerOptions): Promis
if (settings['prosody-room-type'] === 'channel') {
const jid = 'channel.' + channel.id.toString()
// Note: no need to await here, would only degrade performances.
const channelOptions = await getChannelConfigurationOptions(options, channel.id) ??
getDefaultChannelConfigurationOptions(options)
updateProsodyRoom(options, jid, {
name: channel.displayName,
slow_mode_duration: channelOptions.slowMode.duration
name: channel.displayName
}).then(
() => {},
(err) => logger.error(err)