diff --git a/src/botbrowser.rs b/src/botbrowser.rs index db76568..37f8ff8 100644 --- a/src/botbrowser.rs +++ b/src/botbrowser.rs @@ -22,6 +22,8 @@ use std::time::{Duration, Instant}; pub const PORT: u16 = 9333; /// How long to wait for the browser to come up (estimated). const START_TIMEOUT_SECS: u64 = 20; +/// Firefox from a Snap can take much longer the first time after the computer starts (estimated). +const FIREFOX_START_TIMEOUT_SECS: u64 = 60; /// The first profile: the browser folder made before profiles existed (its logins stay). pub const DEFAULT_PROFILE: &str = "預設"; /// The person's own browser (read through accessibility, like Grok Bot's Computer Use helper): @@ -703,7 +705,7 @@ fn ensure_firefox(profile: &str, dir: &std::path::Path, first_url: Option<&str>) } c.spawn().map_err(|e| format!("打不開 Firefox:{e}"))?; let start = Instant::now(); - while start.elapsed() < Duration::from_secs(START_TIMEOUT_SECS) { + while start.elapsed() < Duration::from_secs(FIREFOX_START_TIMEOUT_SECS) { if let Some(p) = firefox_port(dir) { return Ok(("Firefox", p, true)); }