diff mod_http_index/mod_http_index.lua @ 3752:8992f84ca870

mod_http_index: Only show http apps that include a title by default This lets http modules indicate whether they make sense to be user-facing or not.
author Kim Alvefur <zash@zash.se>
date Sun, 17 Nov 2019 16:33:28 +0100
parents f169d9a513c6
children ba4f45b8678f
line wrap: on
line diff
--- a/mod_http_index/mod_http_index.lua	Sun Nov 17 16:32:59 2019 +0100
+++ b/mod_http_index/mod_http_index.lua	Sun Nov 17 16:33:28 2019 +0100
@@ -3,6 +3,8 @@
 
 module:depends"http";
 
+local show_all = module:get_option_boolean(module.name .. "_show_all", true);
+
 local base_template;
 do
 	local template_file = module:get_option_string(module.name .. "_template", module.name .. ".html");
@@ -28,7 +30,7 @@
 	local host_items = module:get_host_items("http-provider");
 	local http_apps = {}
 	for _, item in ipairs(host_items) do
-		if module.name ~= item._provided_by then
+		if module.name ~= item._provided_by and (show_all or item.title) then
 			table.insert(http_apps, {
 				title = item.title or item.name;
 				name = item.name;