Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/bot_detection_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async fn main() -> Result<()> {
)
.await?;

tokio::spawn(async move { while let Some(_) = handler.next().await {} });
tokio::spawn(async move { while handler.next().await.is_some() {} });

// Create page and apply profile
let page = browser.new_page("about:blank").await?;
Expand Down
2 changes: 1 addition & 1 deletion examples/fused_gaming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async fn main() -> Result<()> {
)
.await?;

tokio::spawn(async move { while let Some(_) = handler.next().await {} });
tokio::spawn(async move { while handler.next().await.is_some() {} });

// Visit each Fused Gaming domain
for target in TARGETS {
Expand Down
2 changes: 1 addition & 1 deletion examples/profile_demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async fn main() -> Result<()> {
)
.await?;

tokio::spawn(async move { while let Some(_) = handler.next().await {} });
tokio::spawn(async move { while handler.next().await.is_some() {} });

// Create page with stealth
let page = browser.new_page("about:blank").await?;
Expand Down
114 changes: 114 additions & 0 deletions examples/stakereload_workflow.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
//! Stakereload branding — workflow demo for stakereload.com and stakereloadxs.com
//!
//! Demonstrates the site-specific [`StakereloadWorkflow`] wrapper with per-site
//! profile presets, page-state detection, and Cloudflare challenge awareness.
//!
//! # Usage
//! ```bash
//! cargo run --example stakereload_workflow
//! ```

use anyhow::Result;
use futures::StreamExt;
use ignition::stakereload::{StakereloadSite, StakereloadWorkflow};
use ignition::{Browser, BrowserConfig, IgnitionPage, IgnitionProfile};
use std::time::Duration;

#[tokio::main]
async fn main() -> Result<()> {
println!("=== Stakereload Branding Workflow ===\n");

// Launch a single shared browser instance
let (browser, mut handler) = Browser::launch(
BrowserConfig::builder()
.viewport(None)
.build()
.map_err(|e| anyhow::anyhow!(e))?,
)
.await?;

tokio::spawn(async move { while handler.next().await.is_some() {} });

// ── Standard site ──────────────────────────────────────────────────────────
{
println!("[1/2] stakereload.com");

let profile = IgnitionProfile::stakereload().build();
println!(" Profile : {}", profile);

let page = browser.new_page("about:blank").await?;
let ignition = IgnitionPage::new(page);
ignition.apply_profile(&profile).await?;

// Settle before navigation so the bootstrap script is registered
tokio::time::sleep(Duration::from_millis(100)).await;

let wf = StakereloadWorkflow::new(ignition, StakereloadSite::Standard);
wf.open_home().await?;

let state = wf.page_state().await?;
println!(" State : {:?}", state);

match state {
ignition::stakereload::PageState::CloudflareChallenge => {
println!(" CF challenge detected — waiting up to 30 s for clearance…");
let cleared = wf
.wait_for_cf_clearance(Duration::from_secs(30), Duration::from_secs(2))
.await?;
println!(" CF cleared: {}", cleared);
}
ignition::stakereload::PageState::Ready => {
let title = wf.title().await?;
let url = wf.current_url().await?;
println!(" Title : {:?}", title);
println!(" URL : {:?}", url);
}
ignition::stakereload::PageState::Unknown => {
println!(" Page state unknown — inspect manually");
}
}
}

// ── XS site ────────────────────────────────────────────────────────────────
{
println!("\n[2/2] stakereloadxs.com");

// XS variant uses a distinct RTX 4080 fingerprint
let profile = IgnitionProfile::stakereloadxs().build();
println!(" Profile : {}", profile);

let page = browser.new_page("about:blank").await?;
let ignition = IgnitionPage::new(page);
ignition.apply_profile(&profile).await?;

tokio::time::sleep(Duration::from_millis(100)).await;

let wf = StakereloadWorkflow::new(ignition, StakereloadSite::Xs);
wf.open_home().await?;

let state = wf.page_state().await?;
println!(" State : {:?}", state);

match state {
ignition::stakereload::PageState::CloudflareChallenge => {
println!(" CF challenge detected — waiting up to 30 s for clearance…");
let cleared = wf
.wait_for_cf_clearance(Duration::from_secs(30), Duration::from_secs(2))
.await?;
println!(" CF cleared: {}", cleared);
}
ignition::stakereload::PageState::Ready => {
let title = wf.title().await?;
let url = wf.current_url().await?;
println!(" Title : {:?}", title);
println!(" URL : {:?}", url);
}
ignition::stakereload::PageState::Unknown => {
println!(" Page state unknown — inspect manually");
}
}
}

println!("\nStakereload workflow demo complete.");
Ok(())
}
2 changes: 1 addition & 1 deletion examples/stealth_bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async fn main() -> Result<()> {
)
.await?;

tokio::spawn(async move { while let Some(_) = handler.next().await {} });
tokio::spawn(async move { while handler.next().await.is_some() {} });

// CRITICAL: Create page with about:blank FIRST
println!("Creating page...");
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,7 @@ pub use crate::stealth::*;
pub mod profiles;
pub use crate::profiles::*;

pub mod stakereload;

// Re-export useful CDP types for request interception
pub use chromiumoxide_cdp::cdp::browser_protocol::network::ResourceType;
23 changes: 23 additions & 0 deletions src/profiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,29 @@ impl IgnitionProfile {
.cpu_cores(12)
}

/// Profile preset tuned for **stakereload.com**.
///
/// Identical hardware to [`fused_gaming`](Self::fused_gaming) but scoped
/// to the Standard site variant for clarity in multi-site automation code.
pub fn stakereload() -> IgnitionProfileBuilder {
Self::windows()
.gpu(Gpu::NvidiaRTX3080)
.memory_gb(16)
.cpu_cores(12)
}

/// Profile preset tuned for **stakereloadxs.com**.
///
/// Uses a slightly different RTX 4080 GPU fingerprint to present a distinct
/// hardware identity from the Standard variant, reducing cross-site
/// correlation signals that some anti-bot systems track.
pub fn stakereloadxs() -> IgnitionProfileBuilder {
Self::windows()
.gpu(Gpu::NvidiaRTX4080)
.memory_gb(16)
.cpu_cores(12)
}

// Getters
pub fn os(&self) -> Os {
self.os
Expand Down
Loading