Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac7ffe81af | ||
|
|
f28f7b8a5a | ||
|
|
aaed64484c | ||
|
|
2e3ee350ca |
@@ -15,9 +15,9 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.2.1-beta.6</string>
|
<string>1.2.1-beta.8</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>54</string>
|
<string>56</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>13.0</string>
|
<string>13.0</string>
|
||||||
<key>LSUIElement</key>
|
<key>LSUIElement</key>
|
||||||
|
|||||||
@@ -36,13 +36,19 @@ struct LoginWebView: NSViewRepresentable {
|
|||||||
if let url = webView.url?.absoluteString,
|
if let url = webView.url?.absoluteString,
|
||||||
url.contains("/login") || url.contains("/auth") { return }
|
url.contains("/login") || url.contains("/auth") { return }
|
||||||
|
|
||||||
// URL is not a login/auth page, so if any claude.ai cookie exists we're signed in
|
// Ask the WebView itself whether we're authenticated — it uses its own
|
||||||
WKWebsiteDataStore.default().httpCookieStore.getAllCookies { cookies in
|
// session (cookies, localStorage, etc.) so we don't need to know the
|
||||||
let hasAnyCookie = cookies.contains { $0.domain.contains("claude.ai") }
|
// cookie domain or name.
|
||||||
guard hasAnyCookie, !self.didAuthenticate else { return }
|
webView.callAsyncJavaScript(
|
||||||
self.didAuthenticate = true
|
"const r = await fetch('/api/bootstrap', {credentials: 'include'}); return r.status;",
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
arguments: [:], in: nil, in: .defaultClient
|
||||||
self.onAuthenticated()
|
) { [weak self] result in
|
||||||
|
guard let self, !self.didAuthenticate else { return }
|
||||||
|
if case .success(let val) = result, let status = val as? Int, status == 200 {
|
||||||
|
self.didAuthenticate = true
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
|
||||||
|
self.onAuthenticated()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,15 +43,14 @@ class UsageViewModel: ObservableObject {
|
|||||||
|
|
||||||
private func checkInitialSignInState() async {
|
private func checkInitialSignInState() async {
|
||||||
let cookies = await WKWebsiteDataStore.default().httpCookieStore.allCookies()
|
let cookies = await WKWebsiteDataStore.default().httpCookieStore.allCookies()
|
||||||
let hasAnyCookie = cookies.contains { $0.domain.contains("claude.ai") }
|
if !cookies.isEmpty { isSignedIn = true }
|
||||||
if hasAnyCookie { isSignedIn = true }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func signOut() async {
|
func signOut() async {
|
||||||
let store = WKWebsiteDataStore.default()
|
let store = WKWebsiteDataStore.default()
|
||||||
let types = WKWebsiteDataStore.allWebsiteDataTypes()
|
let types = WKWebsiteDataStore.allWebsiteDataTypes()
|
||||||
let records = await store.dataRecords(ofTypes: types)
|
let records = await store.dataRecords(ofTypes: types)
|
||||||
let claudeRecords = records.filter { $0.displayName.contains("claude.ai") }
|
let claudeRecords = records.filter { $0.displayName.contains("claude.ai") || $0.displayName.contains("anthropic.com") }
|
||||||
await store.removeData(ofTypes: types, for: claudeRecords)
|
await store.removeData(ofTypes: types, for: claudeRecords)
|
||||||
UserDefaults.standard.removeObject(forKey: "claude_org_id")
|
UserDefaults.standard.removeObject(forKey: "claude_org_id")
|
||||||
isSignedIn = false
|
isSignedIn = false
|
||||||
@@ -109,6 +108,7 @@ class UsageViewModel: ObservableObject {
|
|||||||
checkLimitNotifications(for: limits)
|
checkLimitNotifications(for: limits)
|
||||||
} catch AppError.notAuthenticated {
|
} catch AppError.notAuthenticated {
|
||||||
isNotAuthenticated = true
|
isNotAuthenticated = true
|
||||||
|
isSignedIn = false
|
||||||
errorMessage = "Not signed in"
|
errorMessage = "Not signed in"
|
||||||
} catch let error as DecodingError {
|
} catch let error as DecodingError {
|
||||||
switch error {
|
switch error {
|
||||||
@@ -192,8 +192,10 @@ class UsageViewModel: ObservableObject {
|
|||||||
|
|
||||||
private func claudeCookieHeader() async -> String? {
|
private func claudeCookieHeader() async -> String? {
|
||||||
let cookies = await WKWebsiteDataStore.default().httpCookieStore.allCookies()
|
let cookies = await WKWebsiteDataStore.default().httpCookieStore.allCookies()
|
||||||
let claudeCookies = cookies.filter { $0.domain.contains("claude.ai") }
|
guard !cookies.isEmpty else { return nil }
|
||||||
return HTTPCookie.requestHeaderFields(with: claudeCookies)["Cookie"]
|
// Send all cookies from the app's WebView store — the session token may be
|
||||||
|
// on any domain (claude.ai, anthropic.com, or an auth sub-service).
|
||||||
|
return HTTPCookie.requestHeaderFields(with: cookies)["Cookie"]
|
||||||
}
|
}
|
||||||
|
|
||||||
private func fetchUsage(orgId: String) async throws -> UsageResponse {
|
private func fetchUsage(orgId: String) async throws -> UsageResponse {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
[](https://swift.org)
|
[](https://swift.org)
|
||||||
[](https://github.com/superdooper86/claudechecker/releases)
|
[](https://github.com/superdooper86/claudechecker/releases)
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
[](https://github.com/superdooper86/claudechecker/releases/tag/v1.2.1-beta.5) <!-- BETA_BADGE -->
|
[](https://github.com/superdooper86/claudechecker/releases/tag/v1.2.1-beta.7) <!-- BETA_BADGE -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -6,4 +6,7 @@
|
|||||||
- Fixed login window auto-closing before the user could sign in — the login window now correctly loads the `/login` page so it only detects auth after the actual sign-in redirect
|
- Fixed login window auto-closing before the user could sign in — the login window now correctly loads the `/login` page so it only detects auth after the actual sign-in redirect
|
||||||
- Fixed "No API key configured" showing after signing out — now correctly shows "Not signed in" with a prompt to sign in
|
- Fixed "No API key configured" showing after signing out — now correctly shows "Not signed in" with a prompt to sign in
|
||||||
- Added `/api/organizations` as a final fallback for org ID resolution when the bootstrap API response doesn't include it
|
- Added `/api/organizations` as a final fallback for org ID resolution when the bootstrap API response doesn't include it
|
||||||
- Fixed usage data not loading after sign-in — API requests now include required browser-like headers (Origin, Referer, User-Agent) that Claude's usage endpoints require
|
- Fixed usage data not loading — API requests now include required browser-like headers (Origin, Referer, User-Agent)
|
||||||
|
- Fixed Settings incorrectly showing "Signed in" after a failed refresh — sign-in state now resets when authentication fails
|
||||||
|
- Rewrote login detection to use the WebView's own fetch call instead of inspecting cookie domains — correctly detects auth regardless of which domain the session token is stored on
|
||||||
|
- Fixed API requests not including session cookies — now sends all cookies from the app's WebView store rather than filtering by domain
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "1.2.1-beta.5",
|
"version": "1.2.1-beta.7",
|
||||||
"url": "https://github.com/superdooper86/claudechecker/releases/download/v1.2.1-beta.5/ClaudeChecker.zip",
|
"url": "https://github.com/superdooper86/claudechecker/releases/download/v1.2.1-beta.7/ClaudeChecker.zip",
|
||||||
"notes": "## What's new in v1.2.1\n\n### Bug fixes\n- Fixed \"Not signed in\" showing incorrectly on launch when the session was already active\n- Sign-in state is now detected immediately from stored cookies on startup, before the first data refresh completes\n- Fixed login window auto-closing before the user could sign in — the login window now correctly loads the `/login` page so it only detects auth after the actual sign-in redirect\n- Fixed \"No API key configured\" showing after signing out — now correctly shows \"Not signed in\" with a prompt to sign in\n- Added `/api/organizations` as a final fallback for org ID resolution when the bootstrap API response doesn't include it"
|
"notes": "## What's new in v1.2.1\n\n### Bug fixes\n- Fixed \"Not signed in\" showing incorrectly on launch when the session was already active\n- Sign-in state is now detected immediately from stored cookies on startup, before the first data refresh completes\n- Fixed login window auto-closing before the user could sign in — the login window now correctly loads the `/login` page so it only detects auth after the actual sign-in redirect\n- Fixed \"No API key configured\" showing after signing out — now correctly shows \"Not signed in\" with a prompt to sign in\n- Added `/api/organizations` as a final fallback for org ID resolution when the bootstrap API response doesn't include it\n- Fixed usage data not loading — API requests now include required browser-like headers (Origin, Referer, User-Agent)\n- Fixed sign-in detection and cookie handling for accounts whose session cookies are on the `anthropic.com` domain rather than `claude.ai`\n- Fixed Settings incorrectly showing \"Signed in\" after a failed refresh — sign-in state now resets when authentication fails"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user