feat: record results of beacon callbacks
This commit is contained in:
@@ -33,7 +33,6 @@ pub async fn issue_command(
|
||||
"No form data was provided".to_owned(),
|
||||
))?;
|
||||
while let Ok(Some(mut field)) = data.next_field().await {
|
||||
tracing::debug!("Processing field {:?}", field.name());
|
||||
let Some(name) = field.name().map(|f| f.to_string()) else { continue; };
|
||||
|
||||
let file_name = field.file_name().map(str::to_string);
|
||||
@@ -107,12 +106,11 @@ pub async fn issue_command(
|
||||
));
|
||||
};
|
||||
|
||||
fields.remove("cmd_type");
|
||||
|
||||
let fields = serde_json::Value::Object(fields);
|
||||
|
||||
command_builder.verify_json_body(fields.clone())?;
|
||||
serde_json::from_value::<sparse_actions::actions::Actions>(fields.clone())?;
|
||||
|
||||
let serialized_fields = serde_json::to_string(&fields)?;
|
||||
let parsed_fields = command_builder.build_action(fields, &db).await?;
|
||||
let serialized_fields = serde_json::to_string(&parsed_fields)?;
|
||||
|
||||
let command_id = sqlx::query!(
|
||||
"INSERT INTO beacon_command (cmd_parameters) VALUES (?)",
|
||||
|
||||
@@ -476,6 +476,9 @@ async fn handle_listener_events(
|
||||
let json = serde_json::to_string(&SidebarEvents::NewBeacon(beacon))?;
|
||||
socket.send(ws::Message::Text(json)).await?;
|
||||
}
|
||||
Ok(_) => {
|
||||
// this event isn't meant for public announcement
|
||||
}
|
||||
Err(e) => {
|
||||
tracing::warn!("Unable to handle general event: {e:?}");
|
||||
}
|
||||
@@ -491,7 +494,7 @@ pub async fn serve_web(
|
||||
let conf = get_configuration(None).unwrap();
|
||||
let leptos_options = conf.leptos_options;
|
||||
let routes = generate_route_list(App);
|
||||
let beacon_event_broadcast = tokio::sync::broadcast::Sender::<sparse_handler::BeaconEvent>::new(128);
|
||||
let beacon_event_broadcast = tokio::sync::broadcast::Sender::<sparse_handler::BeaconEvent>::new(4096);
|
||||
let beacon_listeners = sparse_handler::BeaconListenerMap::default();
|
||||
|
||||
tokio::fs::create_dir_all(&file_store).await?;
|
||||
|
||||
Reference in New Issue
Block a user