mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-27 21:08:00 +00:00
* feat(webview): zero-injection CDP migration for 5 providers
Moves the per-provider webview scraping path off injected JS and onto
CDP for the cef runtime. The 5 migrated providers (whatsapp, telegram,
slack, discord, browserscan) now load with zero initialization_script;
their UA fingerprint, DOM chat-list scraping, and multi-account target
matching all run through the Chrome DevTools Protocol.
Shared infrastructure in new `cdp/` module: CdpConn, Snapshot walker
(generic DOMSnapshot.captureSnapshot), UaSpec + setUserAgentOverride
helper, per-account session opener that keeps a long-lived CDP session
attached so the UA override stays resident for the lifetime of the
webview. Webview opens at a data:text/html placeholder, CDP applies UA
override, then Page.navigate drives it to the real provider URL with a
`#openhuman-account-{id}` fragment used by all scanners for
multi-account disambiguation (replaces Telegram's title-marker JS).
Per-provider dom_snapshot.rs files for telegram/slack/discord replicate
the WhatsApp scraper pattern. Emit the same `webview:event` ingest
envelope the old recipes used so the frontend is unchanged.
Deferred (kept JS-injected, separate PRs):
- gmail/linkedin: no Rust scanner yet
- google-meet: 535-line lifecycle + captions recipe
- idb.rs `Runtime.callFunctionOn` serializer: audit listed as future work
Also removes the unused `webview_account_eval` Tauri command.
Wry builds retain the legacy ua_spoof.js + runtime.js + recipe.js path
where those files still exist (no wry-specific regressions introduced).
* fix(release): enable Ubuntu 22.04 platform support in release workflow
Uncommented and configured the Ubuntu 22.04 platform in the release workflow to support the x86_64-unknown-linux-gnu target. This change enhances cross-platform compatibility for the release process.
* fix(webview): address CodeRabbit review comments
- session.rs: boundary-check the `starts_with(real_url)` match so
`https://discord.com` can't accidentally match `https://discord.com.evil/…`
when deciding whether to skip Page.navigate.
- session.rs: drop unused `_app: AppHandle<R>` parameter from spawn_session
(and its generic R); update the webview_accounts call site accordingly.
- session.rs: document the non-graceful shutdown path (cancellation token
left as a follow-up).
- discord/slack/telegram scanners: import CDP_HOST/CDP_PORT from the shared
`cdp` module instead of redeclaring them. (whatsapp_scanner keeps its
locals — the module isn't cef-gated so it can't pull from cef-only cdp::.)
- webview_accounts/mod.rs: collapse the duplicate provider_is_supported
check with provider_url into one early-return.
- emulation.rs: add a TODO documenting when/how to refresh the hardcoded
Chrome UA fingerprint fields.
- discord/slack/telegram dom_snapshot: hash every row for change detection
(was capped at first 5–8 — a reorder past that limit wouldn't invalidate
the cache).
- discord_scanner/dom_snapshot: simplify is_channel_row (single
attr lookup); tighten the pure-unread-marker comment (dropped the
obsolete recipe.js cross-reference).
- slack_scanner/dom_snapshot: align find_badge with the Discord behavior
(empty badge text → Some(0), matching the marker-present-but-no-count
semantics).
Deferred (explicitly called out in the PR): shared CdpConn dedup across
scanners, shared DomScan/ChannelRow types across provider dom_snapshot
files, graceful session shutdown, table-driven scanner startup macro.
* fix(webview): CR round-2 — session teardown, exact target match, real-url validation
- cdp/session.rs: use exact equality for the per-account target match
(`t.title == marker || t.url.ends_with(&fragment)`), so
`…account-abc` can't be mistaken for `…account-abcdef`. Scanners
(whatsapp/telegram/slack/discord) also switched from `url.contains` to
`url.ends_with` on the fragment for the same reason.
- cdp/session.rs: `spawn_session` now returns `JoinHandle<()>`.
- webview_accounts: store the CDP session handle keyed by account_id in
`WebviewAccountsState.cdp_sessions`, abort any prior handle before
spawning a new one on re-open, and abort on close/purge so reopen
cycles don't stack live CDP loops.
- webview_accounts: validate `real_url_str` as a `Url` up front (was
only validating the placeholder), so a malformed `args.url` fails the
command instead of crashing the async session loop later.
- webview_accounts: `provider_is_supported` now derives from
`provider_url` (single canonical registry, no drift).
- telegram_scanner/dom_snapshot: row ids now always include `idx`, so
two chats with the same display name don't collide into one id.
* fix(webview): CR round-3 — scanner prefix, empty-rows emit, wry UA fallback
- DOM poll: drop `!scan.rows.is_empty()` guard in discord/slack/telegram
fast-ticks so the zero-unread transition (last chat read) still emits a
hash-change snapshot. Consumers lose the "clearing" state otherwise.
- webview_accounts: derive `scanner_url_prefix` from the validated
`real_url`'s origin (via `Url::origin().ascii_serialization()`), not
the static `provider_url(...)`. Debug `args.url` overrides and
alternate hosts now drive the scanner target match correctly.
- webview_accounts: cfg-split `build_init_script`. Under cef, migrated
providers return an empty script (zero injection, unchanged). Under
wry, migrated providers that fingerprint on `navigator.*` still ship
`ua_spoof.js` even though their recipe is gone — the previous early
return dropped the UA shim, which would regress Slack/Google login
gates on wry dev builds.