Files
obscura/crates/obscura-js/Cargo.toml
T
SGavrl cdd52ade43 render: PNG screenshots via CLI and CDP
End-to-end rasterization behind the render feature (which now enables
obscura-render/paint):

- obscura-render: screenshot_png(dom, viewport) paints and encodes to PNG
  via tiny-skia's encode_png (no extra dep).
- obscura-browser: Page::screenshot renders the live DOM at a viewport.
- CLI: obscura fetch --screenshot out.png writes the settled page to a PNG.
- CDP: Page.captureScreenshot returns the PNG base64-encoded, so
  Puppeteer/Playwright page.screenshot() works. captureSnapshot still
  errors (it is a DOM/layer snapshot, not an image).

Verified: both paths produce correct 1280x720 RGBA PNGs with elements
laid out and colored as the CSS specifies (block stacking, backgrounds,
white page). Default build unchanged; obstacle course 33/33.

Text, borders, and images are not yet painted; the box layout and
background colors are rendered.
2026-07-01 21:34:15 +00:00

49 lines
1.6 KiB
TOML

[package]
name = "obscura-js"
version.workspace = true
edition.workspace = true
[features]
default = []
# Builds obscura-net with its stealth (wreq) HTTP client and lets scripted
# fetch()/XHR be routed through it so JS-level requests carry the same Chrome
# TLS fingerprint and client hints as stealth navigation.
stealth = ["obscura-net/stealth"]
# Builds the obscura-render layout layer and exposes real box geometry to JS
# (getBoundingClientRect, elementFromPoint, offset*), and with paint enabled,
# rasterizes screenshots. Off by default so the scraping build stays lean.
render = ["dep:obscura-render", "obscura-render/paint"]
[build-dependencies]
deno_core = "0.350"
[dependencies]
obscura-dom = { workspace = true }
obscura-net = { workspace = true }
deno_core = "0.350"
tokio = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
url = { workspace = true }
tracing = { workspace = true }
thiserror = { workspace = true }
anyhow = { workspace = true }
reqwest = { workspace = true }
html5ever = { workspace = true }
deno_error = "0.6"
base64 = { workspace = true }
sha1 = "0.10"
sha2 = "0.10"
# WebCrypto (crypto.subtle) primitives. RustCrypto, pure Rust, no CMake/OpenSSL,
# and they unify on the digest 0.10 / cipher 0.4 stack already in the tree.
hmac = "0.12"
aes = "0.8"
aes-gcm = "0.10"
cbc = { version = "0.1", features = ["alloc"] }
ctr = "0.9"
pbkdf2 = { version = "0.12", default-features = false, features = ["hmac"] }
hkdf = "0.12"
# CSPRNG for getRandomValues / randomUUID (replaces Math.random).
getrandom = "0.2"
obscura-render = { workspace = true, optional = true }