| 3972 | } |
| 3973 | |
| 3974 | async fn global_event_stream( |
| 3975 | State(state): State<Arc<ServerState>>, |
| 3976 | ) -> Sse<impl Stream<Item = std::result::Result<Event, Infallible>>> { |
| 3977 | let rx = state.event_bus.subscribe(); |
| 3978 | Sse::new(BroadcastStream::new(rx).filter_map(|result| match result { |
| 3979 | Ok(event) => Some(Ok(Event::default().data(event))), |
| 3980 | Err(_) => None, |
| 3981 | })) |
| 3982 | } |
| 3983 | |
| 3984 | async fn get_global_config(State(_state): State<Arc<ServerState>>) -> Result<Json<AppConfig>> { |
| 3985 | Ok(Json(AppConfig::default())) |