cli: make --stealth a global flag, available on every subcommand

--stealth was a per-subcommand flag defined separately on fetch, serve,
and mcp, and missing from scrape entirely. You could not enable stealth
for parallel scraping, and `obscura --stealth fetch` (flag before the
subcommand) errored.

Promote --stealth to a single global flag like --proxy, so it is valid
before or after any subcommand and applies uniformly to fetch, serve,
scrape, and mcp. scrape now forwards it to its workers via OBSCURA_STEALTH
(mirroring OBSCURA_PROXY), and the bare `obscura` default CDP server
honors it too.

Verified: navigating directly to a blocklisted tracker renders 55503
chars without stealth and 39 (blocked) with it, identically on fetch and
scrape. Obstacle course 33/33.
This commit is contained in:
SGavrl committed 2026-06-24 09:46:10 +00:00
1 parent d2206fea84
commit 8c14c4393d
2 files changed
+18 -16

No files matched your search

+4 -1
View File
@@ -51,7 +51,10 @@ async fn main() {
.ok()
.map(|value| value.trim().to_string())
.filter(|value| !value.is_empty());
let context = Arc::new(BrowserContext::with_options("worker".to_string(), proxy, false));
let stealth = std::env::var("OBSCURA_STEALTH")
.map(|v| matches!(v.trim(), "1" | "true" | "yes" | "on"))
.unwrap_or(false);
let context = Arc::new(BrowserContext::with_options("worker".to_string(), proxy, stealth));
let mut page = Page::new("page-1".to_string(), context);
let stdin = tokio::io::stdin();