| 2558 | } |
| 2559 | |
| 2560 | fn validate_screen_recording_seconds(seconds: Option<f64>) -> Result<f64, AppError> { |
| 2561 | let seconds = seconds.unwrap_or(5.0); |
| 2562 | if !seconds.is_finite() || seconds <= 0.0 { |
| 2563 | return Err(AppError::bad_request( |
| 2564 | "`seconds` must be finite and greater than zero.", |
| 2565 | )); |
| 2566 | } |
| 2567 | if seconds > 120.0 { |
| 2568 | return Err(AppError::bad_request( |
| 2569 | "`seconds` must be 120 or less for API screen recordings.", |
| 2570 | )); |
| 2571 | } |
| 2572 | Ok(seconds) |
| 2573 | } |
| 2574 | |
| 2575 | async fn refresh_stream( |
| 2576 | State(state): State<AppState>, |