Skip to content

Commit

Permalink
Fix #481:
Browse files Browse the repository at this point in the history
* Moderation bot was not able to connect when remote chat was disabled.
* Some cleaning in code generating Prosody configuration file.
* Bump version 10.3.3
  • Loading branch information
JohnXLivingston committed Jul 25, 2024
1 parent db1993f commit e57d39c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 10.3.3

### Minor changes and fixes

* Fix #481: Moderation bot was not able to connect when remote chat was disabled.
* Some cleaning in code generating Prosody configuration file.

## 10.3.2

### Minor changes and fixes
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "peertube-plugin-livechat",
"description": "PeerTube plugin livechat: create chat rooms for your Peertube lives! Comes with many features: federation, moderation tools, chat bot, chat persistence, OBS integration, ...",
"version": "10.3.2",
"version": "10.3.3",
"license": "AGPL-3.0",
"author": {
"name": "John Livingston",
Expand Down
13 changes: 8 additions & 5 deletions server/lib/prosody/config/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,17 @@ abstract class ProsodyConfigBlock {
this.entries.set(name, value)
}

add (name: string, value: ConfigEntryValue): void {
add (name: string, value: ConfigEntryValue, allowDuplicate?: boolean): void {
if (!this.entries.has(name)) {
this.entries.set(name, [])
}
let entry = this.entries.get(name) as ConfigEntryValue
if (!Array.isArray(entry)) {
entry = [entry]
}
if (!allowDuplicate && entry.includes(value)) {
return
}
entry.push(value)
this.entries.set(name, entry)
}
Expand Down Expand Up @@ -239,7 +242,7 @@ class ProsodyConfigContent {
this.muc.set('muc_room_default_history_length', 20)

this.muc.add('modules_enabled', 'muc_slow_mode')
this.muc.add('slow_mode_duration_form_position', 120)
this.muc.set('slow_mode_duration_form_position', 120)

this.muc.add('modules_enabled', 'pubsub_peertubelivechat')
this.muc.add('modules_enabled', 'muc_peertubelivechat_roles')
Expand All @@ -251,7 +254,7 @@ class ProsodyConfigContent {
}

this.muc.add('modules_enabled', 'muc_moderation_delay')
this.muc.add('moderation_delay_form_position', 118)
this.muc.set('moderation_delay_form_position', 118)
}

useAnonymous (autoBanIP: boolean): void {
Expand Down Expand Up @@ -445,7 +448,7 @@ class ProsodyConfigContent {

useMucHttpDefault (url: string): void {
this.muc.add('modules_enabled', 'muc_http_defaults')
this.muc.add('muc_create_api_url', url)
this.muc.set('muc_create_api_url', url)

// restrict_room_creation: we can override the 'local' value.
// Indeed, when muc_http_default is used, room creation will be managed by api.
Expand Down Expand Up @@ -517,7 +520,7 @@ class ProsodyConfigContent {
*/
useBotsVirtualHost (botAvatarPath: string, botAvatarFiles: string[]): void {
this.bot = new ProsodyConfigVirtualHost('bot.' + this.prosodyDomain)
this.bot.set('modules_enabled', ['ping'])
this.bot.set('modules_enabled', ['ping', 'tls'])
this.bot.set('authentication', 'peertubelivechat_bot')

// For now, just using random_vcard_peertubelivechat to set bot avatar
Expand Down

0 comments on commit e57d39c

Please sign in to comment.