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.
--- a/mod_http_index/README.markdown Sun Nov 17 16:32:59 2019 +0100
+++ b/mod_http_index/README.markdown Sun Nov 17 16:33:28 2019 +0100
@@ -22,6 +22,15 @@
# Advanced
+## Listing all items
+
+By default only HTTP apps that include a human-readable title are
+listed. This filtering can be disabled by setting:
+
+```lua
+http_index_list_all = true
+```
+
## Template
The template can be customized by copying the included `http_index.html`
--- 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;