clan-lib: Fix @API.register_abstract not throwing correct error when called directly without implementation

clan-app: Fix mypy lint

clan-lib: Mark test as with_core
This commit is contained in:
Qubasa
2025-07-10 14:20:57 +07:00
committed by a-kenji
parent be384420d5
commit 0d851580e1
5 changed files with 13 additions and 5 deletions

View File

@@ -10,7 +10,7 @@ from clan_lib.dirs import user_data_dir
from clan_lib.log_manager import LogGroupConfig, LogManager
from clan_lib.log_manager import api as log_manager_api
from clan_app.api.file_gtk import open_file
from clan_app.api.file_gtk import open_clan_folder, open_file
from clan_app.api.middleware import (
ArgumentParsingMiddleware,
LoggingMiddleware,
@@ -56,10 +56,9 @@ def app_run(app_opts: ClanAppOptions) -> int:
# Populate the API global with all functions
load_in_all_api_functions()
API.overwrite_fn(open_file)
# Create a shared threads dictionary for both HTTP and Webview modes
shared_threads = {}
shared_threads: dict[str, tasks.WebThread] = {}
tasks.BAKEND_THREADS = shared_threads
# Start HTTP API server if requested
@@ -114,6 +113,9 @@ def app_run(app_opts: ClanAppOptions) -> int:
shared_threads=shared_threads,
)
API.overwrite_fn(open_file)
API.overwrite_fn(open_clan_folder)
# Add middleware to the webview
webview.add_middleware(ArgumentParsingMiddleware(api=API))
webview.add_middleware(LoggingMiddleware(log_manager=log_manager))

View File

@@ -126,7 +126,7 @@ class Webview:
)
else:
bridge = WebviewBridge(
webview=self, middleware_chain=tuple(self._middleware)
webview=self, middleware_chain=tuple(self._middleware), threads={}
)
self._bridge = bridge
return bridge