Description of feature:
This feature would allow us to overwrite the default tag set by conversejs.
How this would work?
A user could supply a title tag in the conversejs_options table
conversejs_options = {
debug = true;
view_mode = "fullscreen";
title="Talk to our customer support team";
};
This tag can be picked up by the following line
https://hg.prosody.im/prosody-modules/file/4feab7e87675/mod_conversejs/mod_conversejs.lua#l107
For example something like this could work
```
-- I HAVE NOT TESTED THIS CODE
module:provides("http", {
local converse_options = get_converse_options();
local c_title = converse_options.title ;
-- We remove the title because we don't want it to be JSON encoded with the rest of the options
converse_options.title=nil;
if c_title~=nil and c_title ~="" then
title= c_title
else
title = "Converse.js";
end
route = {
GET = function (event)
event.response.headers.content_type = "text/html";
return html_template:format(js_template:format(json_encode(converse_options)));
end;
["GET /prosody-converse.js"] = function (event)
local converse_options = get_converse_options();
event.response.headers.content_type = "application/javascript";
return js_template:format(json_encode(converse_options));
end;
}
});
```
Motivation: (Why?)
The title is used to indicate what the current page is about. At the moment there is no way to overwrite the default set by mod_conversejs. So we are stuck.
Description of feature: This feature would allow us to overwrite the default tag set by conversejs. How this would work? A user could supply a title tag in the conversejs_options table conversejs_options = { debug = true; view_mode = "fullscreen"; title="Talk to our customer support team"; }; This tag can be picked up by the following line https://hg.prosody.im/prosody-modules/file/4feab7e87675/mod_conversejs/mod_conversejs.lua#l107 For example something like this could work ``` -- I HAVE NOT TESTED THIS CODE module:provides("http", { local converse_options = get_converse_options(); local c_title = converse_options.title ; -- We remove the title because we don't want it to be JSON encoded with the rest of the options converse_options.title=nil; if c_title~=nil and c_title ~="" then title= c_title else title = "Converse.js"; end route = { GET = function (event) event.response.headers.content_type = "text/html"; return html_template:format(js_template:format(json_encode(converse_options))); end; ["GET /prosody-converse.js"] = function (event) local converse_options = get_converse_options(); event.response.headers.content_type = "application/javascript"; return js_template:format(json_encode(converse_options)); end; } }); ``` Motivation: (Why?) The title is used to indicate what the current page is about. At the moment there is no way to overwrite the default set by mod_conversejs. So we are stuck.
Done in https://hg.prosody.im/prosody-modules/rev/42fa833169bb Commit before it also made the entire HTML template easier to modify or replace.
Changes