diff --git a/crates/lib/artcraft_client_identity/src/user_agents.rs b/crates/lib/artcraft_client_identity/src/user_agents.rs index 254289b105..d4c54aeab5 100644 --- a/crates/lib/artcraft_client_identity/src/user_agents.rs +++ b/crates/lib/artcraft_client_identity/src/user_agents.rs @@ -5,6 +5,11 @@ pub const ARTCRAFT_DESKTOP_USER_AGENT: &str = "storyteller-client/1.0"; /// `User-Agent` sent to third parties: the default of the OS webview Tauri runs on /// (WKWebView on macOS, WebView2 on Windows, WebKitGTK on Linux). +/// +/// NB: These are hardcoded snapshots and WILL go out of date as the OS webviews update +/// (especially WebView2's Chrome/Edge version, which auto-updates on Windows). Rust can't read +/// the webview's real `navigator.userAgent`, so refresh these periodically by checking +/// `navigator.userAgent` in the desktop app's devtools on each OS. #[cfg(target_os = "macos")] pub const WEBVIEW_USER_AGENT: &str = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)"; diff --git a/docs/desktop-session-regression.md b/docs/desktop-session-regression.md index f6da64adbc..28a87afb90 100644 --- a/docs/desktop-session-regression.md +++ b/docs/desktop-session-regression.md @@ -35,6 +35,10 @@ values from one place, `crates/lib/artcraft_client_identity` - The native Rust client (`artcraft_client`) sends the Origin and User-Agent on every API request via `storyteller_client_builder`; it previously sent no Origin. +- The "OS webview" User-Agents are hardcoded snapshots in + `artcraft_client_identity/src/user_agents.rs` and go out of date as the + webviews update (notably WebView2's Edge version on Windows). Refresh them + from `navigator.userAgent` in the desktop app's devtools on each OS. - The vendored HTTP plugin only replaces the webview's own origin (packaged `tauri://localhost` etc., or a loopback Vite origin), and only sets the User-Agent when the frontend didn't.