Diff

mod_http_libjs/mod_http_libjs.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 6224:0bd1804baae7
line wrap: on
line diff
--- a/mod_http_libjs/mod_http_libjs.lua	Sun Jun 01 11:41:42 2025 +0700
+++ b/mod_http_libjs/mod_http_libjs.lua	Sun Jun 01 11:43:16 2025 +0700
@@ -1,16 +1,10 @@
+local http_files = require "net.http.files";
+
 local mime_map = module:shared("/*/http_files/mime").types or {
 	css = "text/css",
 	js = "application/javascript",
 };
 
-local serve;
-if prosody.process_type == "prosody" then
-	local http_files = require "net.http.files";
-	serve = http_files.serve;
-else
-	serve = module:depends"http_files".serve;
-end
-
 local libjs_path = module:get_option_string("libjs_path", "/usr/share/javascript");
 
 do -- sanity check
@@ -25,6 +19,6 @@
 module:provides("http", {
 		default_path = "/share";
 		route = {
-			["GET /*"] = serve({ path = libjs_path, mime_map = mime_map });
+			["GET /*"] = http_files.serve({ path = libjs_path, mime_map = mime_map });
 		}
 	});