Skip to content

Commit

Permalink
Feat/arc (#36)
Browse files Browse the repository at this point in the history
* setup arc browser

* fix arc paths on windows

* update to 0.5.2-beta.0
  • Loading branch information
thewh1teagle authored Jul 1, 2024
1 parent c5fad2f commit e6a9371
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bindings/node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "thewh1teagle_rookie"
version = "0.5.1"
version = "0.5.2-beta.0"

[lib]
crate-type = ["cdylib"]
Expand Down
4 changes: 2 additions & 2 deletions bindings/node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rookie-rs/api",
"version": "0.5.1-beta.0",
"version": "0.5.2-beta.0",
"main": "index.js",
"types": "index.d.ts",
"napi": {
Expand Down Expand Up @@ -40,4 +40,4 @@
},
"repository": "https://github.com/thewh1teagle/rookie",
"description": "Load cookies from any browser on any platform"
}
}
8 changes: 8 additions & 0 deletions bindings/node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ pub fn brave(domains: Option<Vec<String>>) -> Result<Vec<CookieObject>> {
cookies_to_js(cookies)
}

#[napi]
pub fn arc(domains: Option<Vec<String>>) -> Result<Vec<CookieObject>> {
let cookies =
rookie::arc(domains).map_err(|e| napi::Error::new(Status::Unknown, format!("{e:?}")))?;

cookies_to_js(cookies)
}

#[napi]
pub fn edge(domains: Option<Vec<String>>) -> Result<Vec<CookieObject>> {
let cookies =
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rookiepy"
version = "0.5.1"
version = "0.5.2-beta.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
8 changes: 8 additions & 0 deletions bindings/python/src/browsers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ pub fn chrome(py: Python, domains: Option<Vec<String>>) -> PyResult<Vec<PyObject
Ok(cookies)
}

#[pyfunction]
pub fn arc(py: Python, domains: Option<Vec<String>>) -> PyResult<Vec<PyObject>> {
let cookies = rookie::arc(domains)?;
let cookies = to_dict(py, cookies)?;

Ok(cookies)
}

#[pyfunction]
pub fn brave(py: Python, domains: Option<Vec<String>>) -> PyResult<Vec<PyObject>> {
let cookies = rookie::brave(domains)?;
Expand Down
1 change: 1 addition & 0 deletions bindings/python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ fn rookiepy(_py: Python, m: &PyModule) -> PyResult<()> {

m.add_function(wrap_pyfunction!(chromium, m)?)?;
m.add_function(wrap_pyfunction!(vivaldi, m)?)?;
m.add_function(wrap_pyfunction!(arc, m)?)?;
m.add_function(wrap_pyfunction!(chromium_based, m)?)?;
m.add_function(wrap_pyfunction!(firefox_based, m)?)?;
m.add_function(wrap_pyfunction!(load, m)?)?;
Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cli"
version = "0.5.1"
version = "0.5.2-beta.0"
edition = "2021"

[dependencies]
Expand Down
2 changes: 2 additions & 0 deletions cli/src/browsers_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ lazy_static! {

map.insert("vivaldi".into(), rookie::vivaldi);

map.insert("arc".into(), rookie::arc);

map
};
}
Expand Down
2 changes: 1 addition & 1 deletion rookie-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rookie"
version = "0.5.1"
version = "0.5.2-beta.0"
edition = "2021"
description = "Load cookie from your web browsers"
license-file = "MIT-LICENSE.txt"
Expand Down
25 changes: 25 additions & 0 deletions rookie-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,31 @@ pub fn brave(domains: Option<Vec<String>>) -> Result<Vec<Cookie>> {
}
}

/// Returns cookies from Arc
///
/// # Arguments
///
/// * `domains` - A optional list that for getting specific domains only
///
/// # Examples
///
/// ```
/// let domains = vec!["google.com"];
/// let cookies = rookie::brave(Some(domains));
/// ```
pub fn arc(domains: Option<Vec<String>>) -> Result<Vec<Cookie>> {
#[cfg(target_os = "windows")]
{
let (key, db_path) = paths::find_chrome_based_paths(&config::ARC_CONFIG)?;
chromium_based(key, db_path, domains)
}
#[cfg(unix)]
{
let (_, db_path) = paths::find_chrome_based_paths(&config::ARC_CONFIG)?;
chromium_based(&config::ARC_CONFIG, db_path, domains)
}
}

/// Returns cookies from Edge
///
/// # Arguments
Expand Down
14 changes: 14 additions & 0 deletions rookie-rs/src/linux/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,20 @@ pub static CHROMIUM_CONFIG: BrowserConfig<'static> = BrowserConfig {
osx_key_user: None,
};

pub static ARC_CONFIG: BrowserConfig<'static> = BrowserConfig {
data_paths: &[
"~/snap/arc/common/arc/Default/Cookies",
"~/.config/arc/Default/Cookies",
"~/.config/arc/Profile */Cookies",
"~/.var/app/org.arc.Arc/config/arc/Default/Cookies",
"~/.var/app/org.arc.Arc/config/arc/Profile */Cookies",
],
channels: None,
os_crypt_name: Some("arc"),
osx_key_service: None,
osx_key_user: None,
};

pub static FIREFOX_CONFIG: BrowserConfig<'static> = BrowserConfig {
data_paths: &[
"~/snap/firefox/common/.mozilla/firefox",
Expand Down
11 changes: 11 additions & 0 deletions rookie-rs/src/macos/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ pub static CHROMIUM_CONFIG: BrowserConfig<'static> = BrowserConfig {
osx_key_user: Some("Chromium"),
};

pub static ARC_CONFIG: BrowserConfig<'static> = BrowserConfig {
data_paths: &[
"~/Library/Application Support/Arc/User Data/Default/Cookies",
"~/Library/Application Support/Arc/User Data/Profile */Cookies",
],
channels: Some(&["", "-beta", "-dev", "-nightly"]),
os_crypt_name: Some("arc"),
osx_key_service: Some("Arc Safe Storage"),
osx_key_user: Some("Arc"),
};

pub static OPERA_GX_CONFIG: BrowserConfig<'static> = BrowserConfig {
data_paths: &["~/Library/Application Support/com.operasoftware.OperaGX/Cookies"],
channels: Some(&["Stable", ""]),
Expand Down
11 changes: 11 additions & 0 deletions rookie-rs/src/windows/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,17 @@ pub static CHROMIUM_CONFIG: BrowserConfig<'static> = BrowserConfig {
osx_key_user: None,
};

pub static ARC_CONFIG: BrowserConfig<'static> = BrowserConfig {
data_paths: &[
"%LOCALAPPDATA%/Packages/TheBrowserCompany.Arc*/LocalCache/Local/Arc/User Data/Default/Network/Cookies",
"%LOCALAPPDATA%/Packages/TheBrowserCompany.Arc*/LocalCache/Local/Arc/User Data/Profile */Network/Cookies",
],
channels: None,
os_crypt_name: None,
osx_key_service: None,
osx_key_user: None,
};

pub static OPERA_GX_CONFIG: BrowserConfig<'static> = BrowserConfig {
data_paths: &[
"%LOCALAPPDATA%/Opera Software/Opera GX {channel}/Cookies",
Expand Down

0 comments on commit e6a9371

Please sign in to comment.