Mercurial > prosody-modules
diff mod_register_apps/mod_register_apps.lua @ 4113:c85af57e82e0
mod_register_apps: Add site_apps_show and site_apps_hide options (thanks meaz)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 12 Sep 2020 10:42:37 +0100 |
parents | ae2699f1cba9 |
children | 4656a64e59be |
line wrap: on
line diff
--- a/mod_register_apps/mod_register_apps.lua Sat Sep 12 10:28:28 2020 +0100 +++ b/mod_register_apps/mod_register_apps.lua Sat Sep 12 10:42:37 2020 +0100 @@ -100,6 +100,9 @@ }; }); +local show_apps = module:get_option_set("site_apps_show"); +local hide_apps = module:get_option_set("site_apps_hide"); + local base_url = module.http_url and module:http_url(); local function relurl(s) if s:match("^%w+://") then @@ -118,11 +121,14 @@ for _, app_info in ipairs(app_config) do local app_id = app_info.id or app_info.name:gsub("%W+", "-"):lower(); - app_info.id = app_id; - app_info.image = relurl(app_info.image); - site_apps[app_id] = app_info; - app_info._source = module.name; - table.insert(site_apps, app_info); + if (not show_apps or show_apps:contains(app_id)) + and not hide_apps:contains(app_id) then + app_info.id = app_id; + app_info.image = relurl(app_info.image); + site_apps[app_id] = app_info; + app_info._source = module.name; + table.insert(site_apps, app_info); + end end local mime_map = {