Changeset

4402:85c11eb4331b

mod_invites_page: Allow disabling of built-in pages with invites_page_external option
author Matthew Wild <mwild1@gmail.com>
date Wed, 27 Jan 2021 08:16:26 +0000
parents 4401:52e1ab99d25e
children 4403:31470a256851
files mod_invites_page/README.markdown mod_invites_page/mod_invites_page.lua
diffstat 2 files changed, 18 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mod_invites_page/README.markdown	Tue Jan 26 22:04:43 2021 +0100
+++ b/mod_invites_page/README.markdown	Wed Jan 27 08:16:26 2021 +0000
@@ -45,11 +45,12 @@
 Configuration
 =============
 
-| Name                      | Description                                                                    | Default                                                    |
-|---------------------------|--------------------------------------------------------------------------------|------------------------------------------------------------|
-| invites_page              | The format of an invite page URL (must begin with `https://`)                  | `"https://{host}:5281/invites_page?{invite.token}"`        |
-| invites_registration_page | The format of an invite registration page URL (may be relative to invites_page)| `"register?t={invite.token}&c={app.id}"`                   |
-| site_name                 | The friendly name of the server                                                | `"example.com"`                                            |
+| Name                      | Description                                                                    | Default                                             |
+|---------------------------|--------------------------------------------------------------------------------|-----------------------------------------------------|
+| invites_page              | The format of an invite page URL (must begin with `https://`)                  | `"https://{host}:5281/invites_page?{invite.token}"` |
+| invites_registration_page | The format of an invite registration page URL (may be relative to invites_page)| `"register?t={invite.token}&c={app.id}"`            |
+| site_name                 | The friendly name of the server                                                | `"example.com"`                                     |
+| invites_page_external     | Set this to true if your invitation pages will be rendered by something else   | `false`                                             |
 
 The `invites_page` and `invites_registration_page` options are templates
 that support a number of variables. The most useful being `{host}` and
@@ -60,3 +61,8 @@
 behind a reverse proxy such as nginx or Apache, you will probably want
 to set `http_external_url` so that Prosody knows what URLs should look
 like for users.
+
+If you want to disable this module's built-in pages and use an external
+invitation page generator (such as [ge0rg/easy-xmpp-invitation](https://github.com/ge0rg/easy-xmpp-invitation)
+then set `invites_page_external = true` and set `invites_page` to the
+appropriate URL for your installation.
--- a/mod_invites_page/mod_invites_page.lua	Tue Jan 26 22:04:43 2021 +0100
+++ b/mod_invites_page/mod_invites_page.lua	Wed Jan 27 08:16:26 2021 +0000
@@ -27,6 +27,9 @@
 local site_name = module:get_option_string("site_name", module.host);
 local site_apps = module:shared("register_apps/apps");
 
+-- Enable/disable built-in invite pages
+local external_only = module:get_option_boolean("invites_page_external", false);
+
 local http_files;
 
 if prosody.shutdown then
@@ -52,6 +55,10 @@
 
 module:hook("invite-created", add_landing_url);
 
+if external_only then
+	return;
+end
+
 local function render_app_urls(apps, invite_vars)
 	local rendered_apps = {};
 	for _, unrendered_app in ipairs(apps) do