mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-29 02:02:23 +01:00
Added kick duration for web_ui kick
This commit is contained in:
@@ -164,7 +164,7 @@ pub(in crate::api) async fn handle_hls_stream_request(
|
||||
CustomVideoStreamType::ChannelUnavailable);
|
||||
|
||||
let playlist = PLAYLIST_TEMPLATE.replace("{url}", &url);
|
||||
hls_response(playlist.clone()).into_response()
|
||||
hls_response(playlist).into_response()
|
||||
} else {
|
||||
axum::http::StatusCode::NOT_FOUND.into_response()
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ async fn m3u_api_stream(
|
||||
);
|
||||
let virtual_id = pli.virtual_id;
|
||||
|
||||
if app_state.active_users.is_user_blocked_for_stream(stream_req.username, virtual_id).await {
|
||||
if app_state.active_users.is_user_blocked_for_stream(&user.username, virtual_id).await {
|
||||
return axum::http::StatusCode::BAD_REQUEST.into_response();
|
||||
}
|
||||
|
||||
|
||||
@@ -255,7 +255,7 @@ async fn xtream_player_api_stream(
|
||||
format!("Failed to read xtream item for stream id {req_virtual_id}")
|
||||
);
|
||||
let virtual_id = pli.virtual_id;
|
||||
if app_state.active_users.is_user_blocked_for_stream(stream_req.username, virtual_id).await {
|
||||
if app_state.active_users.is_user_blocked_for_stream(&user.username, virtual_id).await {
|
||||
return axum::http::StatusCode::BAD_REQUEST.into_response();
|
||||
}
|
||||
|
||||
|
||||
@@ -507,7 +507,7 @@ impl ActiveUserManager {
|
||||
let now = current_time_secs();
|
||||
connections.kicked.retain(|_, (expires_at, _)| *expires_at > now);
|
||||
if let Some(username) = connections.key_by_addr.get(addr).cloned() {
|
||||
let expires_at = now + blocked_secs;
|
||||
let expires_at = now + blocked_secs.clamp(1,86_400); // max 1 day
|
||||
connections.kicked.insert(username, (expires_at, virtual_id));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user