├── .prettierrc.yml ├── FUNDING.yml ├── changelog_generator ├── .gitignore ├── Cargo.toml ├── src │ └── main.rs └── Cargo.lock ├── assets ├── bichrome_icon.icns ├── bichrome_icon.ico ├── bichrome_icon.png ├── bichrome.app │ └── Contents │ │ ├── MacOS │ │ └── bichrome │ │ ├── Resources │ │ └── bichrome_icon.icns │ │ └── Info.plist ├── README.md └── changelog-template.md ├── .vscode ├── extensions.json ├── settings.json └── launch.json ├── sign.ps1 ├── .gitignore ├── .changelog.yml ├── .github └── workflows │ ├── checks.yml │ ├── build.yml │ └── publish.yml ├── src ├── main.rs ├── chrome_local_state.rs ├── config.rs ├── macos.rs └── windows.rs ├── Cargo.toml ├── LICENSE-MIT ├── example_config └── bichrome_config.json ├── README.md ├── LICENSE-APACHE └── Cargo.lock /.prettierrc.yml: -------------------------------------------------------------------------------- 1 | tabWidth: 4 -------------------------------------------------------------------------------- /FUNDING.yml: -------------------------------------------------------------------------------- 1 | ko_fi: jorgenpt 2 | github: jorgenpt 3 | -------------------------------------------------------------------------------- /changelog_generator/.gitignore: -------------------------------------------------------------------------------- 1 | ## Rust 2 | /target -------------------------------------------------------------------------------- /assets/bichrome_icon.icns: -------------------------------------------------------------------------------- 1 | bichrome.app/Contents/Resources/bichrome_icon.icns -------------------------------------------------------------------------------- /assets/bichrome_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jorgenpt/bichrome/HEAD/assets/bichrome_icon.ico -------------------------------------------------------------------------------- /assets/bichrome_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jorgenpt/bichrome/HEAD/assets/bichrome_icon.png -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "matklad.rust-analyzer" 4 | ] 5 | } -------------------------------------------------------------------------------- /assets/bichrome.app/Contents/MacOS/bichrome: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jorgenpt/bichrome/HEAD/assets/bichrome.app/Contents/MacOS/bichrome -------------------------------------------------------------------------------- /assets/bichrome.app/Contents/Resources/bichrome_icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jorgenpt/bichrome/HEAD/assets/bichrome.app/Contents/Resources/bichrome_icon.icns -------------------------------------------------------------------------------- /assets/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | Big thanks to Krista A. Leemhuis for the amazing icon! 4 | 5 | The icon is copyright (c) 2021-2023 [Jørgen P. Tjernø](mailto:jorgen@tjer.no). All Rights Reserved. 6 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.files.excludeDirs": [ 3 | "windows_bindings" 4 | ], 5 | "rust-analyzer.checkOnSave.command": "clippy", 6 | "yaml.schemas": { 7 | "https://json.schemastore.org/github-workflow.json": ".github/workflows/build.yml" 8 | } 9 | } -------------------------------------------------------------------------------- /changelog_generator/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "changelog_generator" 3 | version = "0.1.0" 4 | authors = ["Jørgen P. Tjernø "] 5 | edition = "2018" 6 | 7 | [dependencies] 8 | anyhow = "^1" 9 | tinytemplate = "1.2" 10 | serde = "1.0" 11 | serde_derive = "1.0" 12 | 13 | [dependencies.git-changelog] 14 | default-features = false 15 | git = "https://github.com/aldrin/git-changelog" -------------------------------------------------------------------------------- /sign.ps1: -------------------------------------------------------------------------------- 1 | # Determine the path of the latest installed Windows 10 SDK by sorting the names of the directories as if they are version objects 2 | $latestSdkPath = Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin" -Filter "10.*" | Sort "{[version] $_}" | Select-Object -Last 1 3 | $signToolExe = $latestSdkPath.FullName + "\x64\signtool.exe" 4 | 5 | & $signToolExe sign /n "Open Source Developer, Joergen Tjernoe" /t http://time.certum.pl/ /fd sha1 /v @args -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Bichrome 2 | /bichrome.log 3 | 4 | ## Rust 5 | /target 6 | 7 | ## Entries from https://github.com/github/gitignore/blob/eefa65c924329ad918985713cdb195e6bc68744b/Global/VisualStudioCode.gitignore 8 | .vscode/* 9 | !.vscode/settings.json 10 | !.vscode/tasks.json 11 | !.vscode/launch.json 12 | !.vscode/extensions.json 13 | *.code-workspace 14 | 15 | # Local History for Visual Studio Code 16 | .history/ 17 | 18 | # Release body for GH releases 19 | gh-release.md -------------------------------------------------------------------------------- /.changelog.yml: -------------------------------------------------------------------------------- 1 | # Configuration for git-changelog (https://github.com/aldrin/git-changelog) 2 | conventions: 3 | categories: 4 | - {tag: "break", title: "Breaking Change"} 5 | - {tag: "feature", title: "Feature"} 6 | - {tag: "improve", title: "Improvement"} 7 | - {tag: "fix", title: "Fix"} 8 | scopes: 9 | - {tag: "", title: "General"} 10 | - {tag: "win", title: "Windows"} 11 | - {tag: "mac", title: "macOS"} 12 | output: 13 | post_processors: 14 | - {lookup: "GH-(?P\\d+)", replace: "[GH-$id](https://github.com/jorgenpt/bichrome/issues/$id)"} 15 | -------------------------------------------------------------------------------- /.github/workflows/checks.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | pull_request: 4 | 5 | name: Clippy check 6 | jobs: 7 | clippy_check: 8 | runs-on: ${{ matrix.os }} 9 | 10 | strategy: 11 | fail-fast: false 12 | matrix: 13 | os: [windows-latest, macos-latest] 14 | 15 | steps: 16 | - uses: actions/checkout@v4 17 | - uses: actions/cache@v4 18 | with: 19 | path: | 20 | ~/.cargo/registry 21 | ~/.cargo/git 22 | target 23 | changelog_generator/target 24 | key: ${{ runner.os }}-clippy_cargo-${{ hashFiles('**/Cargo.lock') }} 25 | restore-keys: | 26 | ${{ runner.os }}-clippy_cargo- 27 | - run: rustup component add clippy 28 | - uses: actions-rs/clippy-check@v1 29 | with: 30 | token: ${{ secrets.GITHUB_TOKEN }} 31 | args: --all-features 32 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | pull_request: 6 | 7 | env: 8 | CARGO_TERM_COLOR: always 9 | 10 | jobs: 11 | build: 12 | runs-on: ${{ matrix.os }} 13 | 14 | strategy: 15 | fail-fast: false 16 | matrix: 17 | os: [windows-latest, macos-latest] 18 | 19 | steps: 20 | - uses: actions/checkout@v4 21 | - uses: actions/cache@v4 22 | with: 23 | path: | 24 | ~/.cargo/registry 25 | ~/.cargo/git 26 | target 27 | changelog_generator/target 28 | key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} 29 | restore-keys: | 30 | ${{ runner.os }}-cargo- 31 | - name: Build (bichrome) 32 | run: cargo build --verbose 33 | - name: Build (changelog_generator) 34 | run: cargo build --verbose --manifest-path changelog_generator/Cargo.toml 35 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | #![deny(clippy::all)] 2 | // We use the console subsystem in debug builds, but use the Windows subsystem in release 3 | // builds so we don't have to allocate a console and pop up a command line window. 4 | // This needs to live in main.rs rather than windows.rs because it needs to be a crate-level 5 | // attribute, and it doesn't affect the mac build at all, so it's innocuous to leave for 6 | // both target_os. 7 | #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] 8 | #![cfg_attr(debug_assertions, windows_subsystem = "console")] 9 | 10 | mod chrome_local_state; 11 | mod config; 12 | 13 | #[cfg(target_os = "macos")] 14 | mod macos; 15 | #[cfg(target_os = "macos")] 16 | use crate::macos as os; 17 | 18 | #[cfg(target_os = "windows")] 19 | mod windows; 20 | #[cfg(target_os = "windows")] 21 | use crate::windows as os; 22 | 23 | use anyhow::Result; 24 | use log::error; 25 | 26 | fn main() -> Result<()> { 27 | let result = os::main(); 28 | if let Err(error) = &result { 29 | error!("Encountered error: {error:?}"); 30 | } 31 | result 32 | } 33 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "bichrome" 3 | version = "0.8.0" 4 | authors = ["Jørgen P. Tjernø "] 5 | edition = "2021" 6 | license = "MIT OR Apache-2.0" 7 | 8 | [dependencies] 9 | anyhow = "^1" 10 | const_format = "0.2" 11 | log = "0.4" 12 | serde = { version = "1.0", features = ["derive"] } 13 | serde_json = "1.0" 14 | simplelog = "^0.12.1" 15 | structopt = "0.3" 16 | thiserror = "^1" 17 | url = "^2.2.0" 18 | webextension_pattern = { version = "0.3", features = ["serde"] } 19 | 20 | [target.'cfg(windows)'.dependencies] 21 | winreg = "^0.52.0" 22 | 23 | [target.'cfg(windows)'.dependencies.windows] 24 | version = "^0.52.0" 25 | features = [ 26 | "Storage", 27 | "Win32_Foundation", 28 | "Win32_UI_Shell", 29 | "Win32_UI_WindowsAndMessaging", 30 | ] 31 | 32 | [target.'cfg(target_os = "macos")'.dependencies] 33 | fruitbasket = "0.10.0" 34 | 35 | [target.'cfg(windows)'.build-dependencies] 36 | winres = "^0.1" 37 | 38 | [package.metadata.winres] 39 | OriginalFilename = "bichrome.exe" 40 | FileDescription = "bichrome" 41 | ProductName = "bichrome" 42 | LegalCopyright = "© Jørgen Tjernø " 43 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021-2023 Jørgen Tjernø 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "lldb", 9 | "request": "launch", 10 | "name": "Debug executable 'bichrome'", 11 | "cargo": { 12 | "args": [ 13 | "build", 14 | "--bin=bichrome", 15 | "--package=bichrome" 16 | ], 17 | "filter": { 18 | "name": "bichrome", 19 | "kind": "bin" 20 | } 21 | }, 22 | "args": [ 23 | "--debug", 24 | "--dry-run" 25 | ], 26 | "cwd": "${workspaceFolder}" 27 | }, 28 | { 29 | "type": "lldb", 30 | "request": "launch", 31 | "name": "Debug unit tests in executable 'bichrome'", 32 | "cargo": { 33 | "args": [ 34 | "test", 35 | "--no-run", 36 | "--bin=bichrome", 37 | "--package=bichrome" 38 | ], 39 | "filter": { 40 | "name": "bichrome", 41 | "kind": "bin" 42 | } 43 | }, 44 | "args": [], 45 | "cwd": "${workspaceFolder}" 46 | } 47 | ] 48 | } -------------------------------------------------------------------------------- /example_config/bichrome_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "default_profile": "Fallback", 3 | "profiles": { 4 | "Fallback": { 5 | "browser": "OsDefault" 6 | }, 7 | "Personal": { 8 | "browser": "Firefox" 9 | }, 10 | "Work": { 11 | "browser": "Chrome", 12 | "hosted_domain": "mycorp.com" 13 | }, 14 | "After Dark": { 15 | "browser": "Chrome", 16 | "profile": "Profile 1" 17 | }, 18 | "Most Recent Chrome Window": { 19 | "browser": "Chrome" 20 | }, 21 | "That One Profile For Edge": { 22 | "browser": "Edge", 23 | "profile": "Profile 2" 24 | }, 25 | "Video Player": { 26 | "browser": "Executable", 27 | "path": "C:/Program Files/mpv/mpv.exe" 28 | } 29 | }, 30 | "profile_selection": [ 31 | { 32 | "profile": "Personal", 33 | "pattern": "*.facebook.com" 34 | }, 35 | { 36 | "profile": "Personal", 37 | "pattern": "*.messenger.com" 38 | }, 39 | { 40 | "profile": "Work", 41 | "pattern": "*.mycorp.net" 42 | }, 43 | { 44 | "profile": "Work", 45 | "pattern": "mycorp.atlassian.net" 46 | }, 47 | { 48 | "profile": "Work", 49 | "pattern": "https://github.com/MyCorp/*" 50 | }, 51 | { 52 | "profile": "Personal", 53 | "pattern": "*.github.com" 54 | }, 55 | { 56 | "profile": "Video Player", 57 | "pattern": "*.youtube.com" 58 | }, 59 | { 60 | "profile": "Video Player", 61 | "pattern": "youtu.be" 62 | } 63 | ] 64 | } 65 | -------------------------------------------------------------------------------- /changelog_generator/src/main.rs: -------------------------------------------------------------------------------- 1 | use anyhow::{anyhow, Result}; 2 | use changelog::{ChangeLog, Configuration}; 3 | use serde_derive::Serialize; 4 | use std::env; 5 | use tinytemplate::TinyTemplate; 6 | 7 | #[derive(Serialize)] 8 | struct Context { 9 | this_version: String, 10 | repo_url: String, 11 | commits_link: String, 12 | changelog: ChangeLog, 13 | } 14 | 15 | fn main() -> Result<()> { 16 | let mut args = env::args(); 17 | let exe = args.next().expect("could not retrieve exe name"); 18 | let previous_version = args.next().ok_or(anyhow!( 19 | "usage: {} [repo base url]", 20 | exe 21 | ))?; 22 | let this_version = args.next().ok_or(anyhow!( 23 | "usage: {} [repo base url]", 24 | exe 25 | ))?; 26 | let repo_url = args.next(); 27 | 28 | let range = format!("{}..{}", previous_version, this_version); 29 | let (commits_link, repo_url) = if let Some(repo_url) = repo_url { 30 | let repo_url = repo_url.trim_end_matches('/'); 31 | 32 | ( 33 | format!( 34 | "{}/compare/{}...{}", 35 | repo_url, previous_version, this_version 36 | ), 37 | repo_url.to_string(), 38 | ) 39 | } else { 40 | (String::from("#"), String::from(".")) 41 | }; 42 | 43 | let config = Configuration::from_yaml(include_str!("../../.changelog.yml"))?; 44 | let changelog = ChangeLog::from_range(&range, &config); 45 | 46 | let mut tt = TinyTemplate::new(); 47 | tt.add_template( 48 | "changelog_template", 49 | include_str!("../../assets/changelog-template.md"), 50 | )?; 51 | 52 | let context = Context { 53 | this_version, 54 | repo_url, 55 | commits_link, 56 | changelog, 57 | }; 58 | 59 | let rendered = tt.render("changelog_template", &context)?; 60 | println!("{}", rendered); 61 | 62 | Ok(()) 63 | } 64 | -------------------------------------------------------------------------------- /src/chrome_local_state.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code)] 2 | 3 | use serde::{Deserialize, Serialize}; 4 | use std::collections::HashMap; 5 | use std::fs::File; 6 | use std::io::BufReader; 7 | use std::path::Path; 8 | use thiserror::Error; 9 | 10 | #[derive(Error, Debug)] 11 | pub enum Error { 12 | #[error("could not read Chrome Local State")] 13 | InvalidFile(#[source] std::io::Error), 14 | #[error("could not parse Chrome Local State")] 15 | InvalidJson(#[source] serde_json::Error), 16 | } 17 | 18 | type Result = std::result::Result; 19 | 20 | #[derive(Serialize, Deserialize, Debug)] 21 | pub struct ChromeProfile { 22 | hosted_domain: String, 23 | name: Option, 24 | shortcut_name: Option, 25 | } 26 | 27 | #[derive(Serialize, Deserialize, Debug)] 28 | pub struct ProfilesData { 29 | info_cache: HashMap, 30 | } 31 | 32 | impl ProfilesData { 33 | pub fn profiles_by_hosted_domain(&self, hosted_domain: &str) -> Vec<&String> { 34 | self.info_cache 35 | .iter() 36 | .filter_map(|(profile_name, profile)| { 37 | if profile.hosted_domain == hosted_domain { 38 | Some(profile_name) 39 | } else { 40 | None 41 | } 42 | }) 43 | .collect() 44 | } 45 | pub fn profile_by_name(&self, name: &str) -> Option<&str> { 46 | // Prefer direct profile name matches 47 | if let Some((profile_name, _)) = self.info_cache.get_key_value(name) { 48 | return Some(profile_name); 49 | } 50 | 51 | let matched_name = Some(name.to_owned()); 52 | let found = self.info_cache.iter().find(|(_, profile)| { 53 | profile.name == matched_name || profile.shortcut_name == matched_name 54 | }); 55 | 56 | if let Some((profile_name, _)) = found { 57 | Some(profile_name) 58 | } else { 59 | None 60 | } 61 | } 62 | } 63 | 64 | #[derive(Serialize, Deserialize)] 65 | struct State { 66 | profile: ProfilesData, 67 | } 68 | 69 | pub fn read_profiles_from_file>(path: P) -> Result { 70 | let state: State = { 71 | let file = File::open(path).map_err(Error::InvalidFile)?; 72 | let reader = BufReader::new(file); 73 | serde_json::from_reader(reader).map_err(Error::InvalidJson)? 74 | }; 75 | 76 | Ok(state.profile) 77 | } 78 | -------------------------------------------------------------------------------- /assets/changelog-template.md: -------------------------------------------------------------------------------- 1 | # bichrome {this_version} 2 | 3 | bichrome is a simple utility for Windows and macOS that you configure as your default browser, which then will choose which browser to open a URL in based on the configuration you specify. It also supports picking a particular Chrome profile -- either by specifying a profile name, or by specifying the "hosted domain" of your profile if you're using Google Workspace. You can read more in the 4 | 5 | ## Installation 6 | 7 | ### Windows 8 | 9 | 1. Download `bichrome-win64.exe` from [this release][windows_download]. 10 | 2. Move it to its permanent home -- e.g. creating a directory in `%localappdata%\Programs` called bichrome and putting it there. 11 | 3. Run `bichrome-win64.exe` once by double clicking it. This will register bichrome as a potential browser. 12 | 4. Configure bichrome as your default browser by opening "Default Apps" (You can open your start menu and just type "Default Apps") and clicking the icon under "Web browser", and picking bichrome. 13 | 14 | That's it! Now just create a configuration file named `bichrome_config.json` next to `bichrome-win64.exe` (see [the configuration section][config_readme] for details) -- a good starting place is to download & edit the [example config][example_config]] 15 | 16 | 17 | ### macOS 18 | 19 | 1. Download `bichrome-macos.zip` from [this release][macos_download]. 20 | 2. Extract it and copy the `bichrome` app e.g. to `/Applications` 21 | 3. Open System Preferences and search for "Default Browser" 22 | 4. Pick bichrome as your default browser. 23 | 24 | That's it! Now just create a configuration file named `bichrome_config.json` in `~/Library/Application Support/com.bitspatter.bichrome/bichrome_config.json` (see [the configuration section][config_readme] for details) -- a good starting place is to download & edit the [example config][example_config]. 25 | 26 | ## Changes in {this_version} 27 | {{ if changelog.scopes }} 28 | {{ for scope in changelog.scopes }} 29 | ### {scope.title} 30 | 31 | {{ for category in scope.categories -}} 32 | {{ for change in category.changes -}} 33 | * **{category.title}**: {change} 34 | {{ endfor -}} 35 | {{- endfor -}} 36 | {{ endfor }} 37 | 38 | See [the full list of changes][commits_link]. 39 | {{ else }} 40 | No significant user changes, see [the full list of changes][commits_link]. 41 | {{ endif }} 42 | 43 | [commits_link]: {commits_link} 44 | [windows_download]: {repo_url}/releases/download/{this_version}/bichrome-win64.exe 45 | [macos_download]: {repo_url}/releases/download/{this_version}/bichrome-macos.zip 46 | [example_config]: {repo_url}/releases/download/{this_version}/bichrome_example_config.json 47 | [config_readme]: {repo_url}/blob/{this_version}/README.md#bichrome_configjson -------------------------------------------------------------------------------- /src/config.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code)] 2 | 3 | use log::trace; 4 | use webextension_pattern::Pattern; 5 | 6 | use crate::{ 7 | chrome_local_state::{self, read_profiles_from_file}, 8 | os::get_chrome_local_state_path, 9 | }; 10 | use serde::{Deserialize, Serialize}; 11 | use std::{collections::HashMap, path::PathBuf}; 12 | use std::fs::File; 13 | use std::io::BufReader; 14 | use std::path::Path; 15 | use thiserror::Error; 16 | use url::Url; 17 | 18 | #[derive(Error, Debug)] 19 | pub enum Error { 20 | #[error("could not read configuration file")] 21 | InvalidFile(#[source] std::io::Error), 22 | #[error("could not parse configuration file")] 23 | InvalidJson(#[source] serde_json::Error), 24 | #[error("could not find declaration of profile {0}")] 25 | MissingProfile(String), 26 | #[error("unable to retrieve path for Chrome's Local State")] 27 | CantLocateChromeLocalState, 28 | #[error("unable to parse Chrome's Local State")] 29 | CantParseChromeLocalState(#[source] chrome_local_state::Error), 30 | #[error("no profile in Chrome's Local State matched domain '{0}' specified in config")] 31 | InvalidHostedDomain(String), 32 | #[error("no profile in Chrome's Local State matched name '{0}' specified in config")] 33 | InvalidProfileName(String), 34 | #[error("failed to parse received url {0:?}")] 35 | InvalidUrlPassedIn(String, #[source] url::ParseError), 36 | } 37 | 38 | type Result = std::result::Result; 39 | 40 | #[derive(Serialize, Deserialize, Debug, Clone)] 41 | #[serde(untagged)] 42 | pub enum ChromeProfile { 43 | ByName { 44 | #[serde(rename = "profile")] 45 | name: String, 46 | }, 47 | ByHostedDomain { 48 | hosted_domain: String, 49 | }, 50 | None {}, 51 | } 52 | 53 | impl ChromeProfile { 54 | pub fn get_argument(&self) -> Result> { 55 | let local_state_path = 56 | get_chrome_local_state_path().ok_or(Error::CantLocateChromeLocalState)?; 57 | let profiles = 58 | read_profiles_from_file(local_state_path).map_err(Error::CantParseChromeLocalState)?; 59 | trace!("Found Chrome profiles: {profiles:?}"); 60 | 61 | match self { 62 | ChromeProfile::ByName { name } => { 63 | if let Some(profile) = profiles.profile_by_name(name) { 64 | Ok(Some(format!("--profile-directory={}", profile))) 65 | } else { 66 | Err(Error::InvalidProfileName(name.to_owned())) 67 | } 68 | } 69 | ChromeProfile::ByHostedDomain { hosted_domain } => { 70 | let matching_profiles = profiles.profiles_by_hosted_domain(hosted_domain); 71 | if matching_profiles.is_empty() { 72 | Err(Error::InvalidHostedDomain(hosted_domain.to_owned())) 73 | } else { 74 | Ok(Some(format!( 75 | "--profile-directory={}", 76 | matching_profiles[0].clone() 77 | ))) 78 | } 79 | } 80 | ChromeProfile::None {} => Ok(None), 81 | } 82 | } 83 | } 84 | 85 | #[derive(Serialize, Deserialize, Debug, Clone)] 86 | #[serde(untagged)] 87 | pub enum EdgeProfile { 88 | ByName { 89 | #[serde(rename = "profile")] 90 | name: String, 91 | }, 92 | None {}, 93 | } 94 | 95 | impl EdgeProfile { 96 | pub fn get_argument(&self) -> Result> { 97 | match self { 98 | EdgeProfile::ByName { name } => Ok(Some(format!("--profile-directory={}", name))), 99 | EdgeProfile::None {} => Ok(None), 100 | } 101 | } 102 | } 103 | 104 | #[derive(Serialize, Deserialize, Debug, Clone)] 105 | pub struct ExecutablePath { 106 | path: PathBuf, 107 | } 108 | 109 | impl ExecutablePath { 110 | pub fn get_path(&self) -> PathBuf { 111 | self.path.clone() 112 | } 113 | } 114 | 115 | #[derive(Serialize, Deserialize, Debug, Clone)] 116 | #[serde(tag = "browser")] 117 | pub enum Browser { 118 | Chrome(ChromeProfile), 119 | Firefox, 120 | OsDefault, 121 | Edge(EdgeProfile), 122 | Safari, 123 | Executable(ExecutablePath) 124 | } 125 | 126 | #[derive(Serialize, Deserialize, Debug, Clone)] 127 | pub struct ProfilePattern { 128 | pub profile: String, 129 | pub pattern: Pattern, 130 | } 131 | 132 | #[derive(Serialize, Deserialize, Debug, Clone)] 133 | pub struct Configuration { 134 | pub default_profile: Option, 135 | pub profiles: HashMap, 136 | pub profile_selection: Vec, 137 | } 138 | 139 | impl Configuration { 140 | pub fn empty() -> Configuration { 141 | Configuration { 142 | default_profile: None, 143 | profiles: HashMap::new(), 144 | profile_selection: Vec::new(), 145 | } 146 | } 147 | 148 | pub fn read_from_file>(path: P) -> Result { 149 | let file = File::open(path).map_err(Error::InvalidFile)?; 150 | let reader = BufReader::new(file); 151 | let configuration = serde_json::from_reader(reader).map_err(Error::InvalidJson)?; 152 | Ok(configuration) 153 | } 154 | 155 | fn get_profile(&self, profile_name: &str) -> Result<&Browser> { 156 | for (profile, browser) in &self.profiles { 157 | if profile == profile_name { 158 | return Ok(browser); 159 | } 160 | } 161 | 162 | Err(Error::MissingProfile(profile_name.to_string())) 163 | } 164 | 165 | /// Find the best matching browser profile for the given URL. 166 | pub fn choose_browser(&self, url: &str) -> Result { 167 | let url = Url::parse(url).map_err(|err| Error::InvalidUrlPassedIn(url.to_string(), err))?; 168 | 169 | for profile_selector in &self.profile_selection { 170 | if profile_selector.pattern.is_match(&url) { 171 | return self 172 | .get_profile(&profile_selector.profile) 173 | .map(|b| b.clone()); 174 | } 175 | } 176 | 177 | // If there's a default_profile, use that, otherwise default to a Chrome without profiles. 178 | if let Some(default_profile) = &self.default_profile { 179 | self.get_profile(default_profile).map(|b| b.clone()) 180 | } else { 181 | Ok(Browser::Chrome(ChromeProfile::None {})) 182 | } 183 | } 184 | } 185 | 186 | #[derive(Serialize, Deserialize, Debug)] 187 | struct Template { 188 | profiles: HashMap, 189 | configuration: Configuration, 190 | } 191 | -------------------------------------------------------------------------------- /src/macos.rs: -------------------------------------------------------------------------------- 1 | use crate::config::{Browser, Configuration}; 2 | use anyhow::bail; 3 | use anyhow::Result; 4 | use fruitbasket::FruitApp; 5 | use fruitbasket::FruitCallbackKey; 6 | use fruitbasket::RunPeriod; 7 | use log::{debug, error, trace, warn}; 8 | use simplelog::*; 9 | use std::{ 10 | fs::File, 11 | path::PathBuf, 12 | process::{Command, Stdio}, 13 | }; 14 | use url::Url; 15 | 16 | fn get_chrome_binary_path() -> PathBuf { 17 | // TODO Could be -- hopefully this would find it in Applications too? 18 | // `mdfind 'kMDItemCFBundleIdentifier = "com.google.Chrome"'` 19 | PathBuf::from("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome") 20 | } 21 | 22 | fn get_application_support_path() -> Option { 23 | let home_dir = std::env::var_os("HOME") 24 | .and_then(|h| if h.is_empty() { None } else { Some(h) }) 25 | .map(PathBuf::from); 26 | home_dir.map(|path| path.join("Library/Application Support")) 27 | } 28 | 29 | #[allow(dead_code)] 30 | pub fn get_chrome_local_state_path() -> Option { 31 | get_application_support_path().map(|path| path.join("Google/Chrome/Local State")) 32 | } 33 | 34 | fn get_log_path() -> Option { 35 | get_application_support_path().map(|path| path.join("com.bitspatter.bichrome/bichrome.log")) 36 | } 37 | 38 | fn get_config_path() -> Option { 39 | get_application_support_path() 40 | .map(|path| path.join("com.bitspatter.bichrome/bichrome_config.json")) 41 | } 42 | 43 | fn init() -> Configuration { 44 | let config_path = get_config_path(); 45 | // We try to read the config, and otherwise just use an empty one instead. 46 | match config_path { 47 | Some(config_path) => { 48 | debug!("attempting to load config from {}", config_path.display()); 49 | let config = Configuration::read_from_file(&config_path); 50 | match config { 51 | Ok(config) => { 52 | trace!("config: {:#?}", config); 53 | config 54 | } 55 | Err(e) => { 56 | error!("failed to parse config: {:?}", e); 57 | warn!("opening URLs without profile"); 58 | Configuration::empty() 59 | } 60 | } 61 | } 62 | None => { 63 | error!("failed to determine config path"); 64 | warn!("opening URLs without profile"); 65 | Configuration::empty() 66 | } 67 | } 68 | } 69 | 70 | fn handle_url(url: &str) -> Result<()> { 71 | let config = init(); 72 | 73 | let browser = config.choose_browser(url)?; 74 | let (exe, args) = match browser { 75 | Browser::Chrome(profile) => { 76 | if let Some(argument) = profile.get_argument()? { 77 | let args = vec![argument, url.to_string()]; 78 | (get_chrome_binary_path().to_str().unwrap().to_string(), args) 79 | } else { 80 | // We use `open -b com.google.Chrome ` when you don't specify a profile as it 81 | // responds faster, and it is the more "natural" way to open an URL in Chrome. 82 | let args = ["-b", "com.google.Chrome", url] 83 | .iter() 84 | .map(|s| s.to_string()) 85 | .collect(); 86 | ("open".to_string(), args) 87 | } 88 | } 89 | Browser::Firefox => { 90 | // TODO If we support Firefox profiles, use something like the Chrome path with firefox -P 91 | let args = ["-b", "org.mozilla.firefox", url] 92 | .iter() 93 | .map(|s| s.to_string()) 94 | .collect(); 95 | ("open".to_string(), args) 96 | } 97 | Browser::OsDefault | Browser::Safari => { 98 | let args = ["-b", "com.apple.Safari", url] 99 | .iter() 100 | .map(|s| s.to_string()) 101 | .collect(); 102 | ("open".to_string(), args) 103 | } 104 | Browser::Edge(_) => { 105 | bail!("Microsoft Edge not supported on macOS") 106 | } 107 | Browser::Executable(location) => 108 | (location.get_path().to_str().unwrap().to_string(), vec![url.to_string()]) 109 | }; 110 | 111 | debug!("launching \"{}\" \"{}\"", exe, args.join("\" \"")); 112 | Command::new(&exe) 113 | .stdout(Stdio::null()) 114 | .stdin(Stdio::null()) 115 | .stderr(Stdio::null()) 116 | .args(args) 117 | .spawn()?; 118 | 119 | Ok(()) 120 | } 121 | 122 | pub fn main() -> Result<()> { 123 | let log_level = LevelFilter::Debug; 124 | let log_path = get_log_path().unwrap(); 125 | let mut loggers: Vec> = Vec::new(); 126 | // If we can write to bichrome.log, always use it. 127 | if let Ok(file) = File::create(log_path) { 128 | loggers.push(WriteLogger::new(log_level, Config::default(), file)); 129 | } 130 | loggers.push(TermLogger::new( 131 | log_level, 132 | Config::default(), 133 | TerminalMode::Mixed, 134 | ColorChoice::Auto, 135 | )); 136 | CombinedLogger::init(loggers)?; 137 | 138 | let mut app = FruitApp::new(); 139 | 140 | let stopper = app.stopper(); 141 | app.register_callback( 142 | FruitCallbackKey::Method("applicationDidFinishLaunching:"), 143 | Box::new(move |_event| { 144 | stopper.stop(); 145 | }), 146 | ); 147 | 148 | // Register a callback to get receive custom URL schemes from any Mac program 149 | app.register_apple_event(fruitbasket::kInternetEventClass, fruitbasket::kAEGetURL); 150 | let stopper = app.stopper(); 151 | app.register_callback( 152 | FruitCallbackKey::Method("handleEvent:withReplyEvent:"), 153 | Box::new(move |event| { 154 | let url: String = fruitbasket::parse_url_event(event); 155 | if let Err(error) = handle_url(&url) { 156 | panic!("error handling url: {}", error); 157 | } 158 | stopper.stop(); 159 | }), 160 | ); 161 | 162 | let stopper = app.stopper(); 163 | app.register_callback( 164 | FruitCallbackKey::Method("application:openFile:"), 165 | Box::new(move |file| { 166 | let file = fruitbasket::nsstring_to_string(file); 167 | let url = Url::from_file_path(file).expect("Unable to convert file path to URL"); 168 | if let Err(error) = handle_url(url.as_ref()) { 169 | panic!("error handling file path: {}", error); 170 | } 171 | stopper.stop(); 172 | }), 173 | ); 174 | 175 | // Run 'forever', until the URL callback fires 176 | let _ = app.run(RunPeriod::Forever); 177 | 178 | fruitbasket::FruitApp::terminate(0); 179 | 180 | // This will never execute. 181 | Ok(()) 182 | } 183 | -------------------------------------------------------------------------------- /assets/bichrome.app/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleGetInfoString 6 | bichrome 7 | LSBackgroundOnly 8 | 1 9 | LSMinimumSystemVersion 10 | 10.10.0 11 | CFBundleExecutable 12 | bichrome 13 | CFBundleIdentifier 14 | com.bitspatter.bichrome 15 | CFBundleName 16 | bichrome 17 | CFBundleIconFile 18 | bichrome_icon.icns 19 | CFBundleShortVersionString 20 | 0.5.1 21 | CFBundleInfoDictionaryVersion 22 | 6.0 23 | CFBundlePackageType 24 | APPL 25 | CFBundleURLTypes 26 | 27 | 28 | CFBundleURLName 29 | Web site URL 30 | CFBundleURLSchemes 31 | 32 | http 33 | https 34 | 35 | 36 | 37 | CFBundleURLName 38 | http URL 39 | CFBundleURLSchemes 40 | 41 | http 42 | 43 | 44 | 45 | CFBundleURLName 46 | Secure http URL 47 | CFBundleURLSchemes 48 | 49 | https 50 | 51 | 52 | 53 | CFBundleDocumentTypes 54 | 55 | 56 | CFBundleTypeIconFile 57 | document.icns 58 | CFBundleTypeName 59 | GIF image 60 | CFBundleTypeRole 61 | Viewer 62 | LSItemContentTypes 63 | 64 | com.compuserve.gif 65 | 66 | 67 | 68 | CFBundleTypeIconFile 69 | document.icns 70 | CFBundleTypeName 71 | HTML document 72 | CFBundleTypeRole 73 | Viewer 74 | LSItemContentTypes 75 | 76 | public.html 77 | 78 | 79 | 80 | CFBundleTypeIconFile 81 | document.icns 82 | CFBundleTypeName 83 | XHTML document 84 | CFBundleTypeRole 85 | Viewer 86 | LSItemContentTypes 87 | 88 | public.xhtml 89 | 90 | 91 | 92 | CFBundleTypeIconFile 93 | document.icns 94 | CFBundleTypeName 95 | JavaScript script 96 | CFBundleTypeRole 97 | Viewer 98 | LSItemContentTypes 99 | 100 | com.netscape.javascript-​source 101 | 102 | 103 | 104 | CFBundleTypeIconFile 105 | document.icns 106 | CFBundleTypeName 107 | JPEG image 108 | CFBundleTypeRole 109 | Viewer 110 | LSItemContentTypes 111 | 112 | public.jpeg 113 | 114 | 115 | 116 | CFBundleTypeIconFile 117 | document.icns 118 | CFBundleTypeName 119 | MHTML document 120 | CFBundleTypeRole 121 | Viewer 122 | LSItemContentTypes 123 | 124 | org.ietf.mhtml 125 | 126 | 127 | 128 | CFBundleTypeIconFile 129 | document.icns 130 | CFBundleTypeName 131 | HTML5 Audio (Ogg) 132 | CFBundleTypeRole 133 | Viewer 134 | LSItemContentTypes 135 | 136 | org.xiph.ogg-audio 137 | 138 | 139 | 140 | CFBundleTypeIconFile 141 | document.icns 142 | CFBundleTypeName 143 | HTML5 Video (Ogg) 144 | CFBundleTypeRole 145 | Viewer 146 | LSItemContentTypes 147 | 148 | org.xiph.ogv 149 | 150 | 151 | 152 | CFBundleTypeIconFile 153 | document.icns 154 | CFBundleTypeName 155 | PNG image 156 | CFBundleTypeRole 157 | Viewer 158 | LSItemContentTypes 159 | 160 | public.png 161 | 162 | 163 | 164 | CFBundleTypeIconFile 165 | document.icns 166 | CFBundleTypeName 167 | SVG document 168 | CFBundleTypeRole 169 | Viewer 170 | LSItemContentTypes 171 | 172 | public.svg-image 173 | 174 | 175 | 176 | CFBundleTypeIconFile 177 | document.icns 178 | CFBundleTypeName 179 | Plain text document 180 | CFBundleTypeRole 181 | Viewer 182 | LSItemContentTypes 183 | 184 | public.text 185 | 186 | 187 | 188 | CFBundleTypeIconFile 189 | document.icns 190 | CFBundleTypeName 191 | HTML5 Video (WebM) 192 | CFBundleTypeRole 193 | Viewer 194 | LSItemContentTypes 195 | 196 | org.webmproject.webm 197 | 198 | 199 | 200 | CFBundleTypeIconFile 201 | document.icns 202 | CFBundleTypeName 203 | WebP image 204 | CFBundleTypeRole 205 | Viewer 206 | LSItemContentTypes 207 | 208 | org.webmproject.webp 209 | 210 | 211 | 212 | CFBundleTypeRole 213 | Viewer 214 | LSItemContentTypes 215 | 216 | org.chromium.extension 217 | 218 | 219 | 220 | CFBundleTypeIconFile 221 | document.icns 222 | CFBundleTypeName 223 | PDF Document 224 | CFBundleTypeRole 225 | Viewer 226 | LSItemContentTypes 227 | 228 | com.adobe.pdf 229 | 230 | 231 | 232 | 233 | 234 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | push: 5 | tags: 6 | - "v*" 7 | 8 | env: 9 | CARGO_TERM_COLOR: always 10 | 11 | jobs: 12 | build_windows: 13 | name: Build release (Windows) 14 | runs-on: windows-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v4 18 | - uses: actions/cache@v4 19 | with: 20 | path: | 21 | ~/.cargo/registry 22 | ~/.cargo/git 23 | target 24 | key: ${{ runner.os }}-release_cargo-${{ hashFiles('**/Cargo.lock') }} 25 | restore-keys: | 26 | ${{ runner.os }}-release_cargo- 27 | - name: Build release 28 | run: cargo build --release --verbose 29 | - name: Archive EXE and PDB 30 | uses: actions/upload-artifact@v4 31 | with: 32 | name: ${{ runner.os }}-release 33 | path: | 34 | target/release/bichrome.exe 35 | target/release/bichrome.pdb 36 | if-no-files-found: error 37 | 38 | build_macos: 39 | name: Build release (macOS) 40 | runs-on: macos-latest 41 | 42 | steps: 43 | - uses: actions/checkout@v4 44 | - uses: actions/cache@v4 45 | with: 46 | path: | 47 | ~/.cargo/registry 48 | ~/.cargo/git 49 | target 50 | key: ${{ runner.os }}-release_cargo-${{ hashFiles('**/Cargo.lock') }} 51 | restore-keys: | 52 | ${{ runner.os }}-release_cargo- 53 | - name: Build release 54 | run: cargo build --release --verbose 55 | - name: Prepare app bundle 56 | run: | 57 | mkdir -p dist 58 | cp -va assets/bichrome.app dist/bichrome.app 59 | cp -va target/release/bichrome dist/bichrome.app/Contents/MacOS/bichrome 60 | ditto -ckv --keepParent dist/bichrome.app dist/bichrome.zip 61 | - name: Archive bundle ZIP 62 | uses: actions/upload-artifact@v4 63 | with: 64 | name: ${{ runner.os }}-release 65 | path: dist/bichrome.zip 66 | if-no-files-found: error 67 | compression-level: 0 68 | 69 | create_release: 70 | name: Publish release 71 | needs: [build_windows, build_macos] 72 | runs-on: ubuntu-latest 73 | 74 | steps: 75 | - uses: actions/checkout@v4 76 | with: 77 | fetch-depth: 0 # We need fetch depth 0 to get all the tags for determining the previous tag in the changelog generation. 78 | - uses: actions/cache@v4 79 | with: 80 | path: | 81 | ~/.cargo/registry 82 | ~/.cargo/git 83 | changelog_generator/target 84 | key: ${{ runner.os }}-changelog_cargo-${{ hashFiles('**/Cargo.lock') }} 85 | restore-keys: | 86 | ${{ runner.os }}-changelog_cargo- 87 | - name: Download release artifacts 88 | uses: actions/download-artifact@v4 89 | with: 90 | path: dist 91 | - name: Generate changelog 92 | run: | 93 | set -x 94 | PREVIOUS_TAG=$(git for-each-ref --count=1 --sort=-creatordate '--format=%(refname:short)' refs/tags '--no-contains=${{ github.ref }}') 95 | THIS_TAG=$(git for-each-ref '--format=%(refname:short)' ${{ github.ref }}) 96 | cargo run --manifest-path changelog_generator/Cargo.toml -- ${PREVIOUS_TAG} ${THIS_TAG} https://github.com/${{ github.repository }} > gh-release.md 97 | - name: Create Release 98 | id: create_release 99 | uses: actions/create-release@v1 100 | env: 101 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 102 | with: 103 | tag_name: ${{ github.ref }} 104 | release_name: Release ${{ github.ref }} 105 | body_path: gh-release.md 106 | draft: true 107 | prerelease: false 108 | - name: Upload Release Asset (Windows EXE) 109 | uses: actions/upload-release-asset@v1 110 | env: 111 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 112 | with: 113 | upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps 114 | asset_path: dist/Windows-release/bichrome.exe 115 | asset_name: bichrome-win64.exe 116 | asset_content_type: application/octet-stream 117 | - name: Upload Release Asset (Windows PDB) 118 | uses: actions/upload-release-asset@v1 119 | env: 120 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 121 | with: 122 | upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps 123 | asset_path: dist/Windows-release/bichrome.pdb 124 | asset_name: bichrome-win64.pdb 125 | asset_content_type: application/octet-stream 126 | - name: Upload Release Asset (macOS) 127 | uses: actions/upload-release-asset@v1 128 | env: 129 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 130 | with: 131 | upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps 132 | asset_path: dist/macOS-release/bichrome.zip 133 | asset_name: bichrome-macos.zip 134 | asset_content_type: application/zip 135 | - name: Upload Release Asset (example config) 136 | uses: actions/upload-release-asset@v1 137 | env: 138 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 139 | with: 140 | upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps 141 | asset_path: example_config/bichrome_config.json 142 | asset_name: bichrome_example_config.json 143 | asset_content_type: application/json 144 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build status](https://github.com/jorgenpt/bichrome/workflows/Build/badge.svg)](https://github.com/jorgenpt/bichrome/actions?query=workflow%3ABuild) 2 | 3 | # bichrome 4 | 5 | bichrome is a simple utility for Windows and macOS that you configure as your default browser, which then will choose which browser to open a URL in based on the configuration you specify. It also supports picking a particular Chrome profile -- either by specifying a profile name, or by specifying the "hosted domain" of your profile if you're using Google Workspace. (Your hosted domain is the bit after the @ in a non-"gmail dot com" address hosted by GMail.) 6 | 7 | It was created to address the problem of clicking links in Slack and other apps and then having to relocate them to the "correct" browser window / Chrome profile where you're logged in to Facebook / JIRA / etc. 8 | 9 | Big thanks to Krista A. Leemhuis for the amazing icon! 10 | 11 | ## Installation 12 | 13 | ### Windows 14 | 15 | 1. Download `bichrome-win64.exe` from [the latest release](https://github.com/jorgenpt/bichrome/releases/latest). 16 | 2. Move it to its permanent home -- e.g. creating a directory in `%localappdata%\Programs` called bichrome and putting it there. 17 | 3. Run `bichrome-win64.exe` once by double clicking it. This will register bichrome as a potential browser. 18 | 4. Configure bichrome as your default browser by opening "Default Apps" (You can open your start menu and just type "Default Apps") and clicking the icon under "Web browser", and picking bichrome. 19 | 20 | That's it! Now just create a configuration file named `bichrome_config.json` next to `bichrome-win64.exe` (see [the configuration section](#config) for details) -- a good starting place is to download & edit the [example config](https://raw.githubusercontent.com/jorgenpt/bichrome/main/example_config/bichrome_config.json). 21 | 22 | ### macOS 23 | 24 | 1. Download `bichrome-macos.zip` from [the latest release](https://github.com/jorgenpt/bichrome/releases/latest). 25 | 2. Extract it and copy the `bichrome` app e.g. to `/Applications` 26 | 3. Open System Preferences and search for "Default Browser" 27 | 4. Pick bichrome as your default browser. 28 | 29 | That's it! Now just create a configuration file named `bichrome_config.json` in `~/Library/Application Support/com.bitspatter.bichrome/bichrome_config.json` (see [the configuration section](#config) for details) -- a good starting place is to download & edit the [example config](https://raw.githubusercontent.com/jorgenpt/bichrome/main/example_config/bichrome_config.json). 30 | 31 | ## `bichrome_config.json` 32 | 33 | Configuring bichrome involves setting up a set of `profiles` that define a name and a browser (and for Chrome, optionally a browser profile name or a profile's hosted domain), and setting up a list of profile selectors that pick a profile based on matching patterns against the URL you're opening. Profile names 34 | 35 | The following snippet shows how profiles are configured. See [the example config][example_config] for a more complete example. 36 | 37 | ```json 38 | { 39 | "default_profile": "Personal", 40 | "profiles": { 41 | "Work": { 42 | "browser": "Chrome", 43 | "hosted_domain": "mycorp.com" 44 | }, 45 | "Personal": { 46 | "browser": "Firefox" 47 | } 48 | }, 49 | "profile_selection": [ ... ] 50 | } 51 | ``` 52 | 53 | The format for the patterns are documented in detail on [Mozilla.org](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns) or in [the documentation of the webextension_pattern crate](https://docs.rs/webextension_pattern/latest/webextension_pattern/index.html) which is used to perform the matching. Some examples can be found in the [the example config][example_config]. 54 | 55 | Configuring the matching is done under the `profile_selection` key. The browser from the first selector that matches the URL will be used to open the URL. If none of the patterns match, the URL will be opened with the profile named in `default_profile`, and if that doesn't exist, it will default to using Chrome with no profile specified. (Chrome's behavior in this case is to open it in the last activated window.) A profile specifying a browser of `OsDefault` will use Safari on macOS and Edge on Windows, and `Safari` or `Edge` will open the respective browser iff it's running on a supported OS. 56 | 57 | The following snippet shows how selectors are configured. See [the example config][example_config] for a more complete example. 58 | 59 | ```json 60 | { 61 | "default_profile": "...", 62 | "profiles": { ... }, 63 | "profile_selection": [ 64 | { 65 | "profile": "Personal", 66 | "pattern": "*.twitter.com" 67 | }, 68 | { 69 | "profile": "Work", 70 | "pattern": "*.mycorp.net" 71 | } 72 | ] 73 | } 74 | ``` 75 | 76 | `bichrome_config.json` is expected to live next to `bichrome-win64.exe` on Windows, and in `~/Library/Application Support/com.bitspatter.bichrome/bichrome_config.json` on macOS. 77 | 78 | You can find an example config in [example_config/bichrome_config.json][example_config]. 79 | 80 | Profile names for Chrome and Edge can either be the name you see in the profile list, or the internal "profile name". The latter can be a little bit opaque -- the standard profile name for both of them (i.e. the first profile created) is `Default`, and then it will create profiles named `Profile 1`, `Profile 2`, and so forth. These will (on Windows) each have a folder in `%localappdata%/Google/Chrome/User Data` or `%localappdata%/Microsoft/Edge/User Data`. The correct profile name for the active profile can be found in the `Profile path` key on `edge://version/` or `chrome://version/` respectively. 81 | 82 | For Chrome, `hosted_domain` can be the name of a Google Apps domain that you've signed in to Chrome, in which case bichrome automatically determines which profile that is. 83 | 84 | You may also supply `Executable` as a profile's browser, along with a path to a program you would like to open certain URLs. You could, for example, use it to open YouTube links directly in your video player of choice. 85 | 86 | ```json 87 | { 88 | "default_profile": "...", 89 | "profiles": { 90 | "Video Player": { 91 | "browser": "Executable", 92 | "path": "C:/Program Files/mpv/mpv.exe" 93 | } 94 | }, 95 | "profile_selection": [ 96 | { 97 | "profile": "Video Player", 98 | "pattern": "*.youtube.com" 99 | }, 100 | { 101 | "profile": "Video Player", 102 | "pattern": "youtu.be" 103 | } 104 | ] 105 | } 106 | ``` 107 | 108 | [example_config]: example_config/bichrome_config.json 109 | 110 | ## License 111 | 112 | [The icon](assets/bichrome_icon.png) is copyright (c) 2021-2023 [Jørgen P. Tjernø](mailto:jorgen@tjer.no). All Rights Reserved. 113 | 114 | The source code is licensed under either of 115 | 116 | - Apache License, Version 2.0 117 | ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) 118 | - MIT license 119 | ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) 120 | 121 | at your option. 122 | 123 | ## Contribution 124 | 125 | Unless you explicitly state otherwise, any contribution intentionally submitted 126 | for inclusion in the work by you, as defined in the Apache-2.0 license, shall be 127 | dual licensed as above, without any additional terms or conditions. 128 | -------------------------------------------------------------------------------- /changelog_generator/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | [[package]] 4 | name = "aho-corasick" 5 | version = "0.7.15" 6 | source = "registry+https://github.com/rust-lang/crates.io-index" 7 | checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" 8 | dependencies = [ 9 | "memchr 2.3.4", 10 | ] 11 | 12 | [[package]] 13 | name = "anyhow" 14 | version = "1.0.39" 15 | source = "registry+https://github.com/rust-lang/crates.io-index" 16 | checksum = "81cddc5f91628367664cc7c69714ff08deee8a3efc54623011c772544d7b2767" 17 | 18 | [[package]] 19 | name = "autocfg" 20 | version = "1.0.1" 21 | source = "registry+https://github.com/rust-lang/crates.io-index" 22 | checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" 23 | 24 | [[package]] 25 | name = "cfg-if" 26 | version = "1.0.0" 27 | source = "registry+https://github.com/rust-lang/crates.io-index" 28 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 29 | 30 | [[package]] 31 | name = "changelog_generator" 32 | version = "0.1.0" 33 | dependencies = [ 34 | "anyhow", 35 | "git-changelog", 36 | "serde", 37 | "serde_derive", 38 | "tinytemplate", 39 | ] 40 | 41 | [[package]] 42 | name = "chrono" 43 | version = "0.4.19" 44 | source = "registry+https://github.com/rust-lang/crates.io-index" 45 | checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" 46 | dependencies = [ 47 | "libc", 48 | "num-integer", 49 | "num-traits", 50 | "time", 51 | "winapi", 52 | ] 53 | 54 | [[package]] 55 | name = "dtoa" 56 | version = "0.4.7" 57 | source = "registry+https://github.com/rust-lang/crates.io-index" 58 | checksum = "88d7ed2934d741c6b37e33e3832298e8850b53fd2d2bea03873375596c7cea4e" 59 | 60 | [[package]] 61 | name = "git-changelog" 62 | version = "0.3.2-nightly" 63 | source = "git+https://github.com/aldrin/git-changelog#8840f5f8d95a8662ed31830bfe85579a515f8ce1" 64 | dependencies = [ 65 | "anyhow", 66 | "chrono", 67 | "log", 68 | "nom", 69 | "regex", 70 | "serde", 71 | "serde_derive", 72 | "serde_json", 73 | "serde_yaml", 74 | ] 75 | 76 | [[package]] 77 | name = "itoa" 78 | version = "0.4.7" 79 | source = "registry+https://github.com/rust-lang/crates.io-index" 80 | checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" 81 | 82 | [[package]] 83 | name = "libc" 84 | version = "0.2.90" 85 | source = "registry+https://github.com/rust-lang/crates.io-index" 86 | checksum = "ba4aede83fc3617411dc6993bc8c70919750c1c257c6ca6a502aed6e0e2394ae" 87 | 88 | [[package]] 89 | name = "linked-hash-map" 90 | version = "0.5.4" 91 | source = "registry+https://github.com/rust-lang/crates.io-index" 92 | checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" 93 | 94 | [[package]] 95 | name = "log" 96 | version = "0.4.14" 97 | source = "registry+https://github.com/rust-lang/crates.io-index" 98 | checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" 99 | dependencies = [ 100 | "cfg-if", 101 | ] 102 | 103 | [[package]] 104 | name = "memchr" 105 | version = "1.0.2" 106 | source = "registry+https://github.com/rust-lang/crates.io-index" 107 | checksum = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" 108 | dependencies = [ 109 | "libc", 110 | ] 111 | 112 | [[package]] 113 | name = "memchr" 114 | version = "2.3.4" 115 | source = "registry+https://github.com/rust-lang/crates.io-index" 116 | checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" 117 | 118 | [[package]] 119 | name = "nom" 120 | version = "3.2.1" 121 | source = "registry+https://github.com/rust-lang/crates.io-index" 122 | checksum = "05aec50c70fd288702bcd93284a8444607f3292dbdf2a30de5ea5dcdbe72287b" 123 | dependencies = [ 124 | "memchr 1.0.2", 125 | ] 126 | 127 | [[package]] 128 | name = "num-integer" 129 | version = "0.1.44" 130 | source = "registry+https://github.com/rust-lang/crates.io-index" 131 | checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" 132 | dependencies = [ 133 | "autocfg", 134 | "num-traits", 135 | ] 136 | 137 | [[package]] 138 | name = "num-traits" 139 | version = "0.2.14" 140 | source = "registry+https://github.com/rust-lang/crates.io-index" 141 | checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" 142 | dependencies = [ 143 | "autocfg", 144 | ] 145 | 146 | [[package]] 147 | name = "proc-macro2" 148 | version = "1.0.24" 149 | source = "registry+https://github.com/rust-lang/crates.io-index" 150 | checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" 151 | dependencies = [ 152 | "unicode-xid", 153 | ] 154 | 155 | [[package]] 156 | name = "quote" 157 | version = "1.0.9" 158 | source = "registry+https://github.com/rust-lang/crates.io-index" 159 | checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" 160 | dependencies = [ 161 | "proc-macro2", 162 | ] 163 | 164 | [[package]] 165 | name = "regex" 166 | version = "1.4.5" 167 | source = "registry+https://github.com/rust-lang/crates.io-index" 168 | checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" 169 | dependencies = [ 170 | "aho-corasick", 171 | "memchr 2.3.4", 172 | "regex-syntax", 173 | ] 174 | 175 | [[package]] 176 | name = "regex-syntax" 177 | version = "0.6.23" 178 | source = "registry+https://github.com/rust-lang/crates.io-index" 179 | checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" 180 | 181 | [[package]] 182 | name = "ryu" 183 | version = "1.0.5" 184 | source = "registry+https://github.com/rust-lang/crates.io-index" 185 | checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" 186 | 187 | [[package]] 188 | name = "serde" 189 | version = "1.0.124" 190 | source = "registry+https://github.com/rust-lang/crates.io-index" 191 | checksum = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" 192 | 193 | [[package]] 194 | name = "serde_derive" 195 | version = "1.0.124" 196 | source = "registry+https://github.com/rust-lang/crates.io-index" 197 | checksum = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" 198 | dependencies = [ 199 | "proc-macro2", 200 | "quote", 201 | "syn", 202 | ] 203 | 204 | [[package]] 205 | name = "serde_json" 206 | version = "1.0.64" 207 | source = "registry+https://github.com/rust-lang/crates.io-index" 208 | checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" 209 | dependencies = [ 210 | "itoa", 211 | "ryu", 212 | "serde", 213 | ] 214 | 215 | [[package]] 216 | name = "serde_yaml" 217 | version = "0.8.17" 218 | source = "registry+https://github.com/rust-lang/crates.io-index" 219 | checksum = "15654ed4ab61726bf918a39cb8d98a2e2995b002387807fa6ba58fdf7f59bb23" 220 | dependencies = [ 221 | "dtoa", 222 | "linked-hash-map", 223 | "serde", 224 | "yaml-rust", 225 | ] 226 | 227 | [[package]] 228 | name = "syn" 229 | version = "1.0.64" 230 | source = "registry+https://github.com/rust-lang/crates.io-index" 231 | checksum = "3fd9d1e9976102a03c542daa2eff1b43f9d72306342f3f8b3ed5fb8908195d6f" 232 | dependencies = [ 233 | "proc-macro2", 234 | "quote", 235 | "unicode-xid", 236 | ] 237 | 238 | [[package]] 239 | name = "time" 240 | version = "0.1.44" 241 | source = "registry+https://github.com/rust-lang/crates.io-index" 242 | checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" 243 | dependencies = [ 244 | "libc", 245 | "wasi", 246 | "winapi", 247 | ] 248 | 249 | [[package]] 250 | name = "tinytemplate" 251 | version = "1.2.1" 252 | source = "registry+https://github.com/rust-lang/crates.io-index" 253 | checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" 254 | dependencies = [ 255 | "serde", 256 | "serde_json", 257 | ] 258 | 259 | [[package]] 260 | name = "unicode-xid" 261 | version = "0.2.1" 262 | source = "registry+https://github.com/rust-lang/crates.io-index" 263 | checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" 264 | 265 | [[package]] 266 | name = "wasi" 267 | version = "0.10.0+wasi-snapshot-preview1" 268 | source = "registry+https://github.com/rust-lang/crates.io-index" 269 | checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" 270 | 271 | [[package]] 272 | name = "winapi" 273 | version = "0.3.9" 274 | source = "registry+https://github.com/rust-lang/crates.io-index" 275 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 276 | dependencies = [ 277 | "winapi-i686-pc-windows-gnu", 278 | "winapi-x86_64-pc-windows-gnu", 279 | ] 280 | 281 | [[package]] 282 | name = "winapi-i686-pc-windows-gnu" 283 | version = "0.4.0" 284 | source = "registry+https://github.com/rust-lang/crates.io-index" 285 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 286 | 287 | [[package]] 288 | name = "winapi-x86_64-pc-windows-gnu" 289 | version = "0.4.0" 290 | source = "registry+https://github.com/rust-lang/crates.io-index" 291 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 292 | 293 | [[package]] 294 | name = "yaml-rust" 295 | version = "0.4.5" 296 | source = "registry+https://github.com/rust-lang/crates.io-index" 297 | checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" 298 | dependencies = [ 299 | "linked-hash-map", 300 | ] 301 | -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright (c) 2021-2023 Jørgen Tjernø 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /src/windows.rs: -------------------------------------------------------------------------------- 1 | use crate::config::{Browser, Configuration}; 2 | use anyhow::{bail, Context, Result}; 3 | use const_format::concatcp; 4 | use log::{debug, error, info, trace, warn}; 5 | use simplelog::*; 6 | use std::{ 7 | fs::{File, OpenOptions}, 8 | io, 9 | path::{Path, PathBuf}, 10 | process::{Command, Stdio}, 11 | }; 12 | use structopt::StructOpt; 13 | use winreg::{enums::*, RegKey}; 14 | 15 | // How many bytes do we let the log size grow to before we rotate it? We only keep one current and one old log. 16 | const MAX_LOG_SIZE: u64 = 64 * 1024; 17 | 18 | const CANONICAL_NAME: &str = "bichrome.exe"; 19 | const PROGID: &str = "bichromeHTML"; 20 | 21 | // Configuration for "Default Programs". StartMenuInternet is the key for browsers 22 | // and they're expected to use the name of the exe as the key. 23 | const DPROG_PATH: &str = concatcp!(r"SOFTWARE\Clients\StartMenuInternet\", CANONICAL_NAME); 24 | const DPROG_INSTALLINFO_PATH: &str = concatcp!(DPROG_PATH, "InstallInfo"); 25 | 26 | const APPREG_BASE: &str = r"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\"; 27 | const PROGID_PATH: &str = concatcp!(r"SOFTWARE\Classes\", PROGID); 28 | const REGISTERED_APPLICATIONS_PATH: &str = 29 | concatcp!(r"SOFTWARE\RegisteredApplications\", DISPLAY_NAME); 30 | 31 | const DISPLAY_NAME: &str = "bichrome"; 32 | const DESCRIPTION: &str = "Pick the right Chrome profile for each URL"; 33 | 34 | /// Retrieve an EXE path by looking in the registry for the App Paths entry 35 | fn get_exe_path(exe_name: &str) -> Result { 36 | for root_name in &[HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE] { 37 | let root = RegKey::predef(*root_name); 38 | if let Ok(subkey) = root.open_subkey(format!("{}{}", APPREG_BASE, exe_name)) { 39 | if let Ok(value) = subkey.get_value::("") { 40 | let path = PathBuf::from(value); 41 | if path.is_file() { 42 | return Ok(path); 43 | } 44 | } 45 | } 46 | } 47 | 48 | bail!("Could not find path for {}", exe_name); 49 | } 50 | 51 | /// Register associations with Windows for being a browser 52 | fn register_urlhandler(extra_args: Option<&str>) -> io::Result<()> { 53 | // This is used both by initial registration and OS-invoked reinstallation. 54 | // The expectations for the latter are documented here: https://docs.microsoft.com/en-us/windows/win32/shell/reg-middleware-apps#the-reinstall-command 55 | use std::env::current_exe; 56 | 57 | let exe_path = current_exe()?; 58 | let exe_name = exe_path 59 | .file_name() 60 | .and_then(|s| s.to_str()) 61 | .unwrap_or_default() 62 | .to_owned(); 63 | 64 | let exe_path = exe_path.to_str().unwrap_or_default().to_owned(); 65 | let icon_path = format!("\"{}\",0", exe_path); 66 | let open_command = if let Some(extra_args) = extra_args { 67 | format!("\"{}\" {} \"%1\"", exe_path, extra_args) 68 | } else { 69 | format!("\"{}\" \"%1\"", exe_path) 70 | }; 71 | 72 | let hkcu = RegKey::predef(HKEY_CURRENT_USER); 73 | 74 | // Configure our ProgID to point to the right command 75 | { 76 | let (progid_class, _) = hkcu.create_subkey(PROGID_PATH)?; 77 | progid_class.set_value("", &DISPLAY_NAME)?; 78 | 79 | let (progid_class_defaulticon, _) = progid_class.create_subkey("DefaultIcon")?; 80 | progid_class_defaulticon.set_value("", &icon_path)?; 81 | 82 | let (progid_class_shell_open_command, _) = 83 | progid_class.create_subkey(r"shell\open\command")?; 84 | progid_class_shell_open_command.set_value("", &open_command)?; 85 | } 86 | 87 | // Set up the Default Programs configuration for the app (https://docs.microsoft.com/en-us/windows/win32/shell/default-programs) 88 | { 89 | let (dprog, _) = hkcu.create_subkey(DPROG_PATH)?; 90 | dprog.set_value("", &DISPLAY_NAME)?; 91 | dprog.set_value("LocalizedString", &DISPLAY_NAME)?; 92 | 93 | let (dprog_capabilites, _) = dprog.create_subkey("Capabilities")?; 94 | dprog_capabilites.set_value("ApplicationName", &DISPLAY_NAME)?; 95 | dprog_capabilites.set_value("ApplicationIcon", &icon_path)?; 96 | dprog_capabilites.set_value("ApplicationDescription", &DESCRIPTION)?; 97 | 98 | let (dprog_capabilities_startmenu, _) = dprog_capabilites.create_subkey("Startmenu")?; 99 | dprog_capabilities_startmenu.set_value("StartMenuInternet", &CANONICAL_NAME)?; 100 | 101 | // Register for various URL protocols that our target browsers might support. 102 | // (The list of protocols that Chrome registers for is actually quite large, including irc, mailto, mms, 103 | // etc, but let's do the most obvious/significant ones.) 104 | let (dprog_capabilities_urlassociations, _) = 105 | dprog_capabilites.create_subkey("URLAssociations")?; 106 | for protocol in &["bichrome", "ftp", "http", "https", "webcal"] { 107 | dprog_capabilities_urlassociations.set_value(protocol, &PROGID)?; 108 | } 109 | 110 | // Register for various file types, so that we'll be invoked for file:// URLs for these types (e.g. 111 | // by `cargo doc --open`.) 112 | let (dprog_capabilities_fileassociations, _) = 113 | dprog_capabilites.create_subkey("FileAssociations")?; 114 | for filetype in &[ 115 | ".htm", ".html", ".pdf", ".shtml", ".svg", ".webp", ".xht", ".xhtml", 116 | ] { 117 | dprog_capabilities_fileassociations.set_value(filetype, &PROGID)?; 118 | } 119 | 120 | let (dprog_defaulticon, _) = dprog.create_subkey("DefaultIcon")?; 121 | dprog_defaulticon.set_value("", &icon_path)?; 122 | 123 | // Set up reinstallation and show/hide icon commands (https://docs.microsoft.com/en-us/windows/win32/shell/reg-middleware-apps#registering-installation-information) 124 | let (dprog_installinfo, _) = dprog.create_subkey("InstallInfo")?; 125 | dprog_installinfo.set_value("ReinstallCommand", &format!("\"{}\" register", exe_path))?; 126 | dprog_installinfo.set_value("HideIconsCommand", &format!("\"{}\" hide-icons", exe_path))?; 127 | dprog_installinfo.set_value("ShowIconsCommand", &format!("\"{}\" show-icons", exe_path))?; 128 | 129 | // Only update IconsVisible if it hasn't been set already 130 | if dprog_installinfo 131 | .get_value::("IconsVisible") 132 | .is_err() 133 | { 134 | dprog_installinfo.set_value("IconsVisible", &1u32)?; 135 | } 136 | 137 | let (dprog_shell_open_command, _) = dprog.create_subkey(r"shell\open\command")?; 138 | dprog_shell_open_command.set_value("", &open_command)?; 139 | } 140 | 141 | // Set up a registered application for our Default Programs capabilities (https://docs.microsoft.com/en-us/windows/win32/shell/default-programs#registeredapplications) 142 | { 143 | let (registered_applications, _) = 144 | hkcu.create_subkey(r"SOFTWARE\RegisteredApplications")?; 145 | let dprog_capabilities_path = format!(r"{}\Capabilities", DPROG_PATH); 146 | registered_applications.set_value(DISPLAY_NAME, &dprog_capabilities_path)?; 147 | } 148 | 149 | // Application Registration (https://docs.microsoft.com/en-us/windows/win32/shell/app-registration) 150 | { 151 | let appreg_path = format!(r"{}{}", APPREG_BASE, exe_name); 152 | let (appreg, _) = hkcu.create_subkey(appreg_path)?; 153 | // This is used to resolve "bichrome.exe" -> full path, if needed. 154 | appreg.set_value("", &exe_path)?; 155 | // UseUrl indicates that we don't need the shell to download a file for us -- we can handle direct 156 | // HTTP URLs. 157 | appreg.set_value("UseUrl", &1u32)?; 158 | } 159 | 160 | refresh_shell(); 161 | 162 | Ok(()) 163 | } 164 | 165 | fn refresh_shell() { 166 | use windows::Win32::UI::Shell::{SHChangeNotify, SHCNE_ASSOCCHANGED, SHCNF_DWORD, SHCNF_FLUSH}; 167 | 168 | // Notify the shell about the updated URL associations. (https://docs.microsoft.com/en-us/windows/win32/shell/default-programs#becoming-the-default-browser) 169 | unsafe { 170 | SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_DWORD | SHCNF_FLUSH, None, None); 171 | } 172 | } 173 | 174 | /// Remove all the registry keys that we've set up 175 | fn unregister_urlhandler() { 176 | use std::env::current_exe; 177 | 178 | // Find the current executable's name, so we can unregister it 179 | let exe_name = current_exe() 180 | .unwrap() 181 | .file_name() 182 | .and_then(|s| s.to_str()) 183 | .unwrap_or_default() 184 | .to_owned(); 185 | 186 | let hkcu = RegKey::predef(HKEY_CURRENT_USER); 187 | let _ = hkcu.delete_subkey_all(DPROG_PATH); 188 | let _ = hkcu.delete_subkey_all(PROGID_PATH); 189 | let _ = hkcu.delete_subkey(REGISTERED_APPLICATIONS_PATH); 190 | let _ = hkcu.delete_subkey_all(format!("{}{}", APPREG_BASE, exe_name)); 191 | refresh_shell(); 192 | } 193 | 194 | /// Set the "IconsVisible" flag to true (we don't have any icons) 195 | fn show_icons() -> io::Result<()> { 196 | // The expectations for this are documented here: https://docs.microsoft.com/en-us/windows/win32/shell/reg-middleware-apps#the-show-icons-command 197 | let hkcu = RegKey::predef(HKEY_CURRENT_USER); 198 | let (dprog_installinfo, _) = hkcu.create_subkey(DPROG_INSTALLINFO_PATH)?; 199 | dprog_installinfo.set_value("IconsVisible", &1u32) 200 | } 201 | 202 | /// Set the "IconsVisible" flag to false (we don't have any icons) 203 | fn hide_icons() -> io::Result<()> { 204 | // The expectations for this are documented here: https://docs.microsoft.com/en-us/windows/win32/shell/reg-middleware-apps#the-hide-icons-command 205 | let hkcu = RegKey::predef(HKEY_CURRENT_USER); 206 | if let Ok(dprog_installinfo) = hkcu.open_subkey(DPROG_INSTALLINFO_PATH) { 207 | dprog_installinfo.set_value("IconsVisible", &0u32) 208 | } else { 209 | Ok(()) 210 | } 211 | } 212 | 213 | fn get_local_app_data_path() -> Option { 214 | use windows::Storage::UserDataPaths; 215 | if let Ok(user_data_paths) = UserDataPaths::GetDefault() { 216 | if let Ok(local_app_data_path) = user_data_paths.LocalAppData() { 217 | return Some(PathBuf::from(local_app_data_path.to_string())); 218 | } 219 | } 220 | 221 | None 222 | } 223 | 224 | /// Find the path to Chrome's "Local State" in the user's local app data folder 225 | pub fn get_chrome_local_state_path() -> Option { 226 | let app_data_relative = r"Google\Chrome\User Data\Local State"; 227 | get_local_app_data_path().map(|base| base.join(app_data_relative)) 228 | } 229 | 230 | // This is the definition of our command line options 231 | #[derive(Debug, StructOpt)] 232 | #[structopt( 233 | name = "bichrome", 234 | about = "A program to pick Chrome profile based on the URL opened" 235 | )] 236 | struct CommandOptions { 237 | /// Use verbose logging 238 | #[structopt(short, long)] 239 | verbose: bool, 240 | /// Use debug logging, even more verbose than --verbose 241 | #[structopt(long)] 242 | debug: bool, 243 | 244 | /// Do not launch Chrome, just log what would've been launched 245 | #[structopt(long)] 246 | dry_run: bool, 247 | 248 | /// Choose the mode of operation 249 | #[structopt(subcommand)] 250 | mode: Option, 251 | 252 | /// List of URLs to open 253 | urls: Vec, 254 | } 255 | 256 | #[derive(Debug, Clone, Copy, StructOpt)] 257 | enum ExecutionMode { 258 | /// Open the given URLs in the correct browser 259 | Open, 260 | /// Register bichrome as a valid browser 261 | Register, 262 | /// Remove previous registration of bichrome, if any 263 | Unregister, 264 | /// Show application icons (changes a registry key and nothing else, as we don't have icons) 265 | ShowIcons, 266 | /// Hide application icons (changes a registry key and nothing else, as we don't have icons) 267 | HideIcons, 268 | } 269 | 270 | fn get_exe_relative_path(filename: &str) -> io::Result { 271 | let mut path = std::env::current_exe()?; 272 | path.set_file_name(filename); 273 | Ok(path) 274 | } 275 | 276 | fn rotate_and_open_log(log_path: &Path) -> Result { 277 | if let Ok(log_info) = std::fs::metadata(log_path) { 278 | if log_info.len() > MAX_LOG_SIZE 279 | && std::fs::rename(log_path, log_path.with_extension("log.old")).is_err() 280 | && std::fs::remove_file(log_path).is_err() 281 | { 282 | return File::create(log_path); 283 | } 284 | } 285 | 286 | return OpenOptions::new().append(true).create(true).open(log_path); 287 | } 288 | 289 | fn init() -> Result { 290 | // First parse our command line options, so we can use it to configure the logging. 291 | let options = CommandOptions::from_args(); 292 | let log_level = if options.debug { 293 | LevelFilter::Trace 294 | } else if options.verbose { 295 | LevelFilter::Debug 296 | } else { 297 | LevelFilter::Info 298 | }; 299 | 300 | let log_path = get_exe_relative_path("bichrome.log")?; 301 | // Always log to bichrome.log 302 | let mut loggers: Vec> = vec![WriteLogger::new( 303 | log_level, 304 | Config::default(), 305 | rotate_and_open_log(&log_path)?, 306 | )]; 307 | // We only use the terminal logger in the debug build, since we don't allocate a console window otherwise. 308 | if cfg!(debug_assertions) { 309 | loggers.push(TermLogger::new( 310 | log_level, 311 | Config::default(), 312 | TerminalMode::Mixed, 313 | ColorChoice::Auto, 314 | )); 315 | }; 316 | 317 | CombinedLogger::init(loggers)?; 318 | trace!("command line options: {:?}", options); 319 | 320 | Ok(options) 321 | } 322 | 323 | fn read_config() -> io::Result { 324 | let config_path = get_exe_relative_path("bichrome_config.json")?; 325 | // We try to read the config, and otherwise just use an empty one instead. 326 | debug!("attempting to load config from {}", config_path.display()); 327 | let config = Configuration::read_from_file(&config_path); 328 | Ok(match config { 329 | Ok(config) => { 330 | trace!("config: {:#?}", config); 331 | config 332 | } 333 | Err(e) => { 334 | error!("failed to parse config: {:?}", e); 335 | warn!("opening URLs without profile"); 336 | Configuration::empty() 337 | } 338 | }) 339 | } 340 | 341 | pub fn main() -> Result<()> { 342 | let options = init()?; 343 | 344 | let mode = options.mode.unwrap_or(if options.urls.is_empty() { 345 | ExecutionMode::Register 346 | } else { 347 | ExecutionMode::Open 348 | }); 349 | 350 | if !matches!(mode, ExecutionMode::Open) && !options.urls.is_empty() { 351 | bail!( 352 | "Specified a list of URLs for mode {:?} which doesn't take URLs", 353 | mode 354 | ); 355 | } 356 | 357 | match mode { 358 | ExecutionMode::Register => { 359 | if options.dry_run { 360 | info!("(dry-run) would register URL handler") 361 | } else { 362 | info!("registering URL handler"); 363 | let extra_args = if options.debug { 364 | Some("--debug") 365 | } else if options.verbose { 366 | Some("--verbose") 367 | } else { 368 | None 369 | }; 370 | 371 | register_urlhandler(extra_args).context("Failed to register URL handler")?; 372 | } 373 | } 374 | ExecutionMode::Unregister => { 375 | if options.dry_run { 376 | info!("(dry-run) would unregister URL handler") 377 | } else { 378 | info!("unregistering URL handler"); 379 | unregister_urlhandler(); 380 | } 381 | } 382 | ExecutionMode::ShowIcons => { 383 | if options.dry_run { 384 | info!("(dry-run) would mark icons as visible") 385 | } else { 386 | info!("marking icons as visible"); 387 | show_icons().context("Failed to show icons")?; 388 | } 389 | } 390 | ExecutionMode::HideIcons => { 391 | if options.dry_run { 392 | info!("(dry-run) would mark icons as hidden") 393 | } else { 394 | info!("marking icons as hidden"); 395 | 396 | hide_icons().context("Failed to hide icons")?; 397 | } 398 | } 399 | ExecutionMode::Open => { 400 | let config = read_config()?; 401 | 402 | for url in options.urls { 403 | let browser = config.choose_browser(&url)?; 404 | let (exe, args) = match &browser { 405 | Browser::Chrome(profile) => { 406 | let mut args = Vec::new(); 407 | if let Some(argument) = profile.get_argument()? { 408 | args.push(argument); 409 | } 410 | args.push(url.to_string()); 411 | 412 | (get_exe_path("chrome.exe")?, args) 413 | } 414 | Browser::Firefox => (get_exe_path("firefox.exe")?, vec![url.to_string()]), 415 | Browser::OsDefault => (get_exe_path("msedge.exe")?, vec![url.to_string()]), 416 | Browser::Edge(profile) => { 417 | let mut args = Vec::new(); 418 | if let Some(argument) = profile.get_argument()? { 419 | args.push(argument); 420 | } 421 | args.push(url.to_string()); 422 | 423 | (get_exe_path("msedge.exe")?, args) 424 | } 425 | Browser::Safari => { 426 | bail!("Apple Safari not supported on Windows") 427 | } 428 | Browser::Executable(location) => (location.get_path(), vec![url.to_string()]) 429 | }; 430 | 431 | let commandline = format!("\"{}\" \"{}\"", exe.display(), args.join("\" \"")); 432 | if options.dry_run { 433 | info!("(dry-run) {}", commandline); 434 | } else { 435 | // Allow any process to steal focus from us, so that we will transfer focus "nicely" to 436 | // the browser. 437 | use windows::Win32::UI::WindowsAndMessaging::{ 438 | AllowSetForegroundWindow, ASFW_ANY, 439 | }; 440 | unsafe { 441 | if let Err(error) = AllowSetForegroundWindow(ASFW_ANY) { 442 | warn!("Could not `AllowSetForegroundWindow`: {error:?}"); 443 | } 444 | } 445 | 446 | // Let's not log the URL to the logs by default, so there's not a gross log file 447 | // the user might not be aware of inadvertently 'tracking' their browsing activity. 448 | info!("picked {:?}", &browser); 449 | debug!("launching {}", commandline); 450 | Command::new(&exe) 451 | .stdout(Stdio::null()) 452 | .stdin(Stdio::null()) 453 | .stderr(Stdio::null()) 454 | .args(args) 455 | .spawn() 456 | .with_context(|| { 457 | format!( 458 | "Failed to launch browser {:?} for URL {}, attempted command {}", 459 | &browser, url, commandline 460 | ) 461 | })?; 462 | } 463 | } 464 | } 465 | } 466 | 467 | Ok(()) 468 | } 469 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "aho-corasick" 7 | version = "1.1.2" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" 10 | dependencies = [ 11 | "memchr", 12 | ] 13 | 14 | [[package]] 15 | name = "ansi_term" 16 | version = "0.12.1" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" 19 | dependencies = [ 20 | "winapi", 21 | ] 22 | 23 | [[package]] 24 | name = "anyhow" 25 | version = "1.0.79" 26 | source = "registry+https://github.com/rust-lang/crates.io-index" 27 | checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" 28 | 29 | [[package]] 30 | name = "atty" 31 | version = "0.2.14" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 34 | dependencies = [ 35 | "hermit-abi", 36 | "libc", 37 | "winapi", 38 | ] 39 | 40 | [[package]] 41 | name = "bichrome" 42 | version = "0.8.0" 43 | dependencies = [ 44 | "anyhow", 45 | "const_format", 46 | "fruitbasket", 47 | "log", 48 | "serde", 49 | "serde_json", 50 | "simplelog", 51 | "structopt", 52 | "thiserror", 53 | "url", 54 | "webextension_pattern", 55 | "windows", 56 | "winreg", 57 | "winres", 58 | ] 59 | 60 | [[package]] 61 | name = "bitflags" 62 | version = "1.3.2" 63 | source = "registry+https://github.com/rust-lang/crates.io-index" 64 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 65 | 66 | [[package]] 67 | name = "bitflags" 68 | version = "2.4.2" 69 | source = "registry+https://github.com/rust-lang/crates.io-index" 70 | checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" 71 | 72 | [[package]] 73 | name = "block" 74 | version = "0.1.6" 75 | source = "registry+https://github.com/rust-lang/crates.io-index" 76 | checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" 77 | 78 | [[package]] 79 | name = "cc" 80 | version = "1.0.83" 81 | source = "registry+https://github.com/rust-lang/crates.io-index" 82 | checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" 83 | dependencies = [ 84 | "libc", 85 | ] 86 | 87 | [[package]] 88 | name = "cfg-if" 89 | version = "0.1.10" 90 | source = "registry+https://github.com/rust-lang/crates.io-index" 91 | checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 92 | 93 | [[package]] 94 | name = "cfg-if" 95 | version = "1.0.0" 96 | source = "registry+https://github.com/rust-lang/crates.io-index" 97 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 98 | 99 | [[package]] 100 | name = "clap" 101 | version = "2.34.0" 102 | source = "registry+https://github.com/rust-lang/crates.io-index" 103 | checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" 104 | dependencies = [ 105 | "ansi_term", 106 | "atty", 107 | "bitflags 1.3.2", 108 | "strsim", 109 | "textwrap", 110 | "unicode-width", 111 | "vec_map", 112 | ] 113 | 114 | [[package]] 115 | name = "const_format" 116 | version = "0.2.32" 117 | source = "registry+https://github.com/rust-lang/crates.io-index" 118 | checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673" 119 | dependencies = [ 120 | "const_format_proc_macros", 121 | ] 122 | 123 | [[package]] 124 | name = "const_format_proc_macros" 125 | version = "0.2.32" 126 | source = "registry+https://github.com/rust-lang/crates.io-index" 127 | checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500" 128 | dependencies = [ 129 | "proc-macro2", 130 | "quote", 131 | "unicode-xid", 132 | ] 133 | 134 | [[package]] 135 | name = "deranged" 136 | version = "0.3.11" 137 | source = "registry+https://github.com/rust-lang/crates.io-index" 138 | checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" 139 | dependencies = [ 140 | "powerfmt", 141 | ] 142 | 143 | [[package]] 144 | name = "dirs" 145 | version = "2.0.2" 146 | source = "registry+https://github.com/rust-lang/crates.io-index" 147 | checksum = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" 148 | dependencies = [ 149 | "cfg-if 0.1.10", 150 | "dirs-sys", 151 | ] 152 | 153 | [[package]] 154 | name = "dirs-sys" 155 | version = "0.3.7" 156 | source = "registry+https://github.com/rust-lang/crates.io-index" 157 | checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" 158 | dependencies = [ 159 | "libc", 160 | "redox_users", 161 | "winapi", 162 | ] 163 | 164 | [[package]] 165 | name = "form_urlencoded" 166 | version = "1.2.1" 167 | source = "registry+https://github.com/rust-lang/crates.io-index" 168 | checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" 169 | dependencies = [ 170 | "percent-encoding", 171 | ] 172 | 173 | [[package]] 174 | name = "fruitbasket" 175 | version = "0.10.0" 176 | source = "registry+https://github.com/rust-lang/crates.io-index" 177 | checksum = "898289b8e0528c84fb9b88f15ac9d5109bcaf23e0e49bb6f64deee0d86b6a351" 178 | dependencies = [ 179 | "dirs", 180 | "objc", 181 | "objc-foundation", 182 | "objc_id", 183 | "time 0.1.45", 184 | ] 185 | 186 | [[package]] 187 | name = "getrandom" 188 | version = "0.2.12" 189 | source = "registry+https://github.com/rust-lang/crates.io-index" 190 | checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" 191 | dependencies = [ 192 | "cfg-if 1.0.0", 193 | "libc", 194 | "wasi 0.11.0+wasi-snapshot-preview1", 195 | ] 196 | 197 | [[package]] 198 | name = "heck" 199 | version = "0.3.3" 200 | source = "registry+https://github.com/rust-lang/crates.io-index" 201 | checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" 202 | dependencies = [ 203 | "unicode-segmentation", 204 | ] 205 | 206 | [[package]] 207 | name = "hermit-abi" 208 | version = "0.1.19" 209 | source = "registry+https://github.com/rust-lang/crates.io-index" 210 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 211 | dependencies = [ 212 | "libc", 213 | ] 214 | 215 | [[package]] 216 | name = "idna" 217 | version = "0.5.0" 218 | source = "registry+https://github.com/rust-lang/crates.io-index" 219 | checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" 220 | dependencies = [ 221 | "unicode-bidi", 222 | "unicode-normalization", 223 | ] 224 | 225 | [[package]] 226 | name = "itoa" 227 | version = "1.0.10" 228 | source = "registry+https://github.com/rust-lang/crates.io-index" 229 | checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" 230 | 231 | [[package]] 232 | name = "lazy_static" 233 | version = "1.4.0" 234 | source = "registry+https://github.com/rust-lang/crates.io-index" 235 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 236 | 237 | [[package]] 238 | name = "libc" 239 | version = "0.2.153" 240 | source = "registry+https://github.com/rust-lang/crates.io-index" 241 | checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" 242 | 243 | [[package]] 244 | name = "libredox" 245 | version = "0.0.1" 246 | source = "registry+https://github.com/rust-lang/crates.io-index" 247 | checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" 248 | dependencies = [ 249 | "bitflags 2.4.2", 250 | "libc", 251 | "redox_syscall", 252 | ] 253 | 254 | [[package]] 255 | name = "log" 256 | version = "0.4.20" 257 | source = "registry+https://github.com/rust-lang/crates.io-index" 258 | checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" 259 | 260 | [[package]] 261 | name = "malloc_buf" 262 | version = "0.0.6" 263 | source = "registry+https://github.com/rust-lang/crates.io-index" 264 | checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" 265 | dependencies = [ 266 | "libc", 267 | ] 268 | 269 | [[package]] 270 | name = "memchr" 271 | version = "2.7.1" 272 | source = "registry+https://github.com/rust-lang/crates.io-index" 273 | checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" 274 | 275 | [[package]] 276 | name = "num-conv" 277 | version = "0.1.0" 278 | source = "registry+https://github.com/rust-lang/crates.io-index" 279 | checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" 280 | 281 | [[package]] 282 | name = "num_threads" 283 | version = "0.1.6" 284 | source = "registry+https://github.com/rust-lang/crates.io-index" 285 | checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" 286 | dependencies = [ 287 | "libc", 288 | ] 289 | 290 | [[package]] 291 | name = "objc" 292 | version = "0.2.7" 293 | source = "registry+https://github.com/rust-lang/crates.io-index" 294 | checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" 295 | dependencies = [ 296 | "malloc_buf", 297 | "objc_exception", 298 | ] 299 | 300 | [[package]] 301 | name = "objc-foundation" 302 | version = "0.1.1" 303 | source = "registry+https://github.com/rust-lang/crates.io-index" 304 | checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" 305 | dependencies = [ 306 | "block", 307 | "objc", 308 | "objc_id", 309 | ] 310 | 311 | [[package]] 312 | name = "objc_exception" 313 | version = "0.1.2" 314 | source = "registry+https://github.com/rust-lang/crates.io-index" 315 | checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" 316 | dependencies = [ 317 | "cc", 318 | ] 319 | 320 | [[package]] 321 | name = "objc_id" 322 | version = "0.1.1" 323 | source = "registry+https://github.com/rust-lang/crates.io-index" 324 | checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" 325 | dependencies = [ 326 | "objc", 327 | ] 328 | 329 | [[package]] 330 | name = "percent-encoding" 331 | version = "2.3.1" 332 | source = "registry+https://github.com/rust-lang/crates.io-index" 333 | checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" 334 | 335 | [[package]] 336 | name = "powerfmt" 337 | version = "0.2.0" 338 | source = "registry+https://github.com/rust-lang/crates.io-index" 339 | checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" 340 | 341 | [[package]] 342 | name = "proc-macro-error" 343 | version = "1.0.4" 344 | source = "registry+https://github.com/rust-lang/crates.io-index" 345 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" 346 | dependencies = [ 347 | "proc-macro-error-attr", 348 | "proc-macro2", 349 | "quote", 350 | "syn 1.0.109", 351 | "version_check", 352 | ] 353 | 354 | [[package]] 355 | name = "proc-macro-error-attr" 356 | version = "1.0.4" 357 | source = "registry+https://github.com/rust-lang/crates.io-index" 358 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" 359 | dependencies = [ 360 | "proc-macro2", 361 | "quote", 362 | "version_check", 363 | ] 364 | 365 | [[package]] 366 | name = "proc-macro2" 367 | version = "1.0.78" 368 | source = "registry+https://github.com/rust-lang/crates.io-index" 369 | checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" 370 | dependencies = [ 371 | "unicode-ident", 372 | ] 373 | 374 | [[package]] 375 | name = "quote" 376 | version = "1.0.35" 377 | source = "registry+https://github.com/rust-lang/crates.io-index" 378 | checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" 379 | dependencies = [ 380 | "proc-macro2", 381 | ] 382 | 383 | [[package]] 384 | name = "redox_syscall" 385 | version = "0.4.1" 386 | source = "registry+https://github.com/rust-lang/crates.io-index" 387 | checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" 388 | dependencies = [ 389 | "bitflags 1.3.2", 390 | ] 391 | 392 | [[package]] 393 | name = "redox_users" 394 | version = "0.4.4" 395 | source = "registry+https://github.com/rust-lang/crates.io-index" 396 | checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" 397 | dependencies = [ 398 | "getrandom", 399 | "libredox", 400 | "thiserror", 401 | ] 402 | 403 | [[package]] 404 | name = "regex" 405 | version = "1.10.3" 406 | source = "registry+https://github.com/rust-lang/crates.io-index" 407 | checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" 408 | dependencies = [ 409 | "aho-corasick", 410 | "memchr", 411 | "regex-automata", 412 | "regex-syntax 0.8.2", 413 | ] 414 | 415 | [[package]] 416 | name = "regex-automata" 417 | version = "0.4.5" 418 | source = "registry+https://github.com/rust-lang/crates.io-index" 419 | checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" 420 | dependencies = [ 421 | "aho-corasick", 422 | "memchr", 423 | "regex-syntax 0.8.2", 424 | ] 425 | 426 | [[package]] 427 | name = "regex-syntax" 428 | version = "0.6.29" 429 | source = "registry+https://github.com/rust-lang/crates.io-index" 430 | checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" 431 | 432 | [[package]] 433 | name = "regex-syntax" 434 | version = "0.8.2" 435 | source = "registry+https://github.com/rust-lang/crates.io-index" 436 | checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" 437 | 438 | [[package]] 439 | name = "ryu" 440 | version = "1.0.16" 441 | source = "registry+https://github.com/rust-lang/crates.io-index" 442 | checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" 443 | 444 | [[package]] 445 | name = "serde" 446 | version = "1.0.196" 447 | source = "registry+https://github.com/rust-lang/crates.io-index" 448 | checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" 449 | dependencies = [ 450 | "serde_derive", 451 | ] 452 | 453 | [[package]] 454 | name = "serde_derive" 455 | version = "1.0.196" 456 | source = "registry+https://github.com/rust-lang/crates.io-index" 457 | checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" 458 | dependencies = [ 459 | "proc-macro2", 460 | "quote", 461 | "syn 2.0.48", 462 | ] 463 | 464 | [[package]] 465 | name = "serde_json" 466 | version = "1.0.113" 467 | source = "registry+https://github.com/rust-lang/crates.io-index" 468 | checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" 469 | dependencies = [ 470 | "itoa", 471 | "ryu", 472 | "serde", 473 | ] 474 | 475 | [[package]] 476 | name = "simplelog" 477 | version = "0.12.1" 478 | source = "registry+https://github.com/rust-lang/crates.io-index" 479 | checksum = "acee08041c5de3d5048c8b3f6f13fafb3026b24ba43c6a695a0c76179b844369" 480 | dependencies = [ 481 | "log", 482 | "termcolor", 483 | "time 0.3.34", 484 | ] 485 | 486 | [[package]] 487 | name = "strsim" 488 | version = "0.8.0" 489 | source = "registry+https://github.com/rust-lang/crates.io-index" 490 | checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" 491 | 492 | [[package]] 493 | name = "structopt" 494 | version = "0.3.26" 495 | source = "registry+https://github.com/rust-lang/crates.io-index" 496 | checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" 497 | dependencies = [ 498 | "clap", 499 | "lazy_static", 500 | "structopt-derive", 501 | ] 502 | 503 | [[package]] 504 | name = "structopt-derive" 505 | version = "0.4.18" 506 | source = "registry+https://github.com/rust-lang/crates.io-index" 507 | checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" 508 | dependencies = [ 509 | "heck", 510 | "proc-macro-error", 511 | "proc-macro2", 512 | "quote", 513 | "syn 1.0.109", 514 | ] 515 | 516 | [[package]] 517 | name = "syn" 518 | version = "1.0.109" 519 | source = "registry+https://github.com/rust-lang/crates.io-index" 520 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 521 | dependencies = [ 522 | "proc-macro2", 523 | "quote", 524 | "unicode-ident", 525 | ] 526 | 527 | [[package]] 528 | name = "syn" 529 | version = "2.0.48" 530 | source = "registry+https://github.com/rust-lang/crates.io-index" 531 | checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" 532 | dependencies = [ 533 | "proc-macro2", 534 | "quote", 535 | "unicode-ident", 536 | ] 537 | 538 | [[package]] 539 | name = "termcolor" 540 | version = "1.1.3" 541 | source = "registry+https://github.com/rust-lang/crates.io-index" 542 | checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" 543 | dependencies = [ 544 | "winapi-util", 545 | ] 546 | 547 | [[package]] 548 | name = "textwrap" 549 | version = "0.11.0" 550 | source = "registry+https://github.com/rust-lang/crates.io-index" 551 | checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" 552 | dependencies = [ 553 | "unicode-width", 554 | ] 555 | 556 | [[package]] 557 | name = "thiserror" 558 | version = "1.0.56" 559 | source = "registry+https://github.com/rust-lang/crates.io-index" 560 | checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" 561 | dependencies = [ 562 | "thiserror-impl", 563 | ] 564 | 565 | [[package]] 566 | name = "thiserror-impl" 567 | version = "1.0.56" 568 | source = "registry+https://github.com/rust-lang/crates.io-index" 569 | checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" 570 | dependencies = [ 571 | "proc-macro2", 572 | "quote", 573 | "syn 2.0.48", 574 | ] 575 | 576 | [[package]] 577 | name = "time" 578 | version = "0.1.45" 579 | source = "registry+https://github.com/rust-lang/crates.io-index" 580 | checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" 581 | dependencies = [ 582 | "libc", 583 | "wasi 0.10.0+wasi-snapshot-preview1", 584 | "winapi", 585 | ] 586 | 587 | [[package]] 588 | name = "time" 589 | version = "0.3.34" 590 | source = "registry+https://github.com/rust-lang/crates.io-index" 591 | checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" 592 | dependencies = [ 593 | "deranged", 594 | "itoa", 595 | "libc", 596 | "num-conv", 597 | "num_threads", 598 | "powerfmt", 599 | "serde", 600 | "time-core", 601 | "time-macros", 602 | ] 603 | 604 | [[package]] 605 | name = "time-core" 606 | version = "0.1.2" 607 | source = "registry+https://github.com/rust-lang/crates.io-index" 608 | checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" 609 | 610 | [[package]] 611 | name = "time-macros" 612 | version = "0.2.17" 613 | source = "registry+https://github.com/rust-lang/crates.io-index" 614 | checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" 615 | dependencies = [ 616 | "num-conv", 617 | "time-core", 618 | ] 619 | 620 | [[package]] 621 | name = "tinyvec" 622 | version = "1.6.0" 623 | source = "registry+https://github.com/rust-lang/crates.io-index" 624 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" 625 | dependencies = [ 626 | "tinyvec_macros", 627 | ] 628 | 629 | [[package]] 630 | name = "tinyvec_macros" 631 | version = "0.1.1" 632 | source = "registry+https://github.com/rust-lang/crates.io-index" 633 | checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" 634 | 635 | [[package]] 636 | name = "toml" 637 | version = "0.5.11" 638 | source = "registry+https://github.com/rust-lang/crates.io-index" 639 | checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" 640 | dependencies = [ 641 | "serde", 642 | ] 643 | 644 | [[package]] 645 | name = "unicode-bidi" 646 | version = "0.3.15" 647 | source = "registry+https://github.com/rust-lang/crates.io-index" 648 | checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" 649 | 650 | [[package]] 651 | name = "unicode-ident" 652 | version = "1.0.12" 653 | source = "registry+https://github.com/rust-lang/crates.io-index" 654 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 655 | 656 | [[package]] 657 | name = "unicode-normalization" 658 | version = "0.1.22" 659 | source = "registry+https://github.com/rust-lang/crates.io-index" 660 | checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" 661 | dependencies = [ 662 | "tinyvec", 663 | ] 664 | 665 | [[package]] 666 | name = "unicode-segmentation" 667 | version = "1.11.0" 668 | source = "registry+https://github.com/rust-lang/crates.io-index" 669 | checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" 670 | 671 | [[package]] 672 | name = "unicode-width" 673 | version = "0.1.11" 674 | source = "registry+https://github.com/rust-lang/crates.io-index" 675 | checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" 676 | 677 | [[package]] 678 | name = "unicode-xid" 679 | version = "0.2.4" 680 | source = "registry+https://github.com/rust-lang/crates.io-index" 681 | checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" 682 | 683 | [[package]] 684 | name = "url" 685 | version = "2.5.0" 686 | source = "registry+https://github.com/rust-lang/crates.io-index" 687 | checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" 688 | dependencies = [ 689 | "form_urlencoded", 690 | "idna", 691 | "percent-encoding", 692 | ] 693 | 694 | [[package]] 695 | name = "vec_map" 696 | version = "0.8.2" 697 | source = "registry+https://github.com/rust-lang/crates.io-index" 698 | checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" 699 | 700 | [[package]] 701 | name = "version_check" 702 | version = "0.9.4" 703 | source = "registry+https://github.com/rust-lang/crates.io-index" 704 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 705 | 706 | [[package]] 707 | name = "wasi" 708 | version = "0.10.0+wasi-snapshot-preview1" 709 | source = "registry+https://github.com/rust-lang/crates.io-index" 710 | checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" 711 | 712 | [[package]] 713 | name = "wasi" 714 | version = "0.11.0+wasi-snapshot-preview1" 715 | source = "registry+https://github.com/rust-lang/crates.io-index" 716 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 717 | 718 | [[package]] 719 | name = "webextension_pattern" 720 | version = "0.3.0" 721 | source = "registry+https://github.com/rust-lang/crates.io-index" 722 | checksum = "48a667877f0f82e205c49c21b8b09d8c88786db1c61bdb447676708ab2d98842" 723 | dependencies = [ 724 | "regex", 725 | "regex-syntax 0.6.29", 726 | "serde", 727 | "thiserror", 728 | "url", 729 | ] 730 | 731 | [[package]] 732 | name = "winapi" 733 | version = "0.3.9" 734 | source = "registry+https://github.com/rust-lang/crates.io-index" 735 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 736 | dependencies = [ 737 | "winapi-i686-pc-windows-gnu", 738 | "winapi-x86_64-pc-windows-gnu", 739 | ] 740 | 741 | [[package]] 742 | name = "winapi-i686-pc-windows-gnu" 743 | version = "0.4.0" 744 | source = "registry+https://github.com/rust-lang/crates.io-index" 745 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 746 | 747 | [[package]] 748 | name = "winapi-util" 749 | version = "0.1.6" 750 | source = "registry+https://github.com/rust-lang/crates.io-index" 751 | checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" 752 | dependencies = [ 753 | "winapi", 754 | ] 755 | 756 | [[package]] 757 | name = "winapi-x86_64-pc-windows-gnu" 758 | version = "0.4.0" 759 | source = "registry+https://github.com/rust-lang/crates.io-index" 760 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 761 | 762 | [[package]] 763 | name = "windows" 764 | version = "0.52.0" 765 | source = "registry+https://github.com/rust-lang/crates.io-index" 766 | checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" 767 | dependencies = [ 768 | "windows-core", 769 | "windows-targets 0.52.0", 770 | ] 771 | 772 | [[package]] 773 | name = "windows-core" 774 | version = "0.52.0" 775 | source = "registry+https://github.com/rust-lang/crates.io-index" 776 | checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" 777 | dependencies = [ 778 | "windows-targets 0.52.0", 779 | ] 780 | 781 | [[package]] 782 | name = "windows-sys" 783 | version = "0.48.0" 784 | source = "registry+https://github.com/rust-lang/crates.io-index" 785 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 786 | dependencies = [ 787 | "windows-targets 0.48.5", 788 | ] 789 | 790 | [[package]] 791 | name = "windows-targets" 792 | version = "0.48.5" 793 | source = "registry+https://github.com/rust-lang/crates.io-index" 794 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 795 | dependencies = [ 796 | "windows_aarch64_gnullvm 0.48.5", 797 | "windows_aarch64_msvc 0.48.5", 798 | "windows_i686_gnu 0.48.5", 799 | "windows_i686_msvc 0.48.5", 800 | "windows_x86_64_gnu 0.48.5", 801 | "windows_x86_64_gnullvm 0.48.5", 802 | "windows_x86_64_msvc 0.48.5", 803 | ] 804 | 805 | [[package]] 806 | name = "windows-targets" 807 | version = "0.52.0" 808 | source = "registry+https://github.com/rust-lang/crates.io-index" 809 | checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" 810 | dependencies = [ 811 | "windows_aarch64_gnullvm 0.52.0", 812 | "windows_aarch64_msvc 0.52.0", 813 | "windows_i686_gnu 0.52.0", 814 | "windows_i686_msvc 0.52.0", 815 | "windows_x86_64_gnu 0.52.0", 816 | "windows_x86_64_gnullvm 0.52.0", 817 | "windows_x86_64_msvc 0.52.0", 818 | ] 819 | 820 | [[package]] 821 | name = "windows_aarch64_gnullvm" 822 | version = "0.48.5" 823 | source = "registry+https://github.com/rust-lang/crates.io-index" 824 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 825 | 826 | [[package]] 827 | name = "windows_aarch64_gnullvm" 828 | version = "0.52.0" 829 | source = "registry+https://github.com/rust-lang/crates.io-index" 830 | checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" 831 | 832 | [[package]] 833 | name = "windows_aarch64_msvc" 834 | version = "0.48.5" 835 | source = "registry+https://github.com/rust-lang/crates.io-index" 836 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 837 | 838 | [[package]] 839 | name = "windows_aarch64_msvc" 840 | version = "0.52.0" 841 | source = "registry+https://github.com/rust-lang/crates.io-index" 842 | checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" 843 | 844 | [[package]] 845 | name = "windows_i686_gnu" 846 | version = "0.48.5" 847 | source = "registry+https://github.com/rust-lang/crates.io-index" 848 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 849 | 850 | [[package]] 851 | name = "windows_i686_gnu" 852 | version = "0.52.0" 853 | source = "registry+https://github.com/rust-lang/crates.io-index" 854 | checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" 855 | 856 | [[package]] 857 | name = "windows_i686_msvc" 858 | version = "0.48.5" 859 | source = "registry+https://github.com/rust-lang/crates.io-index" 860 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 861 | 862 | [[package]] 863 | name = "windows_i686_msvc" 864 | version = "0.52.0" 865 | source = "registry+https://github.com/rust-lang/crates.io-index" 866 | checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" 867 | 868 | [[package]] 869 | name = "windows_x86_64_gnu" 870 | version = "0.48.5" 871 | source = "registry+https://github.com/rust-lang/crates.io-index" 872 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 873 | 874 | [[package]] 875 | name = "windows_x86_64_gnu" 876 | version = "0.52.0" 877 | source = "registry+https://github.com/rust-lang/crates.io-index" 878 | checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" 879 | 880 | [[package]] 881 | name = "windows_x86_64_gnullvm" 882 | version = "0.48.5" 883 | source = "registry+https://github.com/rust-lang/crates.io-index" 884 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 885 | 886 | [[package]] 887 | name = "windows_x86_64_gnullvm" 888 | version = "0.52.0" 889 | source = "registry+https://github.com/rust-lang/crates.io-index" 890 | checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" 891 | 892 | [[package]] 893 | name = "windows_x86_64_msvc" 894 | version = "0.48.5" 895 | source = "registry+https://github.com/rust-lang/crates.io-index" 896 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 897 | 898 | [[package]] 899 | name = "windows_x86_64_msvc" 900 | version = "0.52.0" 901 | source = "registry+https://github.com/rust-lang/crates.io-index" 902 | checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" 903 | 904 | [[package]] 905 | name = "winreg" 906 | version = "0.52.0" 907 | source = "registry+https://github.com/rust-lang/crates.io-index" 908 | checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" 909 | dependencies = [ 910 | "cfg-if 1.0.0", 911 | "windows-sys", 912 | ] 913 | 914 | [[package]] 915 | name = "winres" 916 | version = "0.1.12" 917 | source = "registry+https://github.com/rust-lang/crates.io-index" 918 | checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c" 919 | dependencies = [ 920 | "toml", 921 | ] 922 | --------------------------------------------------------------------------------