changeset 14096:48ea7a15957e 13.0

prosodyctl check features: Warn if http file sharing enabled on both host and component
author Matthew Wild <mwild1@gmail.com>
date Sun, 01 Mar 2026 22:50:50 +0000
parents 9bcd58e8e9f9
children 70b08435e47b 7fd6feb86dbe
files util/prosodyctl/check.lua
diffstat 1 files changed, 27 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/prosodyctl/check.lua	Thu Feb 26 15:09:16 2026 +0000
+++ b/util/prosodyctl/check.lua	Sun Mar 01 22:50:50 2026 +0000
@@ -1564,6 +1564,14 @@
 				print("");
 			end
 			if not feature.ok then
+				if feature.problems then
+					table.sort(feature.problems);
+					print("", "", "Problems found:");
+					for _, problem in ipairs(feature.problems) do
+						print("", "", ("  - %s"):format(problem));
+					end
+					print("");
+				end
 				if feature.lacking_modules then
 					table.sort(feature.lacking_modules);
 					print("", "", "Suggested modules: ");
@@ -1676,6 +1684,11 @@
 
 			local current_feature;
 
+			local function problem(message)
+				current_feature.problems = current_feature.problems or {};
+				table.insert(current_feature.problems, message);
+			end
+
 			local function check_module(suggested, alternate, ...)
 				if set.intersection(modules_enabled, set.new({suggested, alternate, ...})):empty() then
 					current_feature.lacking_modules = current_feature.lacking_modules or {};
@@ -1683,6 +1696,14 @@
 				end
 			end
 
+			local function soft_check_for_modules(...)
+				for _, mod in ipairs({...}) do
+					if modules_enabled:contains(mod) then
+						return mod;
+					end
+				end
+			end
+
 			local function check_component(suggested, alternate, ...)
 				local found;
 				for _, component_module in ipairs({ suggested, alternate, ... }) do
@@ -1792,6 +1813,8 @@
 					name = "File sharing";
 					desc = "Sharing of files to groups and offline users";
 					check = function (self)
+						local host_has_it = soft_check_for_modules("http_file_share", "http_upload", "http_upload_external");
+
 						local service = check_component("http_file_share", "http_upload", "http_upload_external");
 						if service then
 							local size_limit;
@@ -1803,6 +1826,9 @@
 									["Size limit"] = human_units.format(size_limit, "b", "b");
 								};
 							end
+							if host_has_it then
+								problem(("%s is present in modules_enabled, but you already have a component. Remove it from modules_enabled."):format(host_has_it));
+							end
 						end
 					end;
 				};
@@ -1823,6 +1849,7 @@
 				current_feature = feature;
 				feature:check();
 				feature.ok = (
+					not feature.problems and
 					not feature.lacking_modules and
 					not feature.lacking_components and
 					not feature.lacking_component_modules