diff --git a/CHANGELOG.md b/CHANGELOG.md index 769cc853..119ddfdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,9 @@ ## v3.2.0 -... +### Features + +* Builtin Prosody: new settings to enable local C2S. For example, can be used with Matterbridge (thanks https://github.com/tytan652) ## v3.1.0 diff --git a/ROADMAP.md b/ROADMAP.md index 8820d081..68241fbb 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -36,3 +36,4 @@ This roadmap is given as an indication. It will be updated as we go along accord [ ] | Builtin Prosody | Add a settings to enable the server to be accessed with XMPP clients. [ ] | ConverseJS | For anonymous user, automatically log in with a random nickname (and allow to change afterward) [ ] | Common | There should be a settings to add terms & conditions in the Peertube's about page (for example if the webchat is hosted anywhere else). +[ ] | Builtin Prosody | Add on option to limit webchat to registered users. diff --git a/client/admin-plugin-client-plugin.ts b/client/admin-plugin-client-plugin.ts index 942fdffb..73787348 100644 --- a/client/admin-plugin-client-plugin.ts +++ b/client/admin-plugin-client-plugin.ts @@ -114,7 +114,14 @@ function register ({ registerHook, registerSettingsScript, peertubeHelpers }: Re case 'prosody-peertube-uri': case 'chat-type-help-builtin-prosody': case 'prosody-list-rooms': + case 'prosody-advanced': + case 'prosody-c2s': return options.formValues['chat-type'] !== ('builtin-prosody' as ChatType) + case 'prosody-c2s-port': + return !( + options.formValues['chat-type'] === ('builtin-prosody' as ChatType) && + options.formValues['prosody-c2s'] === true + ) case 'chat-server': case 'chat-room': case 'chat-bosh-uri': diff --git a/documentation/prosody.md b/documentation/prosody.md index b6433950..e7aaed4e 100644 --- a/documentation/prosody.md +++ b/documentation/prosody.md @@ -61,6 +61,21 @@ This is the port that the Prosody server will use. By default it is set to 52800 These settings are common with other chat modes. Here is the documentation: [common settings](./common.md). +### Prosody advanced settings + +#### Enable client to server connections + +This setting enable XMPP clients to connect to the builtin Prosody server. +For now, this option **only allows connections from localhost clients**. + +As example, this option can allow an instance of Matterbridge (once it could use anonymous login) *on the same machine* to bridge your chat with another services like a Matrix room. + +##### Prosody client to server port + +The port that will be used by the c2s module of the builtin Prosody server. +XMPP clients shall use this port to connect. +Change it if this port is already in use on your server. + ## Moderation You can list all existing chatrooms: in the plugin settings screen, there is a button «List rooms». diff --git a/server/lib/prosody/config.ts b/server/lib/prosody/config.ts index 85e3e7f0..1c077845 100644 --- a/server/lib/prosody/config.ts +++ b/server/lib/prosody/config.ts @@ -77,6 +77,7 @@ async function getProsodyConfig (options: RegisterServerOptions): PromiseProsody advanced settings' + }) + + registerSetting({ + name: 'prosody-c2s', + label: 'Enable client to server connections', + type: 'input-checkbox', + default: false, + private: true, + descriptionHTML: +`Enable XMPP clients to connect to the builtin Prosody server.
+This option alone only allows connections from localhost clients.` + }) + + registerSetting({ + name: 'prosody-c2s-port', + label: 'Prosody client to server port', + type: 'input', + default: '52822', + private: true, + descriptionHTML: +`The port that will be used by the c2s module of the builtin Prosody server.
+XMPP clients shall use this port to connect.
+Change it if this port is already in use on your server.
+Keep it close this port on your firewall for now, it will not be accessed from the outer world.` + }) + // ********** settings changes management settingsManager.onSettingsChange(async (settings: any) => { if ('chat-type' in settings) {