# HG changeset patch # User Goffi # Date 1736727802 -3600 # Node ID 627f872bc16e5e05e594ab6d76ee00788cfba465 # Parent 17fa953c8cd7f5cc448da377378297cfc6a22d9b plugin XEP-0050: fix `allowed_magics` arg and calls to `add_ad_hoc_command`. diff -r 17fa953c8cd7 -r 627f872bc16e libervia/backend/plugins/plugin_comp_ap_gateway/ad_hoc.py --- a/libervia/backend/plugins/plugin_comp_ap_gateway/ad_hoc.py Mon Jan 13 01:23:10 2025 +0100 +++ b/libervia/backend/plugins/plugin_comp_ap_gateway/ad_hoc.py Mon Jan 13 01:23:22 2025 +0100 @@ -44,7 +44,7 @@ self.xmpp_jid_node_2_ap_actor, "Convert XMPP JID/Node to AP actor", node=NS_XMPP_JID_NODE_2_AP, - allowed_magics=C.ENTITY_ALL, + allowed_magics=[C.ENTITY_ALL], ) async def xmpp_jid_node_2_ap_actor( diff -r 17fa953c8cd7 -r 627f872bc16e libervia/backend/plugins/plugin_comp_file_sharing_management.py --- a/libervia/backend/plugins/plugin_comp_file_sharing_management.py Mon Jan 13 01:23:10 2025 +0100 +++ b/libervia/backend/plugins/plugin_comp_file_sharing_management.py Mon Jan 13 01:23:22 2025 +0100 @@ -89,28 +89,28 @@ self._on_change_file, "Change Permissions of File(s)", node=NS_FILE_MANAGEMENT_PERM, - allowed_magics=C.ENTITY_ALL, + allowed_magics=[C.ENTITY_ALL], ) self._c.add_ad_hoc_command( client, self._on_delete_file, "Delete File(s)", node=NS_FILE_MANAGEMENT_DELETE, - allowed_magics=C.ENTITY_ALL, + allowed_magics=[C.ENTITY_ALL], ) self._c.add_ad_hoc_command( client, self._on_gen_thumbnails, "Generate Thumbnails", node=NS_FILE_MANAGEMENT_THUMB, - allowed_magics=C.ENTITY_ALL, + allowed_magics=[C.ENTITY_ALL], ) self._c.add_ad_hoc_command( client, self._on_quota, "Get Quota", node=NS_FILE_MANAGEMENT_QUOTA, - allowed_magics=C.ENTITY_ALL, + allowed_magics=[C.ENTITY_ALL], ) def _delete(self, service_jid_s, path, namespace, profile): diff -r 17fa953c8cd7 -r 627f872bc16e libervia/backend/plugins/plugin_xep_0050.py --- a/libervia/backend/plugins/plugin_xep_0050.py Mon Jan 13 01:23:10 2025 +0100 +++ b/libervia/backend/plugins/plugin_xep_0050.py Mon Jan 13 01:23:22 2025 +0100 @@ -31,7 +31,7 @@ from libervia.backend.core.i18n import _, D_ from libervia.backend.core.constants import Const as C from libervia.backend.core.log import getLogger -from libervia.backend.core.xmpp import SatXMPPClient, SatXMPPEntity +from libervia.backend.core.core_types import SatXMPPEntity from libervia.backend.core import exceptions from libervia.backend.memory.memory import Sessions from libervia.backend.tools import xml_tools, utils @@ -352,7 +352,7 @@ session_id=None, form_values=None, timeout=30, - ): + ) -> defer.Deferred[domish.Element]: """Do an Ad-Hoc Command @param entity(jid.JID): entity which will execture the command @@ -760,7 +760,7 @@ def add_ad_hoc_command( self, - client: SatXMPPClient, + client: SatXMPPEntity, callback: Callable, label: str, node: str | None = None, @@ -814,6 +814,8 @@ allowed_groups = [] if allowed_magics is None: allowed_magics = [C.ENTITY_PROFILE_BARE] + elif isinstance(allowed_magics, str): + raise exceptions.InternalError("Allowed magic must be a list of strings!") if forbidden_jids is None: forbidden_jids = [] if forbidden_groups is None: