fix: tokio runtime, Enter-to-login, and server URL handling
Three bugs fixed: - No tokio reactor: glib::spawn_future_local does not provide a tokio context, so reqwest/hyper panicked at runtime. Introduce src/runtime.rs with a multi-thread tokio Runtime (init() called from main before the GTK app starts). runtime::spawn() posts the async result back to GTK via a tokio oneshot channel awaited by glib::spawn_future_local, which only polls a flag (no I/O). runtime::spawn_bg() is used for fire-and-forget background calls. - Enter key didn't submit login: connect_apply on AdwEntryRow only fires when show-apply-button is true. Switch to connect_entry_activated which fires on Return in all three login rows. - Wrong API URL: the app constructed /accounts/ClientLogin directly off the server host, yielding a 404. Add normalize_base_url() in api.rs that appends /api/greader.php when the URL doesn't already contain it, so users can enter just https://rss.example.com.
This commit is contained in:
parent
d157f3f244
commit
5dee5cc52b
6 changed files with 161 additions and 67 deletions
|
|
@ -4,6 +4,7 @@ mod article_row;
|
|||
mod credentials;
|
||||
mod login_dialog;
|
||||
mod model;
|
||||
mod runtime;
|
||||
mod window;
|
||||
|
||||
fn main() -> glib::ExitCode {
|
||||
|
|
@ -12,6 +13,10 @@ fn main() -> glib::ExitCode {
|
|||
std::env::set_var("GSETTINGS_SCHEMA_DIR", env!("GSETTINGS_SCHEMA_DIR"));
|
||||
}
|
||||
|
||||
// Start the tokio multi-thread runtime before the GTK app so that
|
||||
// reqwest/hyper can find it when API futures are spawned.
|
||||
runtime::init();
|
||||
|
||||
let app = app::FeedTheMonkeyApp::new();
|
||||
app.run()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue