diff --git a/backend/src/api/api_utils.rs b/backend/src/api/api_utils.rs index 69d83f4f8..88d0be6a2 100644 --- a/backend/src/api/api_utils.rs +++ b/backend/src/api/api_utils.rs @@ -735,7 +735,7 @@ pub async fn force_provider_stream_response( addr: &str, app_state: &AppState, user_session: &UserSession, - stream_channel: StreamChannel, + mut stream_channel: StreamChannel, req_headers: &HeaderMap, input: &ConfigInput, user: &ProxyUserCredentials, @@ -768,6 +768,7 @@ pub async fn force_provider_stream_response( .active_users .update_session_addr(&user.username, &user_session.token, addr) .await; + stream_channel.shared = share_stream; let stream = ActiveClientStream::new(stream_details, app_state, user, connection_permission, addr, stream_channel) .await; @@ -807,7 +808,7 @@ pub async fn stream_response( addr: &str, app_state: &AppState, session_token: &str, - stream_channel: StreamChannel, + mut stream_channel: StreamChannel, stream_url: &str, req_headers: &HeaderMap, input: &ConfigInput, @@ -869,6 +870,7 @@ pub async fn stream_response( } else { None }; + stream_channel.shared = share_stream; let stream = ActiveClientStream::new(stream_details, app_state, user, connection_permission, addr, stream_channel) .await; @@ -984,7 +986,7 @@ async fn shared_stream_response( addr: &str, user: &ProxyUserCredentials, connect_permission: UserConnectionPermission, - stream_channel: StreamChannel + mut stream_channel: StreamChannel ) -> Option { if let Some(stream) = SharedStreamManager::subscribe_shared_stream(app_state, stream_url, Some(addr)).await @@ -1003,6 +1005,7 @@ async fn shared_stream_response( axum::http::StatusCode::OK, ))); let stream_details = StreamDetails::from_stream(stream); + stream_channel.shared = true; let stream = ActiveClientStream::new(stream_details, app_state, user, connect_permission, addr, stream_channel) .await diff --git a/backend/src/api/endpoints/hls_api.rs b/backend/src/api/endpoints/hls_api.rs index 641c996c7..ae421a2d2 100644 --- a/backend/src/api/endpoints/hls_api.rs +++ b/backend/src/api/endpoints/hls_api.rs @@ -186,6 +186,7 @@ async fn resolve_stream_channel( group: "Unknown".to_string(), title: "Unknown".to_string(), url: hls_url.to_string(), + shared: false, }, }; diff --git a/frontend/public/assets/i18n/en.json b/frontend/public/assets/i18n/en.json index d0e15d7e8..6c639ab36 100644 --- a/frontend/public/assets/i18n/en.json +++ b/frontend/public/assets/i18n/en.json @@ -289,7 +289,8 @@ "CHANNEL": "Channel", "GROUP": "Group", "CLIENT_IP": "Client IP", - "STREAM_ID": "Stream Id" + "STREAM_ID": "Stream Id", + "SHARED": "Shared" }, "TITLE": { "USER_BOUQUET_EDITOR": "User group editor" diff --git a/frontend/src/app/components/dashboard/streams_table.rs b/frontend/src/app/components/dashboard/streams_table.rs index 55e700c69..53b87cd65 100644 --- a/frontend/src/app/components/dashboard/streams_table.rs +++ b/frontend/src/app/components/dashboard/streams_table.rs @@ -1,6 +1,6 @@ use crate::app::components::menu_item::MenuItem; use crate::app::components::popup_menu::PopupMenu; -use crate::app::components::{AppIcon, Table, TableDefinition}; +use crate::app::components::{AppIcon, Table, TableDefinition, ToggleSwitch}; use crate::hooks::use_service_context; use shared::error::{create_tuliprox_error_result, TuliproxError, TuliproxErrorKind}; use shared::model::{SortOrder, StreamInfo}; @@ -10,14 +10,15 @@ use std::str::FromStr; use yew::prelude::*; use yew_i18n::use_translation; -const HEADERS: [&str; 7] = [ +const HEADERS: [&str; 8] = [ "LABEL.EMPTY", "LABEL.USERNAME", "LABEL.STREAM_ID", "LABEL.CHANNEL", "LABEL.GROUP", "LABEL.CLIENT_IP", - "LABEL.PROVIDER" + "LABEL.PROVIDER", + "LABEL.SHARED" ]; #[derive(Properties, PartialEq, Clone)] @@ -94,6 +95,7 @@ pub fn StreamsTable(props: &StreamsTableProps) -> Html { 4 => html! {dto.channel.group.as_str()}, 5 => html! {dto.addr.as_str()}, 6 => html! {dto.provider.as_str()}, + 7 => html! { }, _ => html! {""}, } }) diff --git a/shared/src/model/stream_info.rs b/shared/src/model/stream_info.rs index 6cbb39d3f..0edd1d460 100644 --- a/shared/src/model/stream_info.rs +++ b/shared/src/model/stream_info.rs @@ -10,6 +10,7 @@ pub struct StreamChannel { pub group: String, pub title: String, pub url: String, + pub shared: bool, } impl XtreamPlaylistItem { pub fn to_stream_channel(&self) -> StreamChannel { @@ -21,6 +22,7 @@ impl XtreamPlaylistItem { group: self.group.clone(), title: self.title.clone(), url: self.url.clone(), + shared: false, } } } @@ -35,6 +37,7 @@ impl M3uPlaylistItem { group: self.group.clone(), title: self.title.clone(), url: self.url.clone(), + shared: false, } } }