Software / code / prosody
Comparison
plugins/mod_admin_shell.lua @ 11850:bfa85965106e
mod_admin_shell: Show HTTP base-URLs in module:info()
Because it's nice, not having to find it in http:list(), which could
have a lot of items.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 13 Oct 2021 20:46:04 +0200 |
| parent | 11831:94cd363116a3 |
| child | 11885:197642f9972f |
comparison
equal
deleted
inserted
replaced
| 11849:7440d610e5f1 | 11850:bfa85965106e |
|---|---|
| 418 ["feature"] = tostring, | 418 ["feature"] = tostring, |
| 419 ["identity"] = function(ident) return ident.type .. "/" .. ident.category; end, | 419 ["identity"] = function(ident) return ident.type .. "/" .. ident.category; end, |
| 420 ["adhoc-provider"] = function(item) return item.name; end, | 420 ["adhoc-provider"] = function(item) return item.name; end, |
| 421 ["auth-provider"] = function(item) return item.name; end, | 421 ["auth-provider"] = function(item) return item.name; end, |
| 422 ["storage-provider"] = function(item) return item.name; end, | 422 ["storage-provider"] = function(item) return item.name; end, |
| 423 ["http-provider"] = function(item, mod) return mod:http_url(item.name); end, | |
| 423 }; | 424 }; |
| 424 | 425 |
| 425 for host in hosts do | 426 for host in hosts do |
| 426 local mod = modulemanager.get_module(host, name); | 427 local mod = modulemanager.get_module(host, name); |
| 427 if mod.module.host == "*" then | 428 if mod.module.host == "*" then |
| 439 local label = friendly_descriptions[kind] or kind:gsub("%-", " "):gsub("^%a", string.upper); | 440 local label = friendly_descriptions[kind] or kind:gsub("%-", " "):gsub("^%a", string.upper); |
| 440 print(string.format(" - %s (%d item%s)", label, #items, #items > 1 and "s" or "")); | 441 print(string.format(" - %s (%d item%s)", label, #items, #items > 1 and "s" or "")); |
| 441 local formatter = item_formatters[kind]; | 442 local formatter = item_formatters[kind]; |
| 442 if formatter then | 443 if formatter then |
| 443 for _, item in ipairs(items) do | 444 for _, item in ipairs(items) do |
| 444 print(" - " .. formatter(item)); | 445 print(" - " .. formatter(item, mod.module)); |
| 445 end | 446 end |
| 446 end | 447 end |
| 447 end | 448 end |
| 448 end | 449 end |
| 449 if mod.module.dependencies and next(mod.module.dependencies) ~= nil then | 450 if mod.module.dependencies and next(mod.module.dependencies) ~= nil then |