treewide: fix various UI bugs; optimize crypto dependencies & format
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: If8fe8b38c1d9c4fecd40ff71f88d2ae06a6a6964
This commit is contained in:
parent
764aafa88d
commit
3ccddce7fd
178 changed files with 58285 additions and 54241 deletions
|
|
@ -1,40 +1,40 @@
|
|||
use axum::Json;
|
||||
use axum::extract::State;
|
||||
use axum::{Json, extract::State};
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::error::ApiError;
|
||||
use crate::state::AppState;
|
||||
use crate::{error::ApiError, state::AppState};
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct WebhookInfo {
|
||||
pub url: String,
|
||||
pub events: Vec<String>,
|
||||
pub url: String,
|
||||
pub events: Vec<String>,
|
||||
}
|
||||
|
||||
pub async fn list_webhooks(
|
||||
State(state): State<AppState>,
|
||||
State(state): State<AppState>,
|
||||
) -> Result<Json<Vec<WebhookInfo>>, ApiError> {
|
||||
let config = state.config.read().await;
|
||||
let hooks: Vec<WebhookInfo> = config
|
||||
.webhooks
|
||||
.iter()
|
||||
.map(|h| WebhookInfo {
|
||||
url: h.url.clone(),
|
||||
events: h.events.clone(),
|
||||
})
|
||||
.collect();
|
||||
Ok(Json(hooks))
|
||||
let config = state.config.read().await;
|
||||
let hooks: Vec<WebhookInfo> = config
|
||||
.webhooks
|
||||
.iter()
|
||||
.map(|h| {
|
||||
WebhookInfo {
|
||||
url: h.url.clone(),
|
||||
events: h.events.clone(),
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
Ok(Json(hooks))
|
||||
}
|
||||
|
||||
pub async fn test_webhook(
|
||||
State(state): State<AppState>,
|
||||
State(state): State<AppState>,
|
||||
) -> Result<Json<serde_json::Value>, ApiError> {
|
||||
let config = state.config.read().await;
|
||||
let count = config.webhooks.len();
|
||||
// Emit a test event to all configured webhooks
|
||||
// In production, the event bus would handle delivery
|
||||
Ok(Json(serde_json::json!({
|
||||
"webhooks_configured": count,
|
||||
"test_sent": true
|
||||
})))
|
||||
let config = state.config.read().await;
|
||||
let count = config.webhooks.len();
|
||||
// Emit a test event to all configured webhooks
|
||||
// In production, the event bus would handle delivery
|
||||
Ok(Json(serde_json::json!({
|
||||
"webhooks_configured": count,
|
||||
"test_sent": true
|
||||
})))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue