pub enum BrowserType {
Chrome,
Edge,
Brave,
Chromium,
Vivaldi,
Comet,
Dia,
Atlas,
Firefox,
Safari,
}Variants§
Implementations§
Source§impl BrowserType
impl BrowserType
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Examples found in repository?
examples/test_opencode_go.rs (line 26)
9async fn main() {
10 let detector = BrowserDetector::new();
11 let browsers = detector.detect_browsers();
12
13 for browser in &browsers {
14 for prof in detector.list_profiles(*browser) {
15 let Ok(cookies) = CookieReader::read_cookies(&prof, "opencode.ai") else {
16 continue;
17 };
18 let has_auth = cookies
19 .iter()
20 .any(|c| c.name == "auth" || c.name == "__Host-auth");
21 if !has_auth {
22 continue;
23 }
24 println!(
25 "Using {} - {} ({} opencode.ai cookies)",
26 browser.name(),
27 prof.name,
28 cookies.len(),
29 );
30 match seher::opencode_go::fetch_remote_usage(&cookies).await {
31 Ok(usage) => {
32 println!("\nSuccess! OpenCode Go usage (hosted dashboard):");
33 for w in &usage.windows {
34 println!(
35 " {:<8} {:>6.1}% reset_in_sec={:?} limited={}",
36 w.name,
37 w.used_percent,
38 w.reset_in_sec,
39 w.is_limited()
40 );
41 }
42 println!(" => limited: {}", usage.is_limited());
43 return;
44 }
45 Err(e) => {
46 println!("\nFailed to fetch OpenCode Go usage: {e}");
47 }
48 }
49 }
50 }
51
52 println!("No opencode.ai session cookie (auth / __Host-auth) found in any browser");
53}More examples
examples/test_copilot.rs (line 28)
4async fn main() {
5 let detector = BrowserDetector::new();
6 let browsers = detector.detect_browsers();
7
8 for browser in &browsers {
9 if !browser.is_chromium_based() {
10 continue;
11 }
12 for prof in detector.list_profiles(*browser) {
13 if let Ok(cookies) = CookieReader::read_cookies(&prof, "github.com") {
14 let has_user_session = cookies
15 .iter()
16 .any(|c| c.name == "user_session" || c.name == "__Host-user_session_same_site");
17
18 if !has_user_session {
19 continue;
20 }
21
22 let dotcom_user = cookies
23 .iter()
24 .find(|c| c.name == "dotcom_user")
25 .map_or("unknown", |c| c.value.as_str());
26 println!(
27 "Using {} - {} ({} cookies, user={})",
28 browser.name(),
29 prof.name,
30 cookies.len(),
31 dotcom_user
32 );
33
34 match seher::copilot::CopilotClient::fetch_quota(&cookies).await {
35 Ok(quota) => {
36 println!("\nSuccess! Copilot quota:");
37 println!(" chat_utilization: {:.1}%", quota.chat_utilization);
38 println!(" premium_utilization: {:.1}%", quota.premium_utilization);
39 println!(" reset_time: {:?}", quota.reset_time);
40 println!(" is_limited: {}", quota.is_limited());
41 return;
42 }
43 Err(e) => {
44 println!("\nFailed to fetch Copilot quota: {e}");
45 }
46 }
47 }
48 }
49 }
50
51 println!("No github.com session with user_session cookie found");
52}examples/test_codex.rs (line 24)
4async fn main() {
5 let detector = BrowserDetector::new();
6 let browsers = detector.detect_browsers();
7
8 for browser in &browsers {
9 if !browser.is_chromium_based() {
10 continue;
11 }
12 for prof in detector.list_profiles(*browser) {
13 if let Ok(cookies) = CookieReader::read_cookies(&prof, "chatgpt.com") {
14 let has_session = cookies
15 .iter()
16 .any(|c| c.name.starts_with("__Secure-next-auth.session-token"));
17
18 if !has_session {
19 continue;
20 }
21
22 println!(
23 "Using {} - {} ({} cookies)",
24 browser.name(),
25 prof.name,
26 cookies.len(),
27 );
28
29 match seher::codex::CodexClient::fetch_usage(&cookies).await {
30 Ok(usage) => {
31 println!("\nSuccess! Codex usage:");
32 println!(" plan_type: {}", usage.plan_type);
33 println!(" rate_limit limited: {}", usage.rate_limit.is_limited());
34 println!(
35 " rate_limit reset_time: {:?}",
36 usage.rate_limit.next_reset_time()
37 );
38 println!(
39 " code_review limited: {}",
40 usage
41 .code_review_rate_limit
42 .as_ref()
43 .is_some_and(seher::CodexRateLimit::is_limited)
44 );
45 return;
46 }
47 Err(e) => {
48 println!("\nFailed to fetch Codex usage: {e}");
49 }
50 }
51 }
52 }
53 }
54
55 println!("No chatgpt.com session with __Secure-next-auth.session-token found");
56}Sourcepub fn is_chromium_based(&self) -> bool
pub fn is_chromium_based(&self) -> bool
Examples found in repository?
examples/test_copilot.rs (line 9)
4async fn main() {
5 let detector = BrowserDetector::new();
6 let browsers = detector.detect_browsers();
7
8 for browser in &browsers {
9 if !browser.is_chromium_based() {
10 continue;
11 }
12 for prof in detector.list_profiles(*browser) {
13 if let Ok(cookies) = CookieReader::read_cookies(&prof, "github.com") {
14 let has_user_session = cookies
15 .iter()
16 .any(|c| c.name == "user_session" || c.name == "__Host-user_session_same_site");
17
18 if !has_user_session {
19 continue;
20 }
21
22 let dotcom_user = cookies
23 .iter()
24 .find(|c| c.name == "dotcom_user")
25 .map_or("unknown", |c| c.value.as_str());
26 println!(
27 "Using {} - {} ({} cookies, user={})",
28 browser.name(),
29 prof.name,
30 cookies.len(),
31 dotcom_user
32 );
33
34 match seher::copilot::CopilotClient::fetch_quota(&cookies).await {
35 Ok(quota) => {
36 println!("\nSuccess! Copilot quota:");
37 println!(" chat_utilization: {:.1}%", quota.chat_utilization);
38 println!(" premium_utilization: {:.1}%", quota.premium_utilization);
39 println!(" reset_time: {:?}", quota.reset_time);
40 println!(" is_limited: {}", quota.is_limited());
41 return;
42 }
43 Err(e) => {
44 println!("\nFailed to fetch Copilot quota: {e}");
45 }
46 }
47 }
48 }
49 }
50
51 println!("No github.com session with user_session cookie found");
52}More examples
examples/test_codex.rs (line 9)
4async fn main() {
5 let detector = BrowserDetector::new();
6 let browsers = detector.detect_browsers();
7
8 for browser in &browsers {
9 if !browser.is_chromium_based() {
10 continue;
11 }
12 for prof in detector.list_profiles(*browser) {
13 if let Ok(cookies) = CookieReader::read_cookies(&prof, "chatgpt.com") {
14 let has_session = cookies
15 .iter()
16 .any(|c| c.name.starts_with("__Secure-next-auth.session-token"));
17
18 if !has_session {
19 continue;
20 }
21
22 println!(
23 "Using {} - {} ({} cookies)",
24 browser.name(),
25 prof.name,
26 cookies.len(),
27 );
28
29 match seher::codex::CodexClient::fetch_usage(&cookies).await {
30 Ok(usage) => {
31 println!("\nSuccess! Codex usage:");
32 println!(" plan_type: {}", usage.plan_type);
33 println!(" rate_limit limited: {}", usage.rate_limit.is_limited());
34 println!(
35 " rate_limit reset_time: {:?}",
36 usage.rate_limit.next_reset_time()
37 );
38 println!(
39 " code_review limited: {}",
40 usage
41 .code_review_rate_limit
42 .as_ref()
43 .is_some_and(seher::CodexRateLimit::is_limited)
44 );
45 return;
46 }
47 Err(e) => {
48 println!("\nFailed to fetch Codex usage: {e}");
49 }
50 }
51 }
52 }
53 }
54
55 println!("No chatgpt.com session with __Secure-next-auth.session-token found");
56}Trait Implementations§
Source§impl Clone for BrowserType
impl Clone for BrowserType
Source§fn clone(&self) -> BrowserType
fn clone(&self) -> BrowserType
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BrowserType
impl Debug for BrowserType
Source§impl FromStr for BrowserType
impl FromStr for BrowserType
Source§impl PartialEq for BrowserType
impl PartialEq for BrowserType
Source§fn eq(&self, other: &BrowserType) -> bool
fn eq(&self, other: &BrowserType) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for BrowserType
impl Eq for BrowserType
impl StructuralPartialEq for BrowserType
Auto Trait Implementations§
impl Freeze for BrowserType
impl RefUnwindSafe for BrowserType
impl Send for BrowserType
impl Sync for BrowserType
impl Unpin for BrowserType
impl UnsafeUnpin for BrowserType
impl UnwindSafe for BrowserType
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more