Mercurial > prosody-modules
changeset 5897:896e7c7bf87f
Merge
author | Stephen Paul Weber <singpolyma@singpolyma.net> |
---|---|
date | Tue, 30 Apr 2024 15:07:06 -0500 |
parents | 5b95e06d75d5 (current diff) 095030677ae6 (diff) |
children | 7371320813a7 |
files | |
diffstat | 7 files changed, 95 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_csi_battery_saver/mod_csi_battery_saver.lua Tue Apr 30 15:06:03 2024 -0500 +++ b/mod_csi_battery_saver/mod_csi_battery_saver.lua Tue Apr 30 15:07:06 2024 -0500 @@ -85,6 +85,17 @@ end local function is_important(stanza, session) + -- some special handlings + if stanza == " " then -- whitespace keepalive + return true; + elseif type(stanza) == "string" then -- raw data + return true; + elseif not st.is_stanza(stanza) then -- this should probably never happen + return true; + end + if stanza.attr.xmlns ~= nil then -- nonzas (stream errors, stream management etc.) + return true; + end local st_name = stanza and stanza.name or nil; if not st_name then return true; end -- nonzas are always important if st_name == "presence" then @@ -104,8 +115,19 @@ local st_type = stanza.attr.type; - -- headline message are always not important - if st_type == "headline" then return false; end + -- errors are always important + if st_type == "error" then return true; end; + + -- headline message are always not important, with some exceptions + if st_type == "headline" then + -- allow headline pushes of mds updates (XEP-0490) + if stanza:find("{http://jabber.org/protocol/pubsub#event}event/items@node") == "urn:xmpp:mds:displayed:0" then return true; end; + return false + end + + -- mediated muc invites + if stanza:find("{http://jabber.org/protocol/muc#user}x/invite") then return true; end; + if stanza:get_child("x", "jabber:x:conference") then return true; end; -- chat markers (XEP-0333) are important, too, because some clients use them to update their notifications if stanza:child_with_ns("urn:xmpp:chat-markers:0") then return true; end;
--- 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
--- a/mod_http_admin_api/openapi.yaml Tue Apr 30 15:06:03 2024 -0500 +++ b/mod_http_admin_api/openapi.yaml Tue Apr 30 15:07:06 2024 -0500 @@ -545,6 +545,10 @@ type: string description: HTTPS URL of invite page (use in preference to XMPP URI when available) nullable: true + note: + type: string + nullable: true + description: Free-form text note/annotation to help identify the invitation created_at: type: integer description: Unix timestamp of invite creation @@ -557,6 +561,12 @@ items: type: string description: Group ID + roles: + type: array + description: Array of role names that accepting users will have (primary first) + items: + type: string + description: Role name source: type: string description: | @@ -586,6 +596,17 @@ items: type: string description: "Group ID" + roles: + type: array + nullable: true + description: "List of roles the new account should have (primary role first)" + items: + type: string + description: "Role name" + note: + type: string + nullable: true + description: Free-form text note/annotation to help identify the invitation NewGroupInvite: type: object properties: @@ -601,6 +622,17 @@ description: "IDs of existing group to add the new accounts to" group_options: $ref: '#/components/schemas/NewGroup' + roles: + type: array + nullable: true + description: "List of roles the new accounts should have (primary role first)" + items: + type: string + description: "Role name" + note: + type: string + nullable: true + description: Free-form text note/annotation to help identify the invitation NewResetInvite: type: object properties:
--- a/mod_muc_rtbl/mod_muc_rtbl.lua Tue Apr 30 15:06:03 2024 -0500 +++ b/mod_muc_rtbl/mod_muc_rtbl.lua Tue Apr 30 15:07:06 2024 -0500 @@ -164,7 +164,7 @@ module:log("debug", "Blocked private message from user <%s> from room <%s> due to RTBL match", occupant.bare_jid, event.stanza.attr.to); local error_reply = st.error_reply(event.stanza, "cancel", "forbidden", "You are banned from this service", event.room.jid); event.origin.send(error_reply); - return true; + return false; -- Don't route it end end);
--- a/mod_pubsub_serverinfo/mod_pubsub_serverinfo.lua Tue Apr 30 15:06:03 2024 -0500 +++ b/mod_pubsub_serverinfo/mod_pubsub_serverinfo.lua Tue Apr 30 15:07:06 2024 -0500 @@ -4,15 +4,22 @@ local new_id = require"util.id".medium; local local_domain = module:get_host(); -local service = module:get_option(module.name .. "_service") or "pubsub." .. local_domain; -local node = module:get_option(module.name .. "_node") or "serverinfo"; +local service = module:get_option_string(module.name .. "_service"); +local node = module:get_option_string(module.name .. "_node", "serverinfo"); local actor = module.host .. "/modules/" .. module.name; -local publication_interval = module:get_option(module.name .. "_publication_interval") or 300; -local cache_ttl = module:get_option(module.name .. "_cache_ttl") or 3600; +local publication_interval = module:get_option_number(module.name .. "_publication_interval", 300); +local cache_ttl = module:get_option_number(module.name .. "_cache_ttl", 3600); local public_providers_url = module:get_option_string(module.name.."_public_providers_url", "https://data.xmpp.net/providers/v2/providers-Ds.json"); local delete_node_on_unload = module:get_option_boolean(module.name.."_delete_node_on_unload", false); local persist_items = module:get_option_boolean(module.name.."_persist_items", true); +if not service and prosody.hosts["pubsub."..module.host] then + service = "pubsub."..module.host; +else + module:log_status("warn", "No pubsub service specified - module not activated"); + return; +end + local xmlns_pubsub = "http://jabber.org/protocol/pubsub"; function module.load()
--- a/mod_sasl2/mod_sasl2.lua Tue Apr 30 15:06:03 2024 -0500 +++ b/mod_sasl2/mod_sasl2.lua Tue Apr 30 15:07:06 2024 -0500 @@ -65,6 +65,8 @@ log("debug", "Channel binding 'tls-exporter' supported"); sasl_handler:add_cb_handler("tls-exporter", sasl_tls_exporter); channel_bindings:add("tls-exporter"); + else + log("debug", "Channel binding 'tls-exporter' not supported"); end elseif origin.conn.ssl_peerfinished and origin.conn:ssl_peerfinished() then log("debug", "Channel binding 'tls-unique' supported");
--- a/mod_sasl2_fast/mod_sasl2_fast.lua Tue Apr 30 15:06:03 2024 -0500 +++ b/mod_sasl2_fast/mod_sasl2_fast.lua Tue Apr 30 15:07:06 2024 -0500 @@ -196,6 +196,13 @@ if not authc_username then return "failure", "malformed-request"; end + if not sasl_handler.profile.cb then + module:log("warn", "Attempt to use channel binding %s with SASL profile that does not support any channel binding (FAST: %s)", cb_name, sasl_handler.fast); + return "failure", "malformed-request"; + elseif not sasl_handler.profile.cb[cb_name] then + module:log("warn", "SASL profile does not support %s channel binding (FAST: %s)", cb_name, sasl_handler.fast); + return "failure", "malformed-request"; + end local cb_data = cb_name and sasl_handler.profile.cb[cb_name](sasl_handler) or ""; local ok, authz_username, response, rotation_needed = backend( mechanism_name,