1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
use { chromiumoxide::{ browser::{Browser, BrowserConfig}, handler::Handler, }, std::{process, time::Duration} }; use crate::errors; pub async fn config(timeout: u64) -> (Browser, Handler) { Browser::launch( match BrowserConfig::builder() .request_timeout(Duration::from_secs(timeout)) .build() { Ok(res) => res, Err(err) => { errors::show(err); process::exit(1) }, }) .await .unwrap_or_else(|err| { errors::show(format!("Unable to launch browser: {}.", err)); process::exit(1) }) }