-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c47bb6
commit 6eee313
Showing
7 changed files
with
86 additions
and
25 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
mod crx3; | ||
|
||
#[cfg(not(target_os = "windows"))] | ||
mod unix; | ||
#[cfg(not(target_os = "windows"))] | ||
pub use unix::install; | ||
|
||
#[cfg(target_os = "windows")] | ||
mod windows; | ||
#[cfg(target_os = "windows")] | ||
pub use windows::install; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use anyhow::Result; | ||
use reqwest_middleware::ClientWithMiddleware; | ||
use std::path::PathBuf; | ||
use tracing::info; | ||
|
||
pub async fn install( | ||
_client: ClientWithMiddleware, | ||
_base_url: Option<String>, | ||
extension_id: String, | ||
_dest_dir: PathBuf, | ||
_profiles: Vec<PathBuf>, | ||
) -> Result<()> { | ||
let hklm = winreg::RegKey::predef(winreg::enums::HKEY_LOCAL_MACHINE); | ||
let os_arch = std::env::var("PROCESSOR_ARCHITECTURE").unwrap_or_default(); | ||
let base_key_path = if os_arch == "AMD64" { | ||
"Software\\Wow6432Node\\Google\\Chrome\\Extensions" | ||
} else { | ||
"Software\\Google\\Chrome\\Extensions" | ||
}; | ||
|
||
let mut path = String::with_capacity(base_key_path.len() + 2 + extension_id.len()); | ||
path.push_str(base_key_path); | ||
path.push('\\'); | ||
path.push_str(&extension_id); | ||
|
||
let (key, disp) = hklm.create_subkey(path)?; | ||
if disp == winreg::enums::RegDisposition::REG_CREATED_NEW_KEY { | ||
key.set_value( | ||
"update_url", | ||
&"https://clients2.google.com/service/update2/crx", | ||
)?; | ||
info!("Installed extension {extension_id}"); | ||
} else { | ||
info!("Extension {extension_id} already installed"); | ||
} | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters