clan-app: Better http architecture

This commit is contained in:
Qubasa
2025-07-09 15:47:49 +07:00
parent 1c269d1eaa
commit 4008d2c165
11 changed files with 339 additions and 338 deletions

View File

@@ -25,7 +25,7 @@ class WebviewBridge(ApiBridge):
webview: "Webview"
threads: dict[str, WebThread] = field(default_factory=dict)
def send_response(self, response: BackendResponse) -> None:
def send_api_response(self, response: BackendResponse) -> None:
"""Send response back to the webview client."""
serialized = json.dumps(
@@ -79,7 +79,9 @@ class WebviewBridge(ApiBridge):
f"Error while handling webview call {method_name} with op_key {op_key}"
)
log.exception(msg)
self.send_error_response(op_key, str(e), ["webview_bridge", method_name])
self.send_api_error_response(
op_key, str(e), ["webview_bridge", method_name]
)
return
# Process in a separate thread