diff mod_welcome_page/mod_welcome_page.lua @ 4975:733e5513f691

various: Use 0.12+ API for serving files from the file system over HTTP Using mod_http_files this way is deprecated. Having the base behavior in a separate module makes it easier to have a specialized module with coherent behavior that does not do things when not explicitly enabled.
author Kim Alvefur <zash@zash.se>
date Mon, 18 Jul 2022 13:58:27 +0200
parents ffb709728210
children 75b6e5df65f9
line wrap: on
line diff
--- a/mod_welcome_page/mod_welcome_page.lua	Mon Jul 11 20:08:41 2022 +0200
+++ b/mod_welcome_page/mod_welcome_page.lua	Mon Jul 18 13:58:27 2022 +0200
@@ -61,7 +61,14 @@
 	return 303;
 end
 
-local http_files = module:depends("http_files");
+local http_files
+if not pcall(function()
+	-- Prosody >= 0.12
+	http_files = require "net.http.files";
+end) then
+	-- Prosody <= 0.11
+	http_files = module:depends "http_files";
+end
 
 module:provides("http", {
 	default_path = "/";