# HG changeset patch # User Matthew Wild # Date 1599903757 -3600 # Node ID c85af57e82e084e7eb9a438830a92d231157dfce # Parent d0366474aace30fee577015f6a35811ca67a8150 mod_register_apps: Add site_apps_show and site_apps_hide options (thanks meaz) diff -r d0366474aace -r c85af57e82e0 mod_register_apps/README.markdown --- a/mod_register_apps/README.markdown Sat Sep 12 10:28:28 2020 +0100 +++ b/mod_register_apps/README.markdown Sat Sep 12 10:42:37 2020 +0100 @@ -16,7 +16,24 @@ # Configuration -There is one configuration option, `site_apps`, which contains the list +| Field | Description | +|----------------------|--------------------------------------------------------------------------| +| site_apps | A list of apps and their metadata | +| site_apps_show | A list of app ids to only show | +| site_apps_hide | A list of app ids to never show | + +An "app id" is the lower case app name, with any spaces replaced by `-`. E.g. "My Chat" would be `"my-chat"`. + +The module comes with a preconfigured `site_apps` containing popular clients. Patches are welcome to +add/update this list as needed! + +If you want to limit to just displaying a subset of the apps on your server, use the `site_apps_show` +option, e.g. `site_apps_show = { "conversations", "siskin-im" }`. To never show specific apps, you +can use `site_apps_hide`, e.g. `site_apps_hide = { "pidgin" }`. + +# App metadata format + +The configuration option `site_apps` contains the list of apps and their metadata. ``` {.lua} diff -r d0366474aace -r c85af57e82e0 mod_register_apps/mod_register_apps.lua --- 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 = {