Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad2ff3a7b6 | ||
|
|
1a9d9cd22a | ||
|
|
b8826ace9b | ||
|
|
2a0de269ff |
@@ -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.8</string>
|
<string>1.2.1-beta.10</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>56</string>
|
<string>58</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>13.0</string>
|
<string>13.0</string>
|
||||||
<key>LSUIElement</key>
|
<key>LSUIElement</key>
|
||||||
|
|||||||
@@ -32,24 +32,13 @@ struct LoginWebView: NSViewRepresentable {
|
|||||||
|
|
||||||
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
|
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
|
||||||
guard !didAuthenticate else { return }
|
guard !didAuthenticate else { return }
|
||||||
// Don't fire on the login/auth pages themselves
|
guard let url = webView.url?.absoluteString else { return }
|
||||||
if let url = webView.url?.absoluteString,
|
// Stay on login/auth pages — user hasn't completed sign-in yet
|
||||||
url.contains("/login") || url.contains("/auth") { return }
|
if url.contains("/login") || url.contains("/auth") { return }
|
||||||
|
// Navigated away from login — server redirected us, so sign-in completed
|
||||||
// Ask the WebView itself whether we're authenticated — it uses its own
|
didAuthenticate = true
|
||||||
// session (cookies, localStorage, etc.) so we don't need to know the
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||||
// cookie domain or name.
|
self.onAuthenticated()
|
||||||
webView.callAsyncJavaScript(
|
|
||||||
"const r = await fetch('/api/bootstrap', {credentials: 'include'}); return r.status;",
|
|
||||||
arguments: [:], in: nil, in: .defaultClient
|
|
||||||
) { [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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,13 +130,7 @@ class UsageViewModel: ObservableObject {
|
|||||||
|
|
||||||
private func claudeAPIRequest(for url: URL) async -> URLRequest {
|
private func claudeAPIRequest(for url: URL) async -> URLRequest {
|
||||||
var req = URLRequest(url: url)
|
var req = URLRequest(url: url)
|
||||||
req.setValue("application/json, text/plain, */*", forHTTPHeaderField: "accept")
|
req.setValue("application/json", forHTTPHeaderField: "accept")
|
||||||
req.setValue("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36", forHTTPHeaderField: "User-Agent")
|
|
||||||
req.setValue("https://claude.ai", forHTTPHeaderField: "Origin")
|
|
||||||
req.setValue("https://claude.ai/", forHTTPHeaderField: "Referer")
|
|
||||||
req.setValue("same-origin", forHTTPHeaderField: "sec-fetch-site")
|
|
||||||
req.setValue("cors", forHTTPHeaderField: "sec-fetch-mode")
|
|
||||||
req.setValue("empty", forHTTPHeaderField: "sec-fetch-dest")
|
|
||||||
if let cookie = await claudeCookieHeader() {
|
if let cookie = await claudeCookieHeader() {
|
||||||
req.setValue(cookie, forHTTPHeaderField: "Cookie")
|
req.setValue(cookie, forHTTPHeaderField: "Cookie")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.7) <!-- BETA_BADGE -->
|
[](https://github.com/superdooper86/claudechecker/releases/tag/v1.2.1-beta.9) <!-- BETA_BADGE -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "1.2.1-beta.7",
|
"version": "1.2.1-beta.9",
|
||||||
"url": "https://github.com/superdooper86/claudechecker/releases/download/v1.2.1-beta.7/ClaudeChecker.zip",
|
"url": "https://github.com/superdooper86/claudechecker/releases/download/v1.2.1-beta.9/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\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"
|
"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 Settings incorrectly showing \"Signed in\" after a failed refresh — sign-in state now resets when authentication fails\n- 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\n- Fixed API requests not including session cookies — now sends all cookies from the app's WebView store rather than filtering by domain"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user