Using mod_muc_mam:

* Starting with Peertube 3.2.0, builtin prosody save room history on server. So when a user connects, he can get previously send messages.
* Fix: settings archive_expires_after was useless without mod_mam
This commit is contained in:
John Livingston 2021-05-11 16:10:57 +02:00
parent 094193a3b1
commit a602c7870a
3 changed files with 22 additions and 3 deletions

View File

@ -5,6 +5,11 @@
### Features
* Builtin prosody use a working dir provided by Peertube (needs Peertube >= 3.2.0)
* Starting with Peertube 3.2.0, builtin prosody save room history on server. So when a user connects, he can get previously send messages.
### Fixes
* Builtin Prosody: settings archive_expires_after was useless without mod_mam
## v2.2.0

View File

@ -130,7 +130,10 @@ async function getProsodyConfig (options: RegisterServerOptions): Promise<Prosod
config.useHttpAuthentication(authApiUrl)
config.usePeertubeBosh(prosodyDomain, port)
config.useMucHttpDefault(roomApiUrl)
config.setArchive('1w') // Remove archived messages after 1 week
if (paths.permanent) {
// TODO: add a settings so that admin can choose? (on/off and duration)
config.useMam('1w') // Remove archived messages after 1 week
}
config.setLog(process.env.NODE_ENV === 'test' ? 'debug' : 'info')
const content = config.write()

View File

@ -209,8 +209,19 @@ class ProsodyConfigContent {
this.muc.set('restrict_room_creation', false)
}
setArchive (duration: string): void {
this.global.set('archive_expires_after', duration)
/**
* Calling this method makes Prosody use mod_muc_mam to store rooms history.
* Should not be used when using a temporary dir.
* @param duration: how long the server must store messages. See https://prosody.im/doc/modules/mod_muc_mam
*/
useMam (duration: string): void {
this.muc.add('modules_enabled', 'muc_mam')
this.muc.set('muc_log_by_default', true)
this.muc.set('muc_log_presences', true)
this.muc.set('log_all_rooms', true)
this.muc.set('muc_log_expires_after', duration)
this.muc.set('muc_log_cleanup_interval', 4 * 60 * 60)
}
setLog (level: ProsodyLogLevel, syslog?: ProsodyLogLevel[]): void {