comparison mod_conversejs/mod_conversejs.lua @ 5211:079ca766193b

mod_conversejs: This one weird trick updates options on reload Options queried from the config in get_converse_options() would take effect immediately after Prosody reloads the config. Including 'conversejs_options' in this behaviour by simply moving a line seems worth it.
author Kim Alvefur <zash@zash.se>
date Thu, 23 Feb 2023 00:30:59 +0100
parents 75b6e5df65f9
children
comparison
equal deleted inserted replaced
5210:898575a0c6f3 5211:079ca766193b
77 js_template = render("console.log(\"mod_{module} could not read the JS template: %s\", {error|json})", 77 js_template = render("console.log(\"mod_{module} could not read the JS template: %s\", {error|json})",
78 { module = module.name, filename = template_filename, error = err }); 78 { module = module.name, filename = template_filename, error = err });
79 end 79 end
80 end 80 end
81 81
82 local user_options = module:get_option("conversejs_options"); 82 local function get_converse_options()
83 local user_options = module:get_option("conversejs_options");
83 84
84 local function get_converse_options()
85 local allow_registration = module:get_option_boolean("allow_registration", false); 85 local allow_registration = module:get_option_boolean("allow_registration", false);
86 local converse_options = { 86 local converse_options = {
87 -- Auto-detected connection endpoints 87 -- Auto-detected connection endpoints
88 bosh_service_url = has_bosh and module:http_url("bosh","/http-bind") or nil; 88 bosh_service_url = has_bosh and module:http_url("bosh","/http-bind") or nil;
89 websocket_url = has_ws and module:http_url("websocket","xmpp-websocket"):gsub("^http", "ws") or nil; 89 websocket_url = has_ws and module:http_url("websocket","xmpp-websocket"):gsub("^http", "ws") or nil;