Comparison

mod_jsxc/mod_jsxc.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 6228:b74ec363de08
comparison
equal deleted inserted replaced
6262:a72388da5cd4 6263:10a1016d1c3a
17 if version ~= "" then version = "/" .. version end 17 if version ~= "" then version = "/" .. version end
18 18
19 local serve_dist = nil; 19 local serve_dist = nil;
20 local resources = module:get_option_path("jsxc_resources"); 20 local resources = module:get_option_path("jsxc_resources");
21 if resources then 21 if resources then
22 local serve; 22 local http_files = require "net.http.files";
23 if prosody.process_type == "prosody" then
24 -- Prosody >= trunk / 0.12
25 local http_files = require "net.http.files";
26 serve = http_files.serve;
27 else
28 -- Prosody <= 0.11
29 serve = module:depends "http_files".serve;
30 end
31 local mime_map = module:shared("/*/http_files/mime").types or { css = "text/css", js = "application/javascript" }; 23 local mime_map = module:shared("/*/http_files/mime").types or { css = "text/css", js = "application/javascript" };
32 serve_dist = serve({ path = resources, mime_map = mime_map }); 24 serve_dist = http_files.serve({ path = resources, mime_map = mime_map });
33 25
34 cdn_url = module:http_url(); 26 cdn_url = module:http_url();
35 end 27 end
36 28
37 local js_url = module:get_option_string("jsxc_script", cdn_url..version.."/dist/jsxc.bundle.js"); 29 local js_url = module:get_option_string("jsxc_script", cdn_url..version.."/dist/jsxc.bundle.js");