pinakes-server: integrate plugin system into routes & application state

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ib5d482326cae1dcb43603bffb76a6a186a6a6964
This commit is contained in:
raf 2026-03-08 15:06:11 +03:00
commit e9c5390c45
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
6 changed files with 206 additions and 46 deletions

View file

@ -127,6 +127,17 @@ pub async fn toggle_plugin(
})?;
}
// Re-discover capabilities after toggle so cached data stays current
if let Some(ref pipeline) = state.plugin_pipeline
&& let Err(e) = pipeline.discover_capabilities().await
{
tracing::warn!(
plugin_id = %id,
error = %e,
"failed to re-discover capabilities after plugin toggle"
);
}
Ok(Json(serde_json::json!({
"id": id,
"enabled": req.enabled
@ -150,5 +161,16 @@ pub async fn reload_plugin(
))
})?;
// Re-discover capabilities after reload so cached data stays current
if let Some(ref pipeline) = state.plugin_pipeline
&& let Err(e) = pipeline.discover_capabilities().await
{
tracing::warn!(
plugin_id = %id,
error = %e,
"failed to re-discover capabilities after plugin reload"
);
}
Ok(Json(serde_json::json!({"reloaded": true})))
}