fix: clean up OAuth token cache on provider deletion (#7908)
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -408,6 +408,7 @@ derive_utoipa!(Icon as IconSchema);
|
||||
super::routes::config_management::remove_custom_provider,
|
||||
super::routes::config_management::get_provider_catalog,
|
||||
super::routes::config_management::get_provider_catalog_template,
|
||||
super::routes::config_management::cleanup_provider_cache,
|
||||
super::routes::config_management::check_provider,
|
||||
super::routes::config_management::set_config_provider,
|
||||
super::routes::config_management::configure_provider_oauth,
|
||||
|
||||
@@ -710,6 +710,24 @@ pub async fn remove_custom_provider(Path(id): Path<String>) -> Result<Json<Strin
|
||||
Ok(Json(format!("Removed custom provider: {}", id)))
|
||||
}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/config/providers/{name}/cleanup",
|
||||
params(
|
||||
("name" = String, Path, description = "Provider name (e.g., githubcopilot)")
|
||||
),
|
||||
responses(
|
||||
(status = 200, description = "Provider cache cleaned up successfully", body = String),
|
||||
(status = 500, description = "Internal server error")
|
||||
)
|
||||
)]
|
||||
pub async fn cleanup_provider_cache(
|
||||
Path(name): Path<String>,
|
||||
) -> Result<Json<String>, ErrorResponse> {
|
||||
goose::providers::cleanup_provider(&name).await?;
|
||||
Ok(Json(format!("Cleaned up provider cache: {}", name)))
|
||||
}
|
||||
|
||||
#[utoipa::path(
|
||||
put,
|
||||
path = "/config/custom-providers/{id}",
|
||||
@@ -908,6 +926,10 @@ pub fn routes(state: Arc<AppState>) -> Router {
|
||||
"/config/provider-catalog/{id}",
|
||||
get(get_provider_catalog_template),
|
||||
)
|
||||
.route(
|
||||
"/config/providers/{name}/cleanup",
|
||||
post(cleanup_provider_cache),
|
||||
)
|
||||
.route("/config/detect-provider", post(detect_provider))
|
||||
.route("/config/slash_commands", get(get_slash_commands))
|
||||
.route(
|
||||
|
||||
Reference in New Issue
Block a user