diff --git a/CHANGELOG.md b/CHANGELOG.md index cd10dd40..e64cabe1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## ??? (Not Released Yet) +### New Features + +* XMPP clients: you can now allow connection to rooms using external XMPP accounts and XMPP clients. Please note that this feature might require some server configuration to be available. Please refer to the [documentation](https://johnxlivingston.github.io/peertube-plugin-livechat/documentation/admin/advanced/xmpp_clients/) for more informations. + ### Minor changes and fixes * Diagnostic tool: add the result of `prosodyctl check` in the debug section. diff --git a/client/admin-plugin-client-plugin.ts b/client/admin-plugin-client-plugin.ts index 6dcc4bde..9c5c2810 100644 --- a/client/admin-plugin-client-plugin.ts +++ b/client/admin-plugin-client-plugin.ts @@ -203,6 +203,9 @@ function register ({ registerHook, registerSettingsScript, peertubeHelpers }: Re switch (name) { case 'prosody-c2s-port': return options.formValues['prosody-c2s'] !== true + case 'prosody-s2s-port': + case 'prosody-s2s-interfaces': + return options.formValues['prosody-room-allow-s2s'] !== true case 'prosody-components-port': case 'prosody-components-list': return options.formValues['prosody-components'] !== true diff --git a/languages/settings/de.yml b/languages/settings/de.yml index 1a15e8d9..a5a95f22 100644 --- a/languages/settings/de.yml +++ b/languages/settings/de.yml @@ -140,6 +140,15 @@ prosody_muc_expiration_description: |
  • nie: Der Inhalt läuft nie ab und wird für immer aufbewahrt.
  • +prosody_room_allow_s2s_label: ~ +prosody_room_allow_s2s_description: ~ + +prosody_s2s_port_label: ~ +prosody_s2s_port_description: ~ + +prosody_s2s_interfaces_label: ~ +prosody_s2s_interfaces_description: ~ + prosody_c2s_label: "Aktivieren von Client-Server-Verbindungen" prosody_c2s_description: | Ermöglichen Sie XMPP-Clients die Verbindung zum integrierten Prosody-Server.
    diff --git a/languages/settings/en.yml b/languages/settings/en.yml index 4ce6cf0a..a6250d50 100644 --- a/languages/settings/en.yml +++ b/languages/settings/en.yml @@ -140,6 +140,36 @@ prosody_muc_expiration_description: |
  • never: the content will never expire, and will be kept forever.
  • +prosody_room_allow_s2s_label: "Enable connection to room using external XMPP accounts" +prosody_room_allow_s2s_description: | + By enabling this option, it will be possible to connect to rooms using external XMPP accounts and XMPP clients.
    + Warning, enabling this option can request extra server and DNS configuration. + Please refer to the documentation: + + Enable external XMPP account connections. + + +prosody_s2s_port_label: "Prosody server to server port" +prosody_s2s_port_description: | + The port that will be used for XMPP s2s (server to server) connections.
    + You should use the standard 5269 port. + Otherwise you should + setup a specific DNS record + . + +prosody_s2s_interfaces_label: "Server to server network interfaces" +prosody_s2s_interfaces_description: | + The network interfaces to listen on for server to server connections.
    + List of IP to listen on, coma separated (spaces will be stripped).
    + You can use «*» to listen on all IPv4 interfaces, and «::» for all IPv6.
    + Examples: + + prosody_c2s_label: "Enable client to server connections" prosody_c2s_description: | Enable XMPP clients to connect to the built-in Prosody server.
    diff --git a/languages/settings/fr.yml b/languages/settings/fr.yml index 25b1a516..672b3d6a 100644 --- a/languages/settings/fr.yml +++ b/languages/settings/fr.yml @@ -150,6 +150,36 @@ prosody_muc_expiration_description: |
  • never: le contenu ne sera jamais effacé.
  • +prosody_room_allow_s2s_label: "Autoriser les connexions aux salons via des comptes XMPP externes" +prosody_room_allow_s2s_description: | + En activant cette option, il sera possible de se connecter aux salons en utilisant des comptes XMPP externes via des clients XMPP.
    + Attention, activer cette option peut demander une configuration au niveau du serveur et des enregistrements DNS. + Pour en savoir plus, merci de vous référer à la documentation: + + Autoriser les connexions avec des comptes XMPP externes. + + +prosody_s2s_port_label: "Port Prosody serveur vers serveur" +prosody_s2s_port_description: | + Le port à utiliser pour les connexions XMPP s2s (server to server).
    + Il est recommandé d'utiliser le port standard 5269. + Sinon vous devrez + configurer un enregistrement DNS spécifique + . + +prosody_s2s_interfaces_label: "Interfaces réseau pour les connexions serveur vers serveur" +prosody_s2s_interfaces_description: | + Les interfaces réseau sur lequelles écouter pour les connexions s2s (server to server).
    + Une liste d'IP séparées par des virgules (les espaces seront retirés). + On pourra utiliser «*» pour écouter sur toutes les IPv4, et «::» pour toutes les IPv6.
    + Exemples de configuration possible: + + prosody_c2s_label: "Activer les connexions client vers serveur" prosody_c2s_description: | Autoriser les clients XMPP à se connecter au serveur Prosody.
    diff --git a/languages/settings/it.yml b/languages/settings/it.yml index 35558338..fb124c8e 100644 --- a/languages/settings/it.yml +++ b/languages/settings/it.yml @@ -134,6 +134,15 @@ prosody_muc_expiration_description: |
  • never: il contenuto non sarà mai cancellato.
  • +prosody_room_allow_s2s_label: ~ +prosody_room_allow_s2s_description: ~ + +prosody_s2s_port_label: ~ +prosody_s2s_port_description: ~ + +prosody_s2s_interfaces_label: ~ +prosody_s2s_interfaces_description: ~ + prosody_c2s_label: "Abilitare le connessioni dal client al server" prosody_c2s_description: | Consenti ai clienti XMPP a connettersi al server Prosody incorporato nel plugin.
    diff --git a/server/lib/prosody/config.ts b/server/lib/prosody/config.ts index e25a67ff..cdb03cc4 100644 --- a/server/lib/prosody/config.ts +++ b/server/lib/prosody/config.ts @@ -102,6 +102,9 @@ async function getProsodyConfig (options: RegisterServerOptionsV5): Promise s.trim()) + // Check that there is no invalid values (to avoid injections): + s2sInterfaces.forEach(networkInterface => { + if (networkInterface === '*') return + if (networkInterface === '::') return + if (networkInterface.match(/^\d+\.\d+\.\d+\.\d+$/)) return + if (networkInterface.match(/^[a-f0-9:]+$/)) return + throw new Error('Invalid s2s interfaces') + }) + config.useRoomS2S(s2sPort, s2sInterfaces) + } + const logExpiration = readLogExpiration(options, logExpirationSetting) config.useMam(logByDefault, logExpiration) // TODO: add a settings to choose? diff --git a/server/lib/prosody/config/content.ts b/server/lib/prosody/config/content.ts index 087e93a7..4014c72e 100644 --- a/server/lib/prosody/config/content.ts +++ b/server/lib/prosody/config/content.ts @@ -257,6 +257,12 @@ class ProsodyConfigContent { this.global.set('c2s_ports', [c2sPort]) } + useRoomS2S (s2sPort: string, s2sInterfaces: string[]): void { + this.global.set('s2s_ports', [s2sPort]) + this.global.set('s2s_interfaces', s2sInterfaces) + this.muc.add('modules_enabled', 's2s') + } + useExternalComponents (componentsPort: string, components: ExternalComponent[]): void { this.global.set('component_ports', [componentsPort]) this.global.set('component_interfaces', ['127.0.0.1', '::1']) diff --git a/server/lib/settings.ts b/server/lib/settings.ts index 0620be40..bbfb473f 100644 --- a/server/lib/settings.ts +++ b/server/lib/settings.ts @@ -302,6 +302,33 @@ Please read descriptionHTML: loc('prosody_muc_expiration_description') }) + registerSetting({ + name: 'prosody-room-allow-s2s', + label: loc('prosody_room_allow_s2s_label'), + type: 'input-checkbox', + default: false, + private: true, + descriptionHTML: loc('prosody_room_allow_s2s_description') + }) + + registerSetting({ + name: 'prosody-s2s-port', + label: loc('prosody_s2s_port_label'), + type: 'input', + default: '5269', + private: true, + descriptionHTML: loc('prosody_s2s_port_description') + }) + + registerSetting({ + name: 'prosody-s2s-interfaces', + label: loc('prosody_s2s_interfaces_label'), + type: 'input', + default: '*, ::', + private: true, + descriptionHTML: loc('prosody_s2s_interfaces_description') + }) + registerSetting({ name: 'prosody-c2s', label: loc('prosody_c2s_label'), diff --git a/support/documentation/content/documentation/admin/advanced/xmpp_clients.de.md b/support/documentation/content/documentation/admin/advanced/xmpp_clients.de.md new file mode 100644 index 00000000..70e0240d --- /dev/null +++ b/support/documentation/content/documentation/admin/advanced/xmpp_clients.de.md @@ -0,0 +1,10 @@ ++++ +title="Allow connection using XMPP clients" +description="Allow connections using external XMPP accounts and XMPP clients" +weight=30 +chapter=false ++++ + +{{% notice warning %}} +This page is not yet translated in your language, please refer to the english version. You can switch to it by using the language selector in the left menu. +{{% /notice %}} diff --git a/support/documentation/content/documentation/admin/advanced/xmpp_clients.en.md b/support/documentation/content/documentation/admin/advanced/xmpp_clients.en.md new file mode 100644 index 00000000..0b4b3785 --- /dev/null +++ b/support/documentation/content/documentation/admin/advanced/xmpp_clients.en.md @@ -0,0 +1,15 @@ ++++ +title="XMPP clients" +description="Allow connections using external XMPP accounts and XMPP clients" +weight=30 +chapter=false ++++ + +{{% notice warning %}} +This page is not written yet. It should explain how you can connect with XMPP clients. +{{% /notice %}} + +{{% notice tip %}} +For now you can't connect to your Peertube chat account using a XMPP client. +This feature could be added one day, depending on the interest about it. +{{% /notice %}} diff --git a/support/documentation/content/documentation/admin/advanced/xmpp_clients.fr.md b/support/documentation/content/documentation/admin/advanced/xmpp_clients.fr.md new file mode 100644 index 00000000..70e0240d --- /dev/null +++ b/support/documentation/content/documentation/admin/advanced/xmpp_clients.fr.md @@ -0,0 +1,10 @@ ++++ +title="Allow connection using XMPP clients" +description="Allow connections using external XMPP accounts and XMPP clients" +weight=30 +chapter=false ++++ + +{{% notice warning %}} +This page is not yet translated in your language, please refer to the english version. You can switch to it by using the language selector in the left menu. +{{% /notice %}} diff --git a/support/documentation/content/documentation/admin/advanced/xmpp_clients.ja.md b/support/documentation/content/documentation/admin/advanced/xmpp_clients.ja.md new file mode 100644 index 00000000..70e0240d --- /dev/null +++ b/support/documentation/content/documentation/admin/advanced/xmpp_clients.ja.md @@ -0,0 +1,10 @@ ++++ +title="Allow connection using XMPP clients" +description="Allow connections using external XMPP accounts and XMPP clients" +weight=30 +chapter=false ++++ + +{{% notice warning %}} +This page is not yet translated in your language, please refer to the english version. You can switch to it by using the language selector in the left menu. +{{% /notice %}} diff --git a/support/documentation/content/documentation/admin/settings.en.md b/support/documentation/content/documentation/admin/settings.en.md index b77eb627..749dfe90 100644 --- a/support/documentation/content/documentation/admin/settings.en.md +++ b/support/documentation/content/documentation/admin/settings.en.md @@ -135,6 +135,30 @@ by editing its properties. You can set here the expiration delay for room logs. See the online help for accepted values. +### Enable connection to room using external XMPP accounts + +By enabling this option, it will be possible to connect to rooms using external XMPP accounts and XMPP clients.
    +Warning, enabling this option can request extra server and DNS configuration. +Please refer to the documentation: [Enable external XMPP account connections](/peertube-plugin-livechat/documentation/admin/advanced/xmpp_clients/). + +### Prosody server to server port + +The port that will be used for XMPP s2s (server to server) connections.
    +You should use the standard 5269 port. +Otherwise you should [setup a specific DNS record](https://prosody.im/doc/s2s). + +### Server to server network interfaces + +The network interfaces to listen on for server to server connections.
    +List of IP to listen on, coma separated (spaces will be stripped).
    +You can use «*» to listen on all IPv4 interfaces, and «::» for all IPv6.
    +Examples: + +- `*, ::` +- `*` +- `127.0.0.1, ::1` +- `172.18.0.42` + ### Enable client to server connections This setting enable XMPP clients to connect to the built-in Prosody server.