feat: #61 Plugin system — backend API, sandboxed Web Worker, hooks wired to real app flow, user guide, 47+21 tests
CI / lint (push) Failing after 30s
CI / test (push) Skipped
CI / build (push) Skipped
CI / e2e (push) Skipped
CI / security (push) Successful in 35s
Desktop Build / build-windows (push) Canceled after 0s
Desktop Build / build-linux (push) Canceled after 0s
CI / lint (push) Failing after 30s
CI / test (push) Skipped
CI / build (push) Skipped
CI / e2e (push) Skipped
CI / security (push) Successful in 35s
Desktop Build / build-windows (push) Canceled after 0s
Desktop Build / build-linux (push) Canceled after 0s
This commit is contained in:
@@ -614,6 +614,22 @@ async def lifespan(app: FastAPI):
|
||||
loop = asyncio.get_running_loop()
|
||||
await loop.run_in_executor(_search_executor, init_inverted_index)
|
||||
|
||||
# Scan for plugins in all vaults
|
||||
logger.info("Scanning for plugins...")
|
||||
from backend.indexer import vault_config
|
||||
from backend.plugins import get_plugin_registry
|
||||
registry = get_plugin_registry()
|
||||
for vault_name, cfg in vault_config.items():
|
||||
vault_path = cfg.get("path")
|
||||
if vault_path:
|
||||
try:
|
||||
plugins = registry.scan_vault(vault_name, vault_path)
|
||||
logger.info(f"Vault '{vault_name}': found {len(plugins)} plugin(s)")
|
||||
from backend.plugins import emit_vault_mounted
|
||||
emit_vault_mounted(vault_name, vault_path)
|
||||
except Exception as e:
|
||||
logger.warning(f"Plugin scan failed for vault '{vault_name}': {e}")
|
||||
|
||||
# Start file watcher
|
||||
config = _load_config()
|
||||
watcher_enabled = config.get("watcher_enabled", True)
|
||||
@@ -738,6 +754,14 @@ try:
|
||||
except ImportError as e:
|
||||
logger.warning(f"Could not load push notifications router: {e}")
|
||||
|
||||
# Plugins system endpoints
|
||||
try:
|
||||
from backend.plugins import router as plugins_router
|
||||
app.include_router(plugins_router)
|
||||
logger.info("Plugins router mounted at /api/plugins/*")
|
||||
except ImportError as e:
|
||||
logger.warning(f"Could not load plugins router: {e}")
|
||||
|
||||
# Resolve frontend path relative to this file
|
||||
FRONTEND_DIR = Path(__file__).resolve().parent.parent / "frontend"
|
||||
|
||||
@@ -1778,6 +1802,9 @@ async def api_file_delete(vault_name: str, path: str = Query(..., description="R
|
||||
"vault": vault_name,
|
||||
"path": path,
|
||||
})
|
||||
|
||||
from backend.plugins import emit_file_deleted
|
||||
emit_file_deleted(vault_name, path)
|
||||
|
||||
# Remove from recent files
|
||||
remove_recent(current_user["username"], vault_name, path)
|
||||
@@ -2072,6 +2099,8 @@ async def api_file_create(
|
||||
"path": body.path,
|
||||
})
|
||||
await dispatch_webhooks("file_created", {"vault": vault_name, "path": body.path})
|
||||
from backend.plugins import emit_file_created
|
||||
emit_file_created(vault_name, body.path)
|
||||
|
||||
return {"success": True, "path": body.path}
|
||||
except PermissionError:
|
||||
|
||||
Reference in New Issue
Block a user