equal
deleted
inserted
replaced
7 |
7 |
8 local has_ws = pcall(function () |
8 local has_ws = pcall(function () |
9 module:depends("websocket"); |
9 module:depends("websocket"); |
10 end); |
10 end); |
11 |
11 |
12 local template = [[ |
12 local html_template = [[ |
13 <!DOCTYPE html> |
13 <!DOCTYPE html> |
14 <html> |
14 <html> |
15 <head> |
15 <head> |
16 <meta charset="utf-8"> |
16 <meta charset="utf-8"> |
17 <link rel="stylesheet" type="text/css" media="screen" href="https://cdn.conversejs.org/4.0.0/css/converse.min.css"/> |
17 <link rel="stylesheet" type="text/css" media="screen" href="https://cdn.conversejs.org/4.0.0/css/converse.min.css"/> |
35 <li><a href="https://yaxim.org/">Yaxim</a></li> |
35 <li><a href="https://yaxim.org/">Yaxim</a></li> |
36 </ul></dd> |
36 </ul></dd> |
37 </dl> |
37 </dl> |
38 <p><a href="https://xmpp.org/software/clients.html">More clients...</a></p> |
38 <p><a href="https://xmpp.org/software/clients.html">More clients...</a></p> |
39 </noscript> |
39 </noscript> |
40 <script>converse.initialize(%s);</script> |
40 <script>%s</script> |
41 </body> |
41 </body> |
42 </html> |
42 </html> |
43 ]] |
43 ]] |
|
44 |
|
45 js_template = "converse.initialize(%s);"; |
44 |
46 |
45 local more_options = module:get_option("conversejs_options"); |
47 local more_options = module:get_option("conversejs_options"); |
46 |
48 |
47 module:provides("http", { |
49 module:provides("http", { |
48 route = { |
50 route = { |
64 converse_options[k] = v; |
66 converse_options[k] = v; |
65 end |
67 end |
66 end |
68 end |
67 |
69 |
68 event.response.headers.content_type = "text/html"; |
70 event.response.headers.content_type = "text/html"; |
69 return template:format(json_encode(converse_options)); |
71 return html_template:format(js_template:format(json_encode(converse_options))); |
70 end; |
72 end; |
71 } |
73 } |
72 }); |
74 }); |
73 |
75 |