diff options
-rwxr-xr-x | rwa/support/sessionservice/service.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/rwa/support/sessionservice/service.py b/rwa/support/sessionservice/service.py index 33a679d..0d7ade1 100755 --- a/rwa/support/sessionservice/service.py +++ b/rwa/support/sessionservice/service.py @@ -99,7 +99,7 @@ class RWASupportSessionService(dbus.service.Object): logging.debug(f"Is '{url}' an URL: {valid}") return valid - def _get_web_app_hosts(self) -> str: + def _get_web_app_hosts(self) -> list: """Get all registered RWA.Support.WebApp hosts. Helper function: No D-Bus API. @@ -109,7 +109,7 @@ class RWASupportSessionService(dbus.service.Object): hosts = [ self._build_host_dict(key, value) for key, value in self.settings.web_app_hosts.items() ] - return json.dumps(hosts) + return hosts def _build_host_dict(self, host_uuid: str, host: dict) -> dict: """Include the host ID in the host dictionary.""" @@ -126,11 +126,12 @@ class RWASupportSessionService(dbus.service.Object): :: - [{"url": "https://example.org", "uuid": <host_uuid>}, {"url": "http://127.0.0.1:8000", "uuid": <host_uuid>}] + {"status": "success", [{"url": "https://example.org", "uuid": <host_uuid>}, {"url": "http://127.0.0.1:8000", "uuid": <host_uuid>}]} """ logging.info("D-Bus method call: %s()", "get_web_app_hosts") response = self._get_web_app_hosts() + response = json.dumps({"status": "success", "hosts": response}) logging.info('The response to D-Bus caller: "%s"', response) return response @@ -261,7 +262,7 @@ class RWASupportSessionService(dbus.service.Object): return response @dbus.service.method( - "org.ArcticaProject.RWASupportSessionService", in_signature="i", out_signature="s" + "org.ArcticaProject.RWASupportSessionService", in_signature="s", out_signature="s" ) def remove_web_app_host(self, host_uuid: str) -> str: """Remove a RWA.Support.WebApp host. @@ -273,7 +274,7 @@ class RWASupportSessionService(dbus.service.Object): :: - [{"url": "https://example.org", "uuid": <host_uuid>}, {"url": "http://127.0.0.1:8000", "uuid": <host_uuid>}] + {"status": "success", "host": {"url": "https://example.org", "alias": "<host_alias>", "uuid": <host_uuid>}} """ logging.info("D-Bus method call: %s(%s)", "remove_web_app_host", host_uuid) @@ -291,11 +292,12 @@ class RWASupportSessionService(dbus.service.Object): return json.dumps({"status": "error", "type": "host_not_found"}) response = self._get_web_app_hosts() + response = json.dumps({"status": "success", "hosts": response}); logging.info('The response to D-Bus caller: "%s"', response) - return response + return response; @dbus.service.method( - "org.ArcticaProject.RWASupportSessionService", in_signature="i", out_signature="s" + "org.ArcticaProject.RWASupportSessionService", in_signature="s", out_signature="s" ) def start(self, host_uuid: str) -> str: """Start a new remote session and register it in RWA.Support.WebApp. |