Changeset

6261:8c9eb4b6d02f draft default tip

Merge updates
author Trần H. Trung <xmpp:trần.h.trung@trung.fun>
date Sun, 18 May 2025 20:52:00 +0700
parents 6245:ea58d2893afb (current diff) 6260:b3489b046782 (diff)
children
files
diffstat 14 files changed, 114 insertions(+), 78 deletions(-) [+]
line wrap: on
line diff
--- a/mod_client_management/README.md	Tue Apr 29 23:27:06 2025 +0700
+++ b/mod_client_management/README.md	Sun May 18 20:52:00 2025 +0700
@@ -43,8 +43,8 @@
 
 ## Compatibility
 
-Requires Prosody trunk (as of 2023-03-29). Not compatible with Prosody 0.12
-and earlier.
+Requires Prosody 13.0.
+Not compatible with Prosody 0.12 and earlier.
 
 ## Developers
 
--- a/mod_client_management/mod_client_management.lua	Tue Apr 29 23:27:06 2025 +0700
+++ b/mod_client_management/mod_client_management.lua	Sun May 18 20:52:00 2025 +0700
@@ -430,18 +430,18 @@
 
 -- Command
 
-module:on_ready(function ()
-	local console_env = module:shared("/*/admin_shell/env");
-	if not console_env.user then return; end -- admin_shell probably not loaded
+module:add_item("shell-command", {
+	section = "user";
+	name = "clients";
+	desc = "List a user's clients";
+	args = {
+		{ name = "jid"; type = "string" }
+	};
+	host_selector = "jid";
+	handler = function(self, user_jid)
+		local username = jid.split(user_jid);
 
-	function console_env.user:clients(user_jid)
-		local username, host = jid.split(user_jid);
-		local mod = prosody.hosts[host] and prosody.hosts[host].modules.client_management;
-		if not mod then
-			return false, ("Host does not exist on this server, or does not have mod_client_management loaded");
-		end
-
-		local clients = mod.get_active_clients(username);
+		local clients = get_active_clients(username);
 		if not clients or #clients == 0 then
 			return true, "No clients associated with this account";
 		end
@@ -516,18 +516,24 @@
 		print(string.rep("-", self.session.width));
 		return true, ("%d clients"):format(#clients);
 	end
+});
 
-	function console_env.user:revoke_client(user_jid, selector) -- luacheck: ignore 212/self
-		local username, host = jid.split(user_jid);
-		local mod = prosody.hosts[host] and prosody.hosts[host].modules.client_management;
-		if not mod then
-			return false, ("Host does not exist on this server, or does not have mod_client_management loaded");
-		end
+module:add_item("shell-command", {
+	section = "user";
+	name = "revoke_client";
+	desc = "Revoke access from a user's client";
+	args = {
+		{ name = "jid"; type = "string" };
+		{ name = "selector"; type = "string" };
+	};
+	host_selector = "jid";
+	handler = function(self, user_jid, selector) -- luacheck: ignore 212/self
+		local username = jid.split(user_jid);
 
-		local revoked, err = revocation_errors.coerce(mod.revoke_client_access(username, selector));
+		local revoked, err = revocation_errors.coerce(revoke_client_access(username, selector));
 		if not revoked then
 			return false, err.text or err;
 		end
 		return true, "Client access revoked";
 	end
-end);
+});
--- a/mod_dnsupdate/mod_dnsupdate.lua	Tue Apr 29 23:27:06 2025 +0700
+++ b/mod_dnsupdate/mod_dnsupdate.lua	Sun May 18 20:52:00 2025 +0700
@@ -1,6 +1,7 @@
 module:set_global();
 
 local config = require "core.configmanager";
+local modulemanager = require "core.modulemanager";
 local argparse = require "util.argparse";
 local dns = require"net.adns".resolver();
 local async = require "util.async";
@@ -8,8 +9,7 @@
 local nameprep = require"util.encodings".stringprep.nameprep;
 local idna_to_ascii = require"util.encodings".idna.to_ascii;
 
-local virtualhost_services = { "xmpp-client"; "xmpps-client"; "xmpp-server"; "xmpps-server" }
-local component_services = { "xmpp-server"; "xmpps-server" }
+local services = { "xmpp-client"; "xmpps-client"; "xmpp-server"; "xmpps-server" }
 
 local function validate_dnsname_option(options, option_name, default)
 	local host = options[option_name];
@@ -56,15 +56,11 @@
 		module:log("error", "Host %q fails IDNA", vhost);
 		return 1;
 	end
-	local is_component = config.get(vhost, "component_module");
-	if not is_component and not config.get(vhost, "defined") then
+	if not config.get(vhost, "component_module") and not config.get(vhost, "defined") then
 		module:log("error", "Host %q is not defined in the config", vhost);
 		return 1;
 	end
 
-	local services = virtualhost_services;
-	if is_component then services = component_services; end
-
 	local domain = validate_dnsname_option(opts, "domain");
 	if not domain then
 		module:log("error", "--domain is required");
@@ -86,7 +82,17 @@
 		["xmpps-server"] = module:get_option_array("s2s_direct_tls_ports", {});
 	};
 
-	if opts.multiplex then
+	local modules_enabled = modulemanager.get_modules_for_host(vhost);
+	if not modules_enabled:contains("c2s") then
+		configured_ports["xmpp-client"] = {};
+		configured_ports["xmpps-client"] = {};
+	end
+	if not modules_enabled:contains("s2s") then
+		configured_ports["xmpp-server"] = {};
+		configured_ports["xmpps-server"] = {};
+	end
+
+	if modules_enabled:contains("net_multiplex") then
 		for opt, ports in pairs(configured_ports) do
 			ports:append(module:get_option_array(opt:sub(1, 5) == "xmpps" and "ssl_ports" or "ports", {}));
 		end
@@ -102,26 +108,31 @@
 	print("ttl " .. tostring(opts.ttl or 60 * 60));
 
 	for _, service in ipairs(services) do
-		local ports = set.new(configured_ports[service]);
-		local records = (async.wait_for(existing_srv[service]));
-		if opts.remove or opts.reset then
+		local config_ports = set.new(configured_ports[service]);
+		local dns_ports = set.new();
+
+		if (opts.reset or opts.remove) and not opts.each then
 			print(("del _%s._tcp.%s IN SRV"):format(service, ihost));
 		else
+			local records = (async.wait_for(existing_srv[service]));
 			for _, rr in ipairs(records) do
-				if ports:contains(rr.srv.port) and target == nameprep(rr.srv.target):gsub("%.$", "") then
-					ports:remove(rr.srv.port)
-				elseif not opts.each then
-					print(("del _%s._tcp.%s IN SRV"):format(service, ihost));
-					break
-				else
+				if target == nameprep(rr.srv.target):gsub("%.$", "") then
+					dns_ports:add(rr.srv.port)
+				elseif opts.each then
 					print(("del _%s._tcp.%s IN SRV %s"):format(service, ihost, rr));
 				end
 			end
 		end
+
 		if not opts.remove then
-			for port in ports do print(("add _%s._tcp.%s IN SRV 1 1 %d %s"):format(service, ihost, port, target)); end
+			if config_ports:empty() then
+				print(("add _%s._tcp.%s IN SRV 0 0 0 ."):format(service, ihost));
+			else
+				for port in (config_ports - dns_ports) do
+					print(("add _%s._tcp.%s IN SRV 1 1 %d %s"):format(service, ihost, port, target));
+				end
+			end
 		end
-		if ports:empty() then print(("add _%s._tcp.%s IN SRV 0 0 0 ."):format(service, ihost)); end
 	end
 
 	print("show");
--- a/mod_limits_exception/README.md	Tue Apr 29 23:27:06 2025 +0700
+++ b/mod_limits_exception/README.md	Sun May 18 20:52:00 2025 +0700
@@ -1,6 +1,8 @@
 ---
+labels:
+- Stage-Obsolete
 summary: Allow specified JIDs to bypass rate limits
-...
+---
 
 This module allows you to configure a list of JIDs that should be allowed to
 bypass rate limit restrictions.
--- a/mod_muc_anonymize_moderation_actions/README.md	Tue Apr 29 23:27:06 2025 +0700
+++ b/mod_muc_anonymize_moderation_actions/README.md	Sun May 18 20:52:00 2025 +0700
@@ -1,8 +1,10 @@
-<!--
-SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
-SPDX-License-Identifier: AGPL-3.0-only
--->
-# mod_muc_anonymize_moderation_actions
+---
+labels:
+- 'Stage-Alpha'
+summary: Anonymize moderator actions for participants
+---
+
+## Introduction
 
 This modules allows to anonymize affiliation and role changes in MUC rooms.
 
@@ -11,13 +13,10 @@
 
 This is particularly usefull to prevent some revenge when a moderator bans someone.
 
-This module is under AGPL-3.0 license.
-
-It was tested on Prosody 0.12.x.
 
 ## Configuration
 
-Just enable the module on your MUC VirtualHost.
+Just enable the module on your MUC Component.
 The feature will be accessible throught the room configuration form.
 
 You can tweak the position of the settings in the MUC configuration form using `anonymize_moderation_actions_form_position`.
@@ -26,7 +25,20 @@
 By default, the field will be between muc#roomconfig_changesubject and muc#roomconfig_moderatedroom (default value is `78`).
 
 ``` lua
-VirtualHost "muc.example.com"
+Component "muc.example.com" "muc"
   modules_enabled = { "muc_anonymize_moderation_actions" }
   anonymize_moderation_actions_form_position = 96
 ```
+
+## Compatibility
+
+  ------ ----------------------
+  trunk  Works as of 25-05-12
+  13     Works
+  0.12   Works
+  ------ ----------------------
+
+### License
+
+SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
+SPDX-License-Identifier: AGPL-3.0-only
--- a/mod_net_proxy/mod_net_proxy.lua	Tue Apr 29 23:27:06 2025 +0700
+++ b/mod_net_proxy/mod_net_proxy.lua	Sun May 18 20:52:00 2025 +0700
@@ -14,6 +14,7 @@
 local net = require "util.net";
 local set = require "util.set";
 local portmanager = require "core.portmanager";
+local fmt = require "util.format".format;
 
 -- Backwards Compatibility
 local function net_ntop_bc(input)
@@ -81,7 +82,7 @@
 local proxy_data_mt = {}; proxy_data_mt.__index = proxy_data_mt;
 
 function proxy_data_mt:describe()
-	return string.format("proto=%s/%s src=%s:%d dst=%s:%d",
+	return fmt("proto=%s/%s src=%s:%d dst=%s:%d",
 		self:addr_family_str(), self:transport_str(), self:src_addr(), self:src_port(), self:dst_addr(), self:dst_port());
 end
 
--- a/mod_sasl2/README.md	Tue Apr 29 23:27:06 2025 +0700
+++ b/mod_sasl2/README.md	Sun May 18 20:52:00 2025 +0700
@@ -31,6 +31,7 @@
 
      Prosody Version           Status
   -----------------------  ----------------
-  trunk as of 2024-11-24   Works
+  trunk as of 2025-05-25   Works
+  13                       Works
   0.12                     Does not work
   -----------------------  ----------------
--- a/mod_sasl2_bind2/README.md	Tue Apr 29 23:27:06 2025 +0700
+++ b/mod_sasl2_bind2/README.md	Sun May 18 20:52:00 2025 +0700
@@ -16,5 +16,6 @@
 
   Prosody-Version Status
   --------------- ----------------------
-  trunk           Works as of 2024-12-21
+  trunk           Works as of 2025-05-25
+  13              Works
   0.12            Does not work
--- a/mod_sasl2_fast/README.md	Tue Apr 29 23:27:06 2025 +0700
+++ b/mod_sasl2_fast/README.md	Sun May 18 20:52:00 2025 +0700
@@ -33,5 +33,6 @@
 
   Prosody-Version Status
   --------------- ----------------------
-  trunk           Works as of 2024-12-21
+  trunk           Works as of 2025-05-25
+  13              Work
   0.12            Does not work
--- a/mod_sasl2_sm/README.md	Tue Apr 29 23:27:06 2025 +0700
+++ b/mod_sasl2_sm/README.md	Sun May 18 20:52:00 2025 +0700
@@ -17,5 +17,6 @@
 
   Prosody-Version Status
   --------------- ----------------------
-  trunk           Works as of 2024-12-21
+  trunk           Works as of 2025-05-25
+  13              Work
   0.12            Does not work
--- a/mod_sasl_ssdp/README.md	Tue Apr 29 23:27:06 2025 +0700
+++ b/mod_sasl_ssdp/README.md	Sun May 18 20:52:00 2025 +0700
@@ -18,8 +18,8 @@
 
 # Compatibility
 
-For SASL2 (XEP-0388) clients, it is compatible with the mod_sasl2 community module.
-
-For clients using RFC 6120 SASL, it requires Prosody trunk 33e5edbd6a4a or
-later. It is not compatible with Prosody 0.12 (it will load, but simply
-won't do anything) for "legacy SASL".
+  Prosody-Version Status
+  --------------- ----------------------
+  trunk           Works as of 2025-05-25
+  13              Works
+  0.12            Does not work
--- a/mod_twitter/README.md	Tue Apr 29 23:27:06 2025 +0700
+++ b/mod_twitter/README.md	Sun May 18 20:52:00 2025 +0700
@@ -1,6 +1,6 @@
 ---
 labels:
-- 'Stage-Alpha'
+- 'Stage-Broken'
 summary: 'Simple example of working component and HTTP polling.'
 ...
 
--- a/mod_vcard_muc/README.md	Tue Apr 29 23:27:06 2025 +0700
+++ b/mod_vcard_muc/README.md	Sun May 18 20:52:00 2025 +0700
@@ -1,8 +1,9 @@
 ---
-summary: Support for MUC vCards and avatars
 labels:
-- 'Stage-Stable'
-...
+- Stage-Deprecated
+- Stage-Stable
+summary: Support for MUC vCards and avatars
+---
 
 # Introduction
 
@@ -10,9 +11,9 @@
 
 # Usage
 
-Add "vcard\_muc" to your modules\_enabled list:
+Add "vcard_muc" to your modules_enabled list:
 
-``` {.lua}
+``` lua
 Component "conference.example.org" "muc"
 modules_enabled = {
   "vcard_muc",
@@ -21,8 +22,7 @@
 
 # Compatibility
 
-  ------------------------- ----------
-  trunk^[as of 2024-10-22]  Works
-  0.12                      Works
-  ------------------------- ----------
-
+  ------ -----------------------------------------
+  13     Room avatar feature included in Prosody
+  0.12   Works
+  ------ -----------------------------------------
--- a/mod_warn_legacy_tls/README.md	Tue Apr 29 23:27:06 2025 +0700
+++ b/mod_warn_legacy_tls/README.md	Sun May 18 20:52:00 2025 +0700
@@ -4,14 +4,13 @@
 summary: Warn users of obsolete TLS Versions in clients
 ---
 
-
 TLS 1.0 and TLS 1.1 are obsolete. This module warns clients if they are using those versions, to prepare for disabling them. (If you use the default prosody config, this module will be unnessesary in its default setting, since these protocols are not allowed anymore by any supported prosody version.)
 
 This module can be used to warn from TLS1.2 if you want to switch to modern security in the near future.
 
 # Configuration
 
-``` {.lua}
+``` lua
 modules_enabled = {
     -- other modules etc
     "warn_legacy_tls";
@@ -41,7 +40,8 @@
 
 # Compatibility
 
-Prosody-Version Status
---------------- ---------------------
-trunk           Works as of 24-12-16
-0.12            Works
+  Prosody-Version   Status
+  ----------------- ----------------------
+  trunk             Works as of 25-05-25
+  13                Works
+  0.12              Works