Mercurial > prosody-modules
view mod_http_status/mod_http_status.lua @ 5611:06fad22672e1
mod_muc_moderation: Copy XEP-0421 occupant-id from retracted message
Lets clients correlate the sender of whatever was retracted by
moderators. Behavior limited to Prosody 0.12, otherwise there are no
assurances of the origin of the occupant-id tag.
Ref #1816
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 20 Jul 2023 10:37:27 +0200 |
parents | 6af2d74daa15 |
children | e274431bf4ce |
line wrap: on
line source
module:set_global(); local json = require "util.json"; local datetime = require "util.datetime".datetime; local modulemanager = require "core.modulemanager"; module:provides("http", { route = { GET = function(event) local request, response = event.request, event.response; response.headers.content_type = "application/json"; local resp = { ["*"] = true }; for host in pairs(prosody.hosts) do resp[host] = true; end for host in pairs(resp) do local hostmods = {}; local mods = modulemanager.get_modules(host); for mod_name, mod in pairs(mods) do hostmods[mod_name] = { type = mod.module.status_type; message = mod.module.status_message; time = datetime(math.floor(mod.module.status_time)); }; end resp[host] = hostmods; end return json.encode(resp); end; }; });