* 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
This commit is contained in:
John Livingston 2024-07-25 12:09:55 +02:00
parent db1993f97e
commit e57d39c8ab
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC
4 changed files with 18 additions and 8 deletions

View File

@ -1,5 +1,12 @@
# Changelog # 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 ## 10.3.2
### Minor changes and fixes ### Minor changes and fixes

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "peertube-plugin-livechat", "name": "peertube-plugin-livechat",
"version": "10.3.2", "version": "10.3.3",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "peertube-plugin-livechat", "name": "peertube-plugin-livechat",
"version": "10.3.2", "version": "10.3.3",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"dependencies": { "dependencies": {
"@xmpp/jid": "^0.13.1", "@xmpp/jid": "^0.13.1",

View File

@ -1,7 +1,7 @@
{ {
"name": "peertube-plugin-livechat", "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, ...", "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", "license": "AGPL-3.0",
"author": { "author": {
"name": "John Livingston", "name": "John Livingston",

View File

@ -93,7 +93,7 @@ abstract class ProsodyConfigBlock {
this.entries.set(name, value) this.entries.set(name, value)
} }
add (name: string, value: ConfigEntryValue): void { add (name: string, value: ConfigEntryValue, allowDuplicate?: boolean): void {
if (!this.entries.has(name)) { if (!this.entries.has(name)) {
this.entries.set(name, []) this.entries.set(name, [])
} }
@ -101,6 +101,9 @@ abstract class ProsodyConfigBlock {
if (!Array.isArray(entry)) { if (!Array.isArray(entry)) {
entry = [entry] entry = [entry]
} }
if (!allowDuplicate && entry.includes(value)) {
return
}
entry.push(value) entry.push(value)
this.entries.set(name, entry) this.entries.set(name, entry)
} }
@ -239,7 +242,7 @@ class ProsodyConfigContent {
this.muc.set('muc_room_default_history_length', 20) this.muc.set('muc_room_default_history_length', 20)
this.muc.add('modules_enabled', 'muc_slow_mode') 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', 'pubsub_peertubelivechat')
this.muc.add('modules_enabled', 'muc_peertubelivechat_roles') this.muc.add('modules_enabled', 'muc_peertubelivechat_roles')
@ -251,7 +254,7 @@ class ProsodyConfigContent {
} }
this.muc.add('modules_enabled', 'muc_moderation_delay') 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 { useAnonymous (autoBanIP: boolean): void {
@ -445,7 +448,7 @@ class ProsodyConfigContent {
useMucHttpDefault (url: string): void { useMucHttpDefault (url: string): void {
this.muc.add('modules_enabled', 'muc_http_defaults') 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. // restrict_room_creation: we can override the 'local' value.
// Indeed, when muc_http_default is used, room creation will be managed by api. // Indeed, when muc_http_default is used, room creation will be managed by api.
@ -517,7 +520,7 @@ class ProsodyConfigContent {
*/ */
useBotsVirtualHost (botAvatarPath: string, botAvatarFiles: string[]): void { useBotsVirtualHost (botAvatarPath: string, botAvatarFiles: string[]): void {
this.bot = new ProsodyConfigVirtualHost('bot.' + this.prosodyDomain) 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') this.bot.set('authentication', 'peertubelivechat_bot')
// For now, just using random_vcard_peertubelivechat to set bot avatar // For now, just using random_vcard_peertubelivechat to set bot avatar