24 lines
562 B
Rust
24 lines
562 B
Rust
use axum::{extract::State, response::IntoResponse, Json};
|
|
|
|
use super::ApiState;
|
|
use crate::{
|
|
api::{EmptyJsonResponse, Result},
|
|
limits::LimitsConfig,
|
|
};
|
|
|
|
pub async fn h_update_session_ratelimits(
|
|
State(state): State<ApiState>,
|
|
Json(limits): Json<LimitsConfig>,
|
|
) -> Result<impl IntoResponse> {
|
|
state
|
|
.api
|
|
.session()
|
|
.ratelimits
|
|
.set_upload_bps(limits.upload_bps);
|
|
state
|
|
.api
|
|
.session()
|
|
.ratelimits
|
|
.set_download_bps(limits.download_bps);
|
|
Ok(Json(EmptyJsonResponse {}))
|
|
}
|