fix: detect auth by any claude.ai cookie, not specific cookie names

This commit is contained in:
SuperDooper
2026-05-11 08:58:02 +02:00
parent aa6c299e2a
commit b2c138f665
+3 -5
View File
@@ -36,12 +36,10 @@ 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
WKWebsiteDataStore.default().httpCookieStore.getAllCookies { cookies in WKWebsiteDataStore.default().httpCookieStore.getAllCookies { cookies in
let hasSession = cookies.contains { let hasAnyCookie = cookies.contains { $0.domain.contains("claude.ai") }
$0.domain.contains("claude.ai") && guard hasAnyCookie, !self.didAuthenticate else { return }
($0.name == "sessionKey" || $0.name == "__Secure-next-auth.session-token")
}
guard hasSession, !self.didAuthenticate else { return }
self.didAuthenticate = true self.didAuthenticate = true
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
self.onAuthenticated() self.onAuthenticated()