Mercurial > prosody-modules
changeset 4408:2c47b8110c48
mod_invites_page: Some fixes for external-only mode
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 27 Jan 2021 16:10:08 +0000 |
parents | 105586ca9a79 |
children | 44f6537f6427 |
files | mod_invites_page/mod_invites_page.lua |
diffstat | 1 files changed, 15 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_invites_page/mod_invites_page.lua Wed Jan 27 15:14:47 2021 +0000 +++ b/mod_invites_page/mod_invites_page.lua Wed Jan 27 16:10:08 2021 +0000 @@ -1,8 +1,7 @@ local st = require "util.stanza"; local url_escape = require "util.http".urlencode; -module:depends("http"); -local base_url = module.http_url and module:http_url(); +local base_url = "https://"..module.host.."/"; local render_html_template = require"util.interpolation".new("%b{}", st.xml_escape, { urlescape = url_escape; @@ -22,20 +21,28 @@ end; }); -module:depends("register_apps"); - local site_name = module:get_option_string("site_name", module.host); -local site_apps = module:shared("register_apps/apps"); +local site_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 - module:depends("http"); - http_files = module:depends("http_files"); +if not external_only then + -- Load HTTP-serving dependencies + if prosody.shutdown then -- not if running under prosodyctl + module:depends("http"); + http_files = module:depends("http_files"); + end + -- Calculate automatic base_url default + base_url = module.http_url and module:http_url(); + + -- Load site apps info + module:depends("register_apps"); + site_apps = module:shared("register_apps/apps"); end + local invites = module:depends("invites"); -- Point at eg https://github.com/ge0rg/easy-xmpp-invitation