pinakes-server: integrate plugin system into routes & application state
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ib5d482326cae1dcb43603bffb76a6a186a6a6964
This commit is contained in:
parent
f686e8a777
commit
e9c5390c45
6 changed files with 206 additions and 46 deletions
|
|
@ -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})))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue