Compare commits

..

5 Commits

Author SHA1 Message Date
spinline
1c2fa499b8 fix: remove modal module declaration from components/mod.rs
All checks were successful
Build MIPS Binary / build (push) Successful in 5m21s
2026-02-09 21:59:33 +03:00
spinline
f121d5b220 fix: remove unused Modal component
Some checks failed
Build MIPS Binary / build (push) Failing after 1m18s
2026-02-09 21:51:40 +03:00
spinline
449227d019 fix: move #[allow(dead_code)] after #[component] in modal.rs
Some checks failed
Build MIPS Binary / build (push) Has been cancelled
2026-02-09 21:48:26 +03:00
spinline
bc47a4ac5c fix: SSE connection not starting after login
Some checks failed
Build MIPS Binary / build (push) Has been cancelled
- Move SSE initialization inside Effect closure to capture signals properly
- Fix closure capture issue where torrents/stats/notifications were borrowed before being passed to async block
- SSE now starts correctly when user is authenticated
2026-02-09 21:45:36 +03:00
spinline
a3bf33aee4 fix: remove unused scgi import from backend
Some checks failed
Build MIPS Binary / build (push) Has been cancelled
2026-02-09 21:41:31 +03:00
4 changed files with 17 additions and 60 deletions

View File

@@ -6,7 +6,7 @@ mod push;
mod rate_limit;
mod sse;
use shared::{scgi, xmlrpc};
use shared::xmlrpc;
use axum::error_handling::HandleErrorLayer;
use axum::{

View File

@@ -1,6 +1,5 @@
pub mod context_menu;
pub mod layout;
pub mod modal;
pub mod toast;
pub mod torrent;
pub mod auth;

View File

@@ -1,55 +0,0 @@
use leptos::prelude::*;
#[allow(dead_code)]
#[component]
pub fn Modal(
#[prop(into)] title: String,
children: ChildrenFn,
#[prop(into)] on_confirm: Callback<()>,
#[prop(into)] on_cancel: Callback<()>,
#[prop(into)] visible: Signal<bool>,
#[prop(into, default = "Confirm".to_string())] confirm_text: String,
#[prop(into, default = "Cancel".to_string())] cancel_text: String,
#[prop(into, default = false)] is_danger: bool,
) -> impl IntoView {
let title = StoredValue::new_local(title);
let on_confirm = StoredValue::new_local(on_confirm);
let on_cancel = StoredValue::new_local(on_cancel);
let confirm_text = StoredValue::new_local(confirm_text);
let cancel_text = StoredValue::new_local(cancel_text);
view! {
<Show when=move || visible.get() fallback=|| ()>
<div class="fixed inset-0 bg-background/80 backdrop-blur-sm flex items-end md:items-center justify-center z-[200] animate-in fade-in duration-200 sm:p-4">
<div class="bg-card p-6 rounded-t-2xl md:rounded-lg w-full max-w-sm shadow-xl border border-border ring-0 transform transition-all animate-in slide-in-from-bottom-10 md:slide-in-from-bottom-0 md:zoom-in-95">
<h3 class="text-lg font-semibold text-card-foreground mb-4">{move || title.get_value()}</h3>
<div class="text-muted-foreground mb-6 text-sm">
{children()}
</div>
<div class="flex justify-end gap-3">
<button
class="inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2"
on:click=move |_| on_cancel.with_value(|cb| cb.run(()))
>
{move || cancel_text.get_value()}
</button>
<button
class=move || crate::utils::cn(format!("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 h-10 px-4 py-2 {}",
if is_danger { "bg-destructive text-destructive-foreground hover:bg-destructive/90" }
else { "bg-primary text-primary-foreground hover:bg-primary/90" }
))
on:click=move |_| {
log::info!("Modal: Confirm clicked");
on_confirm.with_value(|cb| cb.run(()))
}
>
{move || confirm_text.get_value()}
</button>
</div>
</div>
</div>
</Show>
}
}

View File

@@ -107,11 +107,24 @@ pub fn provide_torrent_store() {
let store = TorrentStore { torrents, filter, search_query, global_stats, notifications, user };
provide_context(store);
// SSE Connection
Effect::new(move |_| {
if user.get().is_none() { return; }
let notifications_for_effect = notifications;
let global_stats_for_effect = global_stats;
let torrents_for_effect = torrents;
let show_browser_notification = show_browser_notification.clone();
Effect::new(move |_| {
let user_val = user.get();
if user_val.is_none() {
return;
}
let notifications = notifications_for_effect;
let global_stats = global_stats_for_effect;
let torrents = torrents_for_effect;
let show_browser_notification = show_browser_notification.clone();
log::info!("SSE: Starting connection (user logged in)");
leptos::task::spawn_local(async move {
let mut backoff_ms: u32 = 1000;
let mut was_connected = false;