Comparison

mod_conversejs/mod_conversejs.lua @ 3331:d98341bca458

mod_conversejs: Allow overriding CDN URL, or script/css URLs independently
author Matthew Wild <mwild1@gmail.com>
date Thu, 27 Sep 2018 11:54:39 +0100
parent 3329:43d0e298ddda
child 3332:4fdd8b77da54
comparison
equal deleted inserted replaced
3330:426447d8f82e 3331:d98341bca458
8 8
9 local has_ws = pcall(function () 9 local has_ws = pcall(function ()
10 module:depends("websocket"); 10 module:depends("websocket");
11 end); 11 end);
12 12
13 local html_template = [[ 13 local cdn_url = module:get_option_string("conversejs_cdn", "https://cdn.conversejs.org");
14
15 local version = module:get_option_string("conversejs_version", "4.0.1");
16 local js_url = module:get_option_string("conversejs_script", cdn_url.."/"..version.."/dist/converse.min.js");
17 local css_url = module:get_option_string("conversejs_css", cdn_url.."/"..version.."/css/converse.min.css");
18
19 local html_template = ([[
14 <!DOCTYPE html> 20 <!DOCTYPE html>
15 <html> 21 <html>
16 <head> 22 <head>
17 <meta charset="utf-8"> 23 <meta charset="utf-8">
18 <link rel="stylesheet" type="text/css" media="screen" href="https://cdn.conversejs.org/4.0.1/css/converse.min.css"/> 24 <link rel="stylesheet" type="text/css" media="screen" href="$css_url"/>
19 <script charset="utf-8" src="https://cdn.conversejs.org/4.0.1/dist/converse.min.js"></script> 25 <script charset="utf-8" src="$js_url"></script>
20 <title>Prosody IM and Converse.js</title> 26 <title>Prosody IM and Converse.js</title>
21 </head> 27 </head>
22 <body> 28 <body>
23 <noscript> 29 <noscript>
24 <h1>Converse.js</h1> 30 <h1>Converse.js</h1>
40 <p><a href="https://xmpp.org/software/clients.html">More clients...</a></p> 46 <p><a href="https://xmpp.org/software/clients.html">More clients...</a></p>
41 </noscript> 47 </noscript>
42 <script>%s</script> 48 <script>%s</script>
43 </body> 49 </body>
44 </html> 50 </html>
45 ]] 51 ]]):gsub("$([%w_]+)", { js_url = js_url, css_url = css_url });
46 52
47 js_template = "converse.initialize(%s);"; 53 js_template = "converse.initialize(%s);";
48 54
49 local more_options = module:get_option("conversejs_options"); 55 local more_options = module:get_option("conversejs_options");
50 56