Mercurial > prosody-modules
diff mod_http_admin_api/mod_http_admin_api.lua @ 5897:896e7c7bf87f
Merge
| author | Stephen Paul Weber <singpolyma@singpolyma.net> |
|---|---|
| date | Tue, 30 Apr 2024 15:07:06 -0500 |
| parents | 095030677ae6 |
| children | 4b52d579bc70 |
line wrap: on
line diff
--- a/mod_http_admin_api/mod_http_admin_api.lua Tue Apr 30 15:06:03 2024 -0500 +++ b/mod_http_admin_api/mod_http_admin_api.lua Tue Apr 30 15:07:06 2024 -0500 @@ -80,7 +80,9 @@ local function token_info_to_invite_info(token_info) local additional_data = token_info.additional_data; local groups = additional_data and additional_data.groups or nil; + local roles = additional_data and additional_data.roles or nil; local source = additional_data and additional_data.source or nil; + local note = additional_data and additional_data.note or nil; local reset = not not (additional_data and additional_data.allow_reset or nil); return { id = token_info.token; @@ -93,8 +95,10 @@ created_at = token_info.created_at; expires = token_info.expires; groups = groups; + roles = roles; source = source; reset = reset; + note = note; }; end @@ -153,11 +157,15 @@ end invite = invites.create_group(options.groups, { source = source; + roles = options.roles; + note = options.note; }, options.ttl); elseif invite_type == "account" then invite = invites.create_account(options.username, { source = source; groups = options.groups; + roles = options.roles; + note = options.note; }, options.ttl); else return 400; @@ -763,9 +771,9 @@ result.c2s = maybe_export_summed_gauge(families["prosody_mod_c2s/connections"]) result.uploads = maybe_export_summed_gauge(families["prosody_mod_http_file_share/total_storage_bytes"]); result.users = { - active_1d = maybe_export_plain_gauge(families["prosody_mod_measure_active_users/active_users_1d"]); - active_7d = maybe_export_plain_gauge(families["prosody_mod_measure_active_users/active_users_7d"]); - active_30d = maybe_export_plain_gauge(families["prosody_mod_measure_active_users/active_users_30d"]); + active_1d = maybe_export_summed_gauge(families["prosody_mod_measure_active_users/active_users_1d"]); + active_7d = maybe_export_summed_gauge(families["prosody_mod_measure_active_users/active_users_7d"]); + active_30d = maybe_export_summed_gauge(families["prosody_mod_measure_active_users/active_users_30d"]); }; return json.encode(result); end @@ -795,9 +803,13 @@ if body.recipients == "online" then announce.send_to_online(message, host); elseif body.recipients == "all" then - for username in usermanager.users(host) do - message.attr.to = username .. "@" .. host - module:send(st.clone(message)) + if announce.send_to_all then + announce.send_to_all(message, host); + else -- COMPAT w/ 0.12 and trunk before e22609460975 + for username in usermanager.users(host) do + message.attr.to = username .. "@" .. host + module:send(st.clone(message)) + end end else for _, addr in ipairs(body.recipients) do
