-
-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add Microsoft Edge browser support #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||||||||||||||||||||||||||||
| use anyhow::{anyhow, bail, Result}; | ||||||||||||||||||||||||||||||
| use std::path::{Path, PathBuf}; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| /// Resolve the WebSocket URL for connecting to Chrome. | ||||||||||||||||||||||||||||||
| /// Resolve the WebSocket URL for connecting to Chrome or Edge. | ||||||||||||||||||||||||||||||
| /// | ||||||||||||||||||||||||||||||
| /// Priority: | ||||||||||||||||||||||||||||||
| /// 1. Explicit --ws-endpoint | ||||||||||||||||||||||||||||||
|
|
@@ -31,9 +31,9 @@ fn read_devtools_active_port(user_data_dir: &Path) -> Result<String> { | |||||||||||||||||||||||||||||
| let content = std::fs::read_to_string(&port_path).map_err(|_| { | ||||||||||||||||||||||||||||||
| anyhow!( | ||||||||||||||||||||||||||||||
| "Could not read DevToolsActivePort at {}\n\n\ | ||||||||||||||||||||||||||||||
| Make sure Chrome is running with remote debugging enabled:\n\ | ||||||||||||||||||||||||||||||
| 1. Open Chrome\n\ | ||||||||||||||||||||||||||||||
| 2. Go to chrome://inspect/#remote-debugging\n\ | ||||||||||||||||||||||||||||||
| Make sure Chrome or Edge is running with remote debugging enabled:\n\ | ||||||||||||||||||||||||||||||
| 1. Open Chrome/Edge\n\ | ||||||||||||||||||||||||||||||
| 2. Go to chrome://inspect/#remote-debugging (or edge://inspect/#remote-debugging)\n\ | ||||||||||||||||||||||||||||||
| 3. Enable the remote debugging server", | ||||||||||||||||||||||||||||||
| port_path.display() | ||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||
|
|
@@ -57,25 +57,28 @@ fn read_devtools_active_port(user_data_dir: &Path) -> Result<String> { | |||||||||||||||||||||||||||||
| .map_err(|_| anyhow!("Invalid port '{}' in DevToolsActivePort", lines[0]))?; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| if port == 0 { | ||||||||||||||||||||||||||||||
| bail!("Port 0 in DevToolsActivePort — Chrome may not be running"); | ||||||||||||||||||||||||||||||
| bail!("Port 0 in DevToolsActivePort — browser may not be running"); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| let path = lines[1]; | ||||||||||||||||||||||||||||||
| Ok(format!("ws://127.0.0.1:{port}{path}")) | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| /// Get the default Chrome user data directory for the given channel. | ||||||||||||||||||||||||||||||
| /// Get the default browser user data directory for the given channel. | ||||||||||||||||||||||||||||||
| fn default_chrome_user_data_dir(channel: &str) -> Result<PathBuf> { | ||||||||||||||||||||||||||||||
| #[cfg(target_os = "macos")] | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| let home = dirs::home_dir().ok_or_else(|| anyhow!("Cannot determine home directory"))?; | ||||||||||||||||||||||||||||||
| let base = home.join("Library/Application Support/Google"); | ||||||||||||||||||||||||||||||
| let dir = match channel { | ||||||||||||||||||||||||||||||
|
Comment on lines
68
to
72
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||||||||||||||||||||||||||
| "stable" | "chrome" => base.join("Chrome"), | ||||||||||||||||||||||||||||||
| "beta" => base.join("Chrome Beta"), | ||||||||||||||||||||||||||||||
| "canary" => base.join("Chrome Canary"), | ||||||||||||||||||||||||||||||
| "dev" => base.join("Chrome Dev"), | ||||||||||||||||||||||||||||||
| _ => bail!("Unknown Chrome channel: {channel}"), | ||||||||||||||||||||||||||||||
| "stable" | "chrome" => home.join("Library/Application Support/Google/Chrome"), | ||||||||||||||||||||||||||||||
| "beta" => home.join("Library/Application Support/Google/Chrome Beta"), | ||||||||||||||||||||||||||||||
| "canary" => home.join("Library/Application Support/Google/Chrome Canary"), | ||||||||||||||||||||||||||||||
| "dev" => home.join("Library/Application Support/Google/Chrome Dev"), | ||||||||||||||||||||||||||||||
| "edge" => home.join("Library/Application Support/Microsoft Edge"), | ||||||||||||||||||||||||||||||
| "edge-beta" => home.join("Library/Application Support/Microsoft Edge Beta"), | ||||||||||||||||||||||||||||||
| "edge-canary" => home.join("Library/Application Support/Microsoft Edge Canary"), | ||||||||||||||||||||||||||||||
| "edge-dev" => home.join("Library/Application Support/Microsoft Edge Dev"), | ||||||||||||||||||||||||||||||
| _ => bail!("Unknown browser channel: {channel}. Valid: stable, beta, canary, dev, edge, edge-beta, edge-canary, edge-dev"), | ||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||
| Ok(dir) | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
@@ -88,7 +91,11 @@ fn default_chrome_user_data_dir(channel: &str) -> Result<PathBuf> { | |||||||||||||||||||||||||||||
| "beta" => home.join(".config/google-chrome-beta"), | ||||||||||||||||||||||||||||||
| "canary" => home.join(".config/google-chrome-unstable"), | ||||||||||||||||||||||||||||||
| "dev" => home.join(".config/google-chrome-unstable"), | ||||||||||||||||||||||||||||||
| _ => bail!("Unknown Chrome channel: {channel}"), | ||||||||||||||||||||||||||||||
| "edge" => home.join(".config/microsoft-edge"), | ||||||||||||||||||||||||||||||
| "edge-beta" => home.join(".config/microsoft-edge-beta"), | ||||||||||||||||||||||||||||||
| "edge-canary" => home.join(".config/microsoft-edge-canary"), | ||||||||||||||||||||||||||||||
| "edge-dev" => home.join(".config/microsoft-edge-dev"), | ||||||||||||||||||||||||||||||
| _ => bail!("Unknown browser channel: {channel}. Valid: stable, beta, canary, dev, edge, edge-beta, edge-canary, edge-dev"), | ||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||
| Ok(dir) | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
@@ -97,13 +104,17 @@ fn default_chrome_user_data_dir(channel: &str) -> Result<PathBuf> { | |||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| let local_app_data = | ||||||||||||||||||||||||||||||
| std::env::var("LOCALAPPDATA").map_err(|_| anyhow!("LOCALAPPDATA not set"))?; | ||||||||||||||||||||||||||||||
| let base = PathBuf::from(local_app_data).join("Google"); | ||||||||||||||||||||||||||||||
| let base = PathBuf::from(&local_app_data); | ||||||||||||||||||||||||||||||
| let dir = match channel { | ||||||||||||||||||||||||||||||
| "stable" | "chrome" => base.join("Chrome/User Data"), | ||||||||||||||||||||||||||||||
| "beta" => base.join("Chrome Beta/User Data"), | ||||||||||||||||||||||||||||||
| "canary" => base.join("Chrome SxS/User Data"), | ||||||||||||||||||||||||||||||
| "dev" => base.join("Chrome Dev/User Data"), | ||||||||||||||||||||||||||||||
| _ => bail!("Unknown Chrome channel: {channel}"), | ||||||||||||||||||||||||||||||
| "stable" | "chrome" => base.join("Google/Chrome/User Data"), | ||||||||||||||||||||||||||||||
| "beta" => base.join("Google/Chrome Beta/User Data"), | ||||||||||||||||||||||||||||||
| "canary" => base.join("Google/Chrome SxS/User Data"), | ||||||||||||||||||||||||||||||
| "dev" => base.join("Google/Chrome Dev/User Data"), | ||||||||||||||||||||||||||||||
| "edge" => base.join("Microsoft/Edge/User Data"), | ||||||||||||||||||||||||||||||
| "edge-beta" => base.join("Microsoft/Edge Beta/User Data"), | ||||||||||||||||||||||||||||||
| "edge-canary" => base.join("Microsoft/Edge SxS/User Data"), | ||||||||||||||||||||||||||||||
| "edge-dev" => base.join("Microsoft/Edge Dev/User Data"), | ||||||||||||||||||||||||||||||
| _ => bail!("Unknown browser channel: {channel}. Valid: stable, beta, canary, dev, edge, edge-beta, edge-canary, edge-dev"), | ||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||
| Ok(dir) | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Daemon path docs should not hardcode
/tmpon Unix.The implementation uses
std::env::temp_dir()(src/protocol.rs), so Unix paths are not guaranteed to be/tmp/.... Please document these as system temp-dir paths to avoid debugging confusion.Suggested doc patch
📝 Committable suggestion
🤖 Prompt for AI Agents