feat(webview): append Anthias version to the User-Agent - #3102
Conversation
There was a problem hiding this comment.
Pull request overview
This PR makes Anthias traffic identifiable to receiving services by appending an Anthias/<version> product token to QtWebEngine’s default User-Agent, with the version injected into the webview subprocess environment by the Python viewer.
Changes:
- Update the QtWebEngine default profile User-Agent to append
Anthias/<version>(falls back tounknown). - Inject
ANTHIAS_VERSIONinto the spawned webview subprocess environment via_build_webview_env(). - Add debug logging for the final User-Agent string.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/anthias_webview/src/view.cpp | Appends Anthias/<version> to QtWebEngine’s default User-Agent using ANTHIAS_VERSION from the environment. |
| src/anthias_viewer/init.py | Sets ANTHIAS_VERSION from get_anthias_release() in the env passed to the webview subprocess. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ffb77b0 to
4ba588d
Compare
- Add an "Anthias/<version>" product token to QtWebEngine's default User-Agent so requests still read as Mozilla/Chrome/Safari while identifying the source screen and release - Inject ANTHIAS_VERSION into the webview env from get_anthias_release(), falling back to "unknown" when unavailable Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
4ba588d to
5393754
Compare
|
| # Pass the Anthias product token ("Anthias/<version>") to the C++ | ||
| # webview, which appends it to QtWebEngine's User-Agent (see the | ||
| # profile setup in src/anthias_webview/src/view.cpp). Composed by the | ||
| # canonical get_anthias_product_token() helper so the format lives in | ||
| # one place. Set unconditionally — before the board-specific early | ||
| # returns below — so every platform plugin gets it and any stale | ||
| # inherited value is overwritten. | ||
| env['ANTHIAS_UA_TOKEN'] = get_anthias_product_token() |
On-device UA verificationDrove the live
Both keep the full |



Issues Fixed
No associated issue. The Qt webview used QtWebEngine's default User-Agent, so outbound page/subresource requests were indistinguishable from generic Chromium — ops on the receiving end couldn't tell traffic came from an Anthias screen or which release.
Description
Append an
Anthias/<version>product token to QtWebEngine's default User-Agent. The string still reads as a normal browser (Mozilla/5.0 … Chrome/… Safari/… Anthias/2026.6.3), preserving site compatibility while making Anthias traffic identifiable.anthias_common/http.py— newget_anthias_product_token()is the single source of truth for theAnthias/<version>label (and itsunknownfallback).get_user_agent()now builds on it, so the format lives in one place.anthias_viewer/__init__.py—_build_webview_env()composes the token via that helper and passes it to the webview through theANTHIAS_UA_TOKENenv var. Set unconditionally, before the board-specific early returns, so every platform plugin gets it and any stale inherited value is overwritten.anthias_webview/src/view.cpp— readsANTHIAS_UA_TOKENand appends it verbatim toprofile->httpUserAgent(). No token-format logic in C++.Resulting UA:
Mozilla/5.0 … Chrome/… Safari/… Anthias/<version>— valid per RFC 9110 §10.1.5 (product = token ["/" product-version]).Verification. Compile-verified on both Qt majors via the image builder — Qt6 (x86) and Qt5 (pi3 armhf):
view.cpprecompiled from source on each toolchain and theANTHIAS_UA_TOKENsymbol confirmed present in eachAnthiasViewerbinary (oldANTHIAS_VERSIONabsent). Unit tests added for the token helper (tests/test_http.py) and the env injection (tests/test_viewer.py); full local run green.Checklist
🤖 Generated with Claude Code