Software /
code /
prosody-modules
Changeset
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 | 3751:cb9517827d76 |
children | 3753:cf3247ec5e01 |
files | mod_http_index/README.markdown mod_http_index/mod_http_index.lua |
diffstat | 2 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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;