From c47c170df745573e688f045451c1183bc8d33afe Mon Sep 17 00:00:00 2001 From: euzu Date: Tue, 4 Nov 2025 23:32:17 +0100 Subject: [PATCH] Completly refactored connection management --- backend/src/api/model/active_user_manager.rs | 2 +- .../src/api/model/provider_lineup_manager.rs | 2 +- frontend/scss/app/components/_tabset.scss | 3 +- .../components/dashboard/_streams_view.scss | 13 +++- .../source_editor/_source_editor.scss | 2 +- .../source_editor/_source_editor_block.scss | 73 +++++++------------ .../source_editor/_source_editor_form.scss | 2 +- frontend/src/app/components/config/macros.rs | 8 +- .../components/config/video_config_view.rs | 2 +- 9 files changed, 47 insertions(+), 60 deletions(-) diff --git a/backend/src/api/model/active_user_manager.rs b/backend/src/api/model/active_user_manager.rs index b3520f8fd..76d787ad4 100644 --- a/backend/src/api/model/active_user_manager.rs +++ b/backend/src/api/model/active_user_manager.rs @@ -328,7 +328,7 @@ impl ActiveUserManager { if let Some(session) = connection_data.sessions.iter_mut().find(|session| session.token == token) { let previous_addr = session.addr; session.addr = *addr; - for stream in connection_data.streams.iter_mut() { + for stream in &mut connection_data.streams { if stream.addr == previous_addr { stream.addr = *addr; } diff --git a/backend/src/api/model/provider_lineup_manager.rs b/backend/src/api/model/provider_lineup_manager.rs index 9d8076a44..c7be1f513 100644 --- a/backend/src/api/model/provider_lineup_manager.rs +++ b/backend/src/api/model/provider_lineup_manager.rs @@ -337,7 +337,7 @@ impl MultiProviderLineup { ProviderAllocation::Exhausted } - // Used for redirect to cylce through provider + // Used for redirect to cyclce through provider async fn get_next_provider_from_group(priority_group: &ProviderPriorityGroup, grace: bool, grace_period_timeout_secs: u64) -> Option> { match priority_group { ProviderPriorityGroup::SingleProviderGroup(p) => { diff --git a/frontend/scss/app/components/_tabset.scss b/frontend/scss/app/components/_tabset.scss index 262e6127e..b0a795cd4 100644 --- a/frontend/scss/app/components/_tabset.scss +++ b/frontend/scss/app/components/_tabset.scss @@ -124,7 +124,6 @@ border-radius: 2px 2px 0 0; } -.tp__tab-button, -.tp__tab-button.active::after { +.tp__tab-button { transition: all 0.25s ease; } diff --git a/frontend/scss/app/components/dashboard/_streams_view.scss b/frontend/scss/app/components/dashboard/_streams_view.scss index 1b115c40a..676d9295b 100644 --- a/frontend/scss/app/components/dashboard/_streams_view.scss +++ b/frontend/scss/app/components/dashboard/_streams_view.scss @@ -29,7 +29,18 @@ .tp__streams-table { .tp__table__th { - $column-widths: 40px, 100px /*username*/, 120px /*stream_id*/, 80px /*type*/, 200px /*channel*/, 120px, 90px, 80px, 90px, 80px; + $column-widths: + 40px, /*index*/ + 100px, /*username*/ + 120px, /*stream_id*/ + 80px, /*type*/ + 200px, /*channel*/ + 120px, + 90px, + 80px, + 90px, + 80px; + @for $i from 1 through length($column-widths) { &--#{$i} { @include size.fixed-width(nth($column-widths, $i)); diff --git a/frontend/scss/app/components/source_editor/_source_editor.scss b/frontend/scss/app/components/source_editor/_source_editor.scss index 3124727e0..89aafb4bd 100644 --- a/frontend/scss/app/components/source_editor/_source_editor.scss +++ b/frontend/scss/app/components/source_editor/_source_editor.scss @@ -65,7 +65,7 @@ &__connections { position: absolute; left: 0; - top:0; + top: 0; box-sizing: border-box; width: 100%; height: 100%; diff --git a/frontend/scss/app/components/source_editor/_source_editor_block.scss b/frontend/scss/app/components/source_editor/_source_editor_block.scss index 9ce7f3e80..88b0a228d 100644 --- a/frontend/scss/app/components/source_editor/_source_editor_block.scss +++ b/frontend/scss/app/components/source_editor/_source_editor_block.scss @@ -166,6 +166,19 @@ $port-size: 10px; } } +@mixin brick-handle-gradient($bg-color, $border-color) { + background: repeating-linear-gradient( + -55deg, + $bg-color, + $bg-color 10px, + $border-color 10px, + $border-color 20px + ); + border-left: 1px solid $border-color; + border-top: 1px solid $border-color; + border-right: 1px solid $border-color; +} + .tp__source-editor__block { &-InputXtream, &-InputM3u { @@ -175,16 +188,10 @@ $port-size: 10px; } .tp__source-editor__block-handle { - background: repeating-linear-gradient( - -55deg, + @include brick-handle-gradient( var(--brick-input-background-color), - var(--brick-input-background-color) 10px, - var(--brick-input-border-color) 10px, - var(--brick-input-border-color) 20px + var(--brick-input-border-color) ); - border-left: 1px solid var(--brick-input-border-color); - border-top: 1px solid var(--brick-input-border-color); - border-right: 1px solid var(--brick-input-border-color); } } @@ -196,16 +203,10 @@ $port-size: 10px; } .tp__source-editor__block-handle { - background: repeating-linear-gradient( - -55deg, + @include brick-handle-gradient( var(--brick-target-background-color), - var(--brick-target-background-color) 10px, - var(--brick-target-border-color) 10px, - var(--brick-target-border-color) 20px + var(--brick-target-border-color) ); - border-left: 1px solid var(--brick-target-border-color); - border-top: 1px solid var(--brick-target-border-color); - border-right: 1px solid var(--brick-target-border-color); } } @@ -217,16 +218,10 @@ $port-size: 10px; } .tp__source-editor__block-handle { - background: repeating-linear-gradient( - -55deg, + @include brick-handle-gradient( var(--brick-output-m3u-background-color), - var(--brick-output-m3u-background-color) 10px, - var(--brick-output-m3u-border-color) 10px, - var(--brick-output-m3u-border-color) 20px + var(--brick-output-m3u-border-color) ); - border-left: 1px solid var(--brick-output-m3u-border-color); - border-top: 1px solid var(--brick-output-m3u-border-color); - border-right: 1px solid var(--brick-output-m3u-border-color); } } @@ -238,16 +233,10 @@ $port-size: 10px; } .tp__source-editor__block-handle { - background: repeating-linear-gradient( - -55deg, + @include brick-handle-gradient( var(--brick-output-xtream-background-color), - var(--brick-output-xtream-background-color) 10px, - var(--brick-output-xtream-border-color) 10px, - var(--brick-output-xtream-border-color) 20px + var(--brick-output-xtream-border-color) ); - border-left: 1px solid var(--brick-output-xtream-border-color); - border-top: 1px solid var(--brick-output-xtream-border-color); - border-right: 1px solid var(--brick-output-xtream-border-color); } } @@ -258,16 +247,10 @@ $port-size: 10px; } .tp__source-editor__block-handle { - background: repeating-linear-gradient( - -55deg, + @include brick-handle-gradient( var(--brick-output-hdhomerun-background-color), - var(--brick-output-hdhomerun-background-color) 10px, - var(--brick-output-hdhomerun-border-color) 10px, - var(--brick-output-hdhomerun-border-color) 20px + var(--brick-output-hdhomerun-border-color) ); - border-left: 1px solid var(--brick-output-hdhomerun-border-color); - border-top: 1px solid var(--brick-output-hdhomerun-border-color); - border-right: 1px solid var(--brick-output-hdhomerun-border-color); } } @@ -278,16 +261,10 @@ $port-size: 10px; } .tp__source-editor__block-handle { - background: repeating-linear-gradient( - -55deg, + @include brick-handle-gradient( var(--brick-output-strm-background-color), - var(--brick-output-strm-background-color) 10px, - var(--brick-output-strm-border-color) 10px, - var(--brick-output-strm-border-color) 20px + var(--brick-output-strm-border-color) ); - border-left: 1px solid var(--brick-output-strm-border-color); - border-top: 1px solid var(--brick-output-strm-border-color); - border-right: 1px solid var(--brick-output-strm-border-color); } } } diff --git a/frontend/scss/app/components/source_editor/_source_editor_form.scss b/frontend/scss/app/components/source_editor/_source_editor_form.scss index 1cbb7f188..231d28a5c 100644 --- a/frontend/scss/app/components/source_editor/_source_editor_form.scss +++ b/frontend/scss/app/components/source_editor/_source_editor_form.scss @@ -4,7 +4,7 @@ $form-width: 300px; position: absolute; height: 100%; top: 0; - left:100%; + left: 100%; width: $form-width; z-index: 10; transition: all 0.4s ease; diff --git a/frontend/src/app/components/config/macros.rs b/frontend/src/app/components/config/macros.rs index 5db180d54..3d3f863ee 100644 --- a/frontend/src/app/components/config/macros.rs +++ b/frontend/src/app/components/config/macros.rs @@ -209,10 +209,10 @@ macro_rules! edit_field_number { value={instance.form.$field as i64} on_change={Callback::from(move |value: Option| { match value { - Some(value) => { - let val = u32::try_from(value).unwrap_or(0); - instance.dispatch($action(val)); - } + Some(value) => match u32::try_from(value) { + Ok(val) => instance.dispatch($action(val)), + Err(_) => return, + }, None => instance.dispatch($action(0)), } })} diff --git a/frontend/src/app/components/config/video_config_view.rs b/frontend/src/app/components/config/video_config_view.rs index 85a1a08b9..9f5a8e46b 100644 --- a/frontend/src/app/components/config/video_config_view.rs +++ b/frontend/src/app/components/config/video_config_view.rs @@ -110,7 +110,7 @@ pub fn VideoConfigView() -> Html { html! {
    - { for download_state.form.headers.iter().map(|(k,v)| html!{
  • {"- "}{k}{": "} {v}
  • }) } + { for download_state.form.headers.iter().map(|(k,v)| html!{
  • {"- "}{k}{": "} {v}
  • }) }
}