diff mod_conversejs/mod_conversejs.lua @ 2998:719b76ee0578

mod_conversejs: Offer the current domain if registration is enabled to skip the server selection and improve UX
author Kim Alvefur <zash@zash.se>
date Sat, 07 Apr 2018 01:41:01 +0200
parents ba6466fa6823
children 48cbf6a3f112
line wrap: on
line diff
--- a/mod_conversejs/mod_conversejs.lua	Thu Apr 05 19:08:46 2018 +0200
+++ b/mod_conversejs/mod_conversejs.lua	Sat Apr 07 01:41:01 2018 +0200
@@ -22,6 +22,7 @@
 module:provides("http", {
 	route = {
 		GET = function (event)
+			local allow_registration = module:get_option_boolean("allow_registration", false);
 			local converse_options = {
 				bosh_service_url = module:http_url("bosh","/http-bind");
 				websocket_url = has_ws and module:http_url("websocket","xmpp-websocket"):gsub("^http", "ws") or nil;
@@ -29,7 +30,8 @@
 				jid = module.host;
 				default_domain = module.host;
 				domain_placeholder = module.host;
-				allow_registration = module:get_option_boolean("allow_registration", false);
+				allow_registration = allow_registration;
+				registration_domain = allow_registration and module.host or nil;
 			};
 
 			local view_mode_css = "converse";