Software / code / prosody-modules
Comparison
mod_conversejs/mod_conversejs.lua @ 6263:10a1016d1c3a
Merge update
| author | Trần H. Trung <xmpp:trần.h.trung@trung.fun> |
|---|---|
| date | Sun, 01 Jun 2025 11:43:16 +0700 |
| parent | 6241:303fcfe3a7e8 |
| child | 6310:30adcea825c3 |
comparison
equal
deleted
inserted
replaced
| 6262:a72388da5cd4 | 6263:10a1016d1c3a |
|---|---|
| 26 if version ~= "" then version = "/" .. version end | 26 if version ~= "" then version = "/" .. version end |
| 27 | 27 |
| 28 local serve_dist = nil; | 28 local serve_dist = nil; |
| 29 local resources = module:get_option_path("conversejs_resources"); | 29 local resources = module:get_option_path("conversejs_resources"); |
| 30 if resources then | 30 if resources then |
| 31 local serve; | 31 local http_files = require "net.http.files"; |
| 32 if prosody.process_type == "prosody" then | |
| 33 -- Prosody >= trunk / 0.12 | |
| 34 local http_files = require "net.http.files"; | |
| 35 serve = http_files.serve; | |
| 36 else | |
| 37 -- Prosody <= 0.11 | |
| 38 serve = module:depends "http_files".serve; | |
| 39 end | |
| 40 local mime_map = module:shared("/*/http_files/mime").types or {css = "text/css"; js = "application/javascript"}; | 32 local mime_map = module:shared("/*/http_files/mime").types or {css = "text/css"; js = "application/javascript"}; |
| 41 serve_dist = serve({path = resources; mime_map = mime_map}); | 33 serve_dist = http_files.serve({path = resources; mime_map = mime_map}); |
| 42 | 34 |
| 43 cdn_url = module:http_url(); | 35 cdn_url = module:http_url(); |
| 44 end | 36 end |
| 45 | 37 |
| 46 local js_url = module:get_option_string("conversejs_script", cdn_url..version.."/dist/converse.min.js"); | 38 local js_url = module:get_option_string("conversejs_script", cdn_url..version.."/dist/converse.min.js"); |
| 116 return converse_options; | 108 return converse_options; |
| 117 end | 109 end |
| 118 | 110 |
| 119 local add_tags = module:get_option_array("conversejs_tags", {}); | 111 local add_tags = module:get_option_array("conversejs_tags", {}); |
| 120 | 112 |
| 121 local service_name = module:get_option_string("name", "Prosody IM and Converse.js"); | 113 local service_name = module:get_option_string("conversejs_name", module:get_option_string("name", "Prosody IM and Converse.js")); |
| 122 local service_short_name = module:get_option_string("short_name", "Converse"); | 114 local service_short_name = module:get_option_string("conversejs_short_name", "Converse"); |
| 123 local service_description = module:get_option_string("description", "Messaging Freedom") | 115 local service_description = module:get_option_string("conversejs_description", "Messaging Freedom") |
| 124 local pwa_color = module:get_option_string("pwa_color", "#397491") | 116 local pwa_color = module:get_option_string("conversejs_pwa_color", "#397491") |
| 125 | 117 |
| 126 module:provides("http", { | 118 module:provides("http", { |
| 127 title = "Converse.js"; | 119 title = "Converse.js"; |
| 128 route = { | 120 route = { |
| 129 ["GET /"] = function (event) | 121 ["GET /"] = function (event) |