Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad525ef8d1 | ||
|
|
e6fa66bc73 | ||
|
|
2d000bca5e | ||
|
|
c7a663c42b | ||
|
|
a182b7ca59 |
@@ -53,7 +53,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Update version-windows-beta.json on main
|
- name: Update version-windows-beta.json on main
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
notes=$(cat windows/RELEASE_NOTES.md 2>/dev/null || echo "Windows beta ${{ steps.version.outputs.version }}")
|
notes=$(cat windows/RELEASE_NOTES.md 2>/dev/null || echo "Windows beta ${{ steps.version.outputs.version }}")
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Update version-windows.json on main
|
- name: Update version-windows.json on main
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
notes=$(cat windows/RELEASE_NOTES.md 2>/dev/null || echo "Windows release ${{ steps.version.outputs.version }}")
|
notes=$(cat windows/RELEASE_NOTES.md 2>/dev/null || echo "Windows release ${{ steps.version.outputs.version }}")
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Microsoft.Web.WebView2.Core;
|
using Microsoft.Web.WebView2.Core;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
@@ -28,18 +29,25 @@ public partial class LoginWindow : Window
|
|||||||
{
|
{
|
||||||
if (!e.IsSuccess) return;
|
if (!e.IsSuccess) return;
|
||||||
var uri = Browser.CoreWebView2.Source;
|
var uri = Browser.CoreWebView2.Source;
|
||||||
if (uri.Contains("claude.ai") && !uri.Contains("/login"))
|
if (!uri.Contains("claude.ai")) return;
|
||||||
{
|
|
||||||
// Likely signed in — enable done button
|
|
||||||
var cookies = await Browser.CoreWebView2.CookieManager.GetCookiesAsync("https://claude.ai");
|
var cookies = await Browser.CoreWebView2.CookieManager.GetCookiesAsync("https://claude.ai");
|
||||||
var hasSess = cookies.Any(c => c.Name.Contains("session") || c.Name.Contains("sk-"));
|
var signedIn = cookies.Any(c =>
|
||||||
|
c.Name.Equals("sessionKey", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
c.Name.StartsWith("sk-ant", StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
await Dispatcher.InvokeAsync(() =>
|
await Dispatcher.InvokeAsync(() =>
|
||||||
{
|
{
|
||||||
DoneButton.IsEnabled = hasSess || uri.Contains("/chats") || uri.Contains("/new");
|
DoneButton.IsEnabled = !uri.Contains("/login") && !uri.Contains("/signin");
|
||||||
StatusText.Text = DoneButton.IsEnabled
|
StatusText.Text = signedIn
|
||||||
? "Signed in! Click Done to continue."
|
? "Signed in — click Done to continue."
|
||||||
: "Waiting for sign-in…";
|
: "Complete sign-in, then click Done.";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Auto-close only on explicit post-login redirects, not on initial load
|
||||||
|
if (signedIn && (uri.Contains("/chats") || uri.Contains("/new")))
|
||||||
|
{
|
||||||
|
await SaveAndClose(cookies);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -47,7 +55,12 @@ public partial class LoginWindow : Window
|
|||||||
private async void Done_Click(object sender, RoutedEventArgs e)
|
private async void Done_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var cookies = await Browser.CoreWebView2.CookieManager.GetCookiesAsync("https://claude.ai");
|
var cookies = await Browser.CoreWebView2.CookieManager.GetCookiesAsync("https://claude.ai");
|
||||||
|
await SaveAndClose(cookies);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SaveAndClose(IReadOnlyList<CoreWebView2Cookie> cookies)
|
||||||
|
{
|
||||||
UsageViewModel.SaveCookies(cookies);
|
UsageViewModel.SaveCookies(cookies);
|
||||||
DialogResult = true;
|
await Dispatcher.InvokeAsync(() => DialogResult = true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public partial class PopupWindow : Window
|
|||||||
private static readonly UsageViewModel VM = App.ViewModel;
|
private static readonly UsageViewModel VM = App.ViewModel;
|
||||||
private static readonly UpdateManager Updater = App.Updater;
|
private static readonly UpdateManager Updater = App.Updater;
|
||||||
private readonly DispatcherTimer _clockTimer;
|
private readonly DispatcherTimer _clockTimer;
|
||||||
|
private bool _dialogOpen;
|
||||||
|
|
||||||
public PopupWindow()
|
public PopupWindow()
|
||||||
{
|
{
|
||||||
@@ -29,7 +30,7 @@ public partial class PopupWindow : Window
|
|||||||
UpdateBannerState();
|
UpdateBannerState();
|
||||||
UpdateFooter();
|
UpdateFooter();
|
||||||
|
|
||||||
Deactivated += (_, _) => Hide();
|
Deactivated += (_, _) => { if (!_dialogOpen) Hide(); };
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Card rendering ───────────────────────────────────────────────
|
// ── Card rendering ───────────────────────────────────────────────
|
||||||
@@ -299,12 +300,16 @@ public partial class PopupWindow : Window
|
|||||||
|
|
||||||
private void SignIn_Click(object s, RoutedEventArgs e)
|
private void SignIn_Click(object s, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
_dialogOpen = true;
|
||||||
var login = new LoginWindow { Owner = this };
|
var login = new LoginWindow { Owner = this };
|
||||||
if (login.ShowDialog() == true)
|
if (login.ShowDialog() == true)
|
||||||
{
|
{
|
||||||
_ = VM.RefreshAsync();
|
_ = VM.RefreshAsync();
|
||||||
InitSettings();
|
InitSettings();
|
||||||
}
|
}
|
||||||
|
_dialogOpen = false;
|
||||||
|
Show();
|
||||||
|
Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void SignOut_Click(object s, RoutedEventArgs e)
|
private async void SignOut_Click(object s, RoutedEventArgs e)
|
||||||
|
|||||||
Reference in New Issue
Block a user