use runtime_foxdriver::browser::{FoxBrowserConfig, Page};
mod inject;
mod reynard;
mod userjs;
pub use inject::{apply_default_stealth_profile, apply_stealth, apply_stealth_profile};
pub use reynard::{
align_ua_to_engine, identity_seed, launch_reynard, launch_reynard_with_config, reynard_config,
reynard_config_env, reynard_engine_major, REYNARD_CONFIG_ENV,
};
pub use userjs::{automation_prefs, build_user_js};
pub async fn launch_profiled_firefox(
mut config: FoxBrowserConfig,
profile: &crate::StealthProfile,
) -> anyhow::Result<Page> {
let overrides = crate::profile_to_overrides(profile);
let user_js = build_user_js(&overrides);
config.user_js_content = Some(match config.user_js_content {
Some(existing) => format!("{}\n{}", existing, user_js),
None => user_js,
});
let page = runtime_foxdriver::browser::launch_firefox(config).await?;
apply_stealth_profile(&page, profile).await?;
let fp_config = crate::fingerprint::FingerprintConfig::default();
let _ = crate::fingerprint::apply_fingerprint(&page, &fp_config).await;
Ok(page)
}
pub async fn launch_default_profiled_firefox(
config: FoxBrowserConfig,
) -> anyhow::Result<Page> {
launch_profiled_firefox(config, &crate::StealthProfile::FirefoxLinux).await
}