# HG changeset patch # User Matthew Wild # Date 1599828780 -3600 # Node ID de2390d6bbe46a48f32e4eaf7579427b1e3937f1 # Parent dd00a2b9927c65b26190bacdb93a2c575edd9c9a mod_http_libjs: Add compatibility with Prosody 0.11.x diff -r dd00a2b9927c -r de2390d6bbe4 mod_http_libjs/mod_http_libjs.lua --- a/mod_http_libjs/mod_http_libjs.lua Fri Sep 11 13:52:32 2020 +0100 +++ b/mod_http_libjs/mod_http_libjs.lua Fri Sep 11 13:53:00 2020 +0100 @@ -3,11 +3,19 @@ js = "application/javascript", }; +local serve; +if not pcall(function () + local http_files = require "net.http.files"; + serve = http_files.serve; +end) then + serve = module:depends"http_files".serve; +end + local libjs_path = module:get_option_string("libjs_path", "/usr/share/javascript"); module:provides("http", { default_path = "/share"; route = { - ["GET /*"] = require "net.http.files".serve({ path = libjs_path, mime_map = mime_map }); + ["GET /*"] = serve({ path = libjs_path, mime_map = mime_map }); } });