diff --git a/repeater/web/api_endpoints.py b/repeater/web/api_endpoints.py index c69a5e0..687452c 100644 --- a/repeater/web/api_endpoints.py +++ b/repeater/web/api_endpoints.py @@ -3551,8 +3551,13 @@ class APIEndpoints: "settings": comp_settings, } sqlite_handler = None - if self.repeater_handler and self.repeater_handler.storage: - sqlite_handler = self.repeater_handler.storage.sqlite_handler + repeater_handler = ( + getattr(self.daemon_instance, "repeater_handler", None) + if self.daemon_instance + else None + ) + if repeater_handler and getattr(repeater_handler, "storage", None): + sqlite_handler = repeater_handler.storage.sqlite_handler if sqlite_handler and identity_key: try: validate_companion_config_capacity( @@ -3786,8 +3791,13 @@ class APIEndpoints: return self._error(str(e)) sqlite_handler = None - if self.repeater_handler and self.repeater_handler.storage: - sqlite_handler = self.repeater_handler.storage.sqlite_handler + repeater_handler = ( + getattr(self.daemon_instance, "repeater_handler", None) + if self.daemon_instance + else None + ) + if repeater_handler and getattr(repeater_handler, "storage", None): + sqlite_handler = repeater_handler.storage.sqlite_handler if sqlite_handler and identity.get("identity_key"): try: validate_companion_config_capacity( diff --git a/tests/test_companion_bridge_frame_utils.py b/tests/test_companion_bridge_frame_utils.py index fcd1c09..c0e7c09 100644 --- a/tests/test_companion_bridge_frame_utils.py +++ b/tests/test_companion_bridge_frame_utils.py @@ -147,7 +147,7 @@ async def test_frame_server_persistence_paths_and_stop(): srv._build_message_frame = MagicMock(return_value=b"frame") await srv._persist_companion_message({"text": "x"}) - sqlite.companion_push_message.assert_called_once_with("h", {"text": "x"}) + sqlite.companion_push_message.assert_called_once_with("h", {"text": "x"}, None) bridge.message_queue.pop_last.assert_called_once() msg = srv._sync_next_from_persistence()