user bouquet filter for xtream refactored

This commit is contained in:
euzu
2025-03-08 06:33:38 +01:00
parent fcc82dec74
commit ff4a5717ce
4 changed files with 132 additions and 103 deletions
+2 -2
View File
@@ -104,11 +104,11 @@ async fn save_playlist_bouquet(
req: web::Json<PlaylistBouquetDto>,
) -> HttpResponse {
if let Some(username) = get_username_from_auth_header(credentials, &app_state) {
if let Some((user, _target)) = get_user_target_by_username(username.as_str(), &app_state).await {
if let Some((user, target)) = get_user_target_by_username(username.as_str(), &app_state).await {
if !user.has_permissions(&app_state) {
return HttpResponse::Forbidden().finish();
}
match save_user_bouquet(&app_state.config, &username, &req.0) {
match save_user_bouquet(&app_state.config, &target.name, &username, &req.0).await {
Ok(()) => {
return HttpResponse::Ok().finish();
}
+3 -3
View File
@@ -514,9 +514,9 @@ async fn xtream_player_api_handle_content_action(config: &Config, target_name: &
if let Some(file_path) = path {
// load user bouquet
let filter = match action {
ACTION_GET_LIVE_CATEGORIES => user_repository::user_get_bouquet_filter(config, target_name,&user.username, category_id, TargetType::Xtream, XtreamCluster::Live).await,
ACTION_GET_VOD_CATEGORIES => user_repository::user_get_bouquet_filter(config, target_name, &user.username, category_id, TargetType::Xtream, XtreamCluster::Video).await,
ACTION_GET_SERIES_CATEGORIES => user_repository::user_get_bouquet_filter(config, target_name, &user.username, category_id, TargetType::Xtream, XtreamCluster::Series).await,
ACTION_GET_LIVE_CATEGORIES => user_repository::user_get_bouquet_filter(config, &user.username, category_id, TargetType::Xtream, XtreamCluster::Live).await,
ACTION_GET_VOD_CATEGORIES => user_repository::user_get_bouquet_filter(config, &user.username, category_id, TargetType::Xtream, XtreamCluster::Video).await,
ACTION_GET_SERIES_CATEGORIES => user_repository::user_get_bouquet_filter(config, &user.username, category_id, TargetType::Xtream, XtreamCluster::Series).await,
_ => None
};
if let Some(flt) = filter {