Compare commits

..
+20 -10
View File
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using System.Text.Json; using System.Text.Json;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
@@ -135,12 +136,20 @@ public partial class PopupWindow : Window
FontSize = 10, Foreground = secondary, VerticalAlignment = VerticalAlignment.Center FontSize = 10, Foreground = secondary, VerticalAlignment = VerticalAlignment.Center
}); });
// Right: "after reset" when 0%, "today HH:MM" when refreshed today // Right: projected limit-hit time, or "after reset" if burn rate won't reach 100% before reset.
string? refreshLabel = limit.UsedPercent == 0 // BurnRate is stored as usedPercent / windowHours, so hoursToFull = remainingPercent / BurnRate.
? "after reset" string? refreshLabel;
: VM.LastUpdated?.Date == DateTime.Today if (limit.BurnRate <= 0)
? "today " + VM.LastUpdated.Value.ToString("h:mm tt") refreshLabel = "after reset";
: null; else
{
var projectedHit = DateTime.Now.AddHours((100.0 - limit.UsedPercent) / limit.BurnRate);
refreshLabel = projectedHit > limit.ResetDate
? "after reset"
: projectedHit.Date == DateTime.Today
? projectedHit.ToString("h:mm tt")
: projectedHit.ToString("d MMM h:mm tt");
}
UIElement timeRight; UIElement timeRight;
if (refreshLabel != null) if (refreshLabel != null)
@@ -487,7 +496,7 @@ public partial class PopupWindow : Window
private void CopyDiag_Click(object s, RoutedEventArgs e) private void CopyDiag_Click(object s, RoutedEventArgs e)
{ {
Clipboard.SetText(BuildDiagText()); Clipboard.SetText(BuildDiagText());
CopyDiagButton.Content = "Copied!"; CopyDiagButton.Content = "Copied! (IDs redacted)";
var t = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1.5) }; var t = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1.5) };
t.Tick += (_, _) => { CopyDiagButton.Content = "Copy All"; t.Stop(); }; t.Tick += (_, _) => { CopyDiagButton.Content = "Copy All"; t.Stop(); };
t.Start(); t.Start();
@@ -545,7 +554,6 @@ public partial class PopupWindow : Window
[ [
MakeRow("Version", Updater.CurrentVersion), MakeRow("Version", Updater.CurrentVersion),
MakeRow("Signed in", VM.IsSignedIn ? "Yes" : "No"), MakeRow("Signed in", VM.IsSignedIn ? "Yes" : "No"),
MakeRow("Email", string.IsNullOrEmpty(VM.UserEmail) ? "(none)" : VM.UserEmail),
MakeRow("Org ID", string.IsNullOrEmpty(VM.DiagOrgId) ? "(none)" : VM.DiagOrgId), MakeRow("Org ID", string.IsNullOrEmpty(VM.DiagOrgId) ? "(none)" : VM.DiagOrgId),
MakeRow("lastActiveOrg", string.IsNullOrEmpty(VM.DiagLastActiveOrg) ? "(not read)" : VM.DiagLastActiveOrg), MakeRow("lastActiveOrg", string.IsNullOrEmpty(VM.DiagLastActiveOrg) ? "(not read)" : VM.DiagLastActiveOrg),
MakeRow("Error", VM.ErrorMessage ?? "(none)"), MakeRow("Error", VM.ErrorMessage ?? "(none)"),
@@ -619,7 +627,6 @@ public partial class PopupWindow : Window
sb.AppendLine("=== ClaudeChecker Diagnostics (Windows) ==="); sb.AppendLine("=== ClaudeChecker Diagnostics (Windows) ===");
sb.AppendLine($"Version: {Updater.CurrentVersion}"); sb.AppendLine($"Version: {Updater.CurrentVersion}");
sb.AppendLine($"Signed in: {(VM.IsSignedIn ? "Yes" : "No")}"); sb.AppendLine($"Signed in: {(VM.IsSignedIn ? "Yes" : "No")}");
sb.AppendLine($"Email: {(string.IsNullOrEmpty(VM.UserEmail) ? "(none)" : VM.UserEmail)}");
sb.AppendLine($"Org ID: {(string.IsNullOrEmpty(VM.DiagOrgId) ? "(none)" : VM.DiagOrgId)}"); sb.AppendLine($"Org ID: {(string.IsNullOrEmpty(VM.DiagOrgId) ? "(none)" : VM.DiagOrgId)}");
sb.AppendLine($"lastActiveOrg: {(string.IsNullOrEmpty(VM.DiagLastActiveOrg) ? "(not read)" : VM.DiagLastActiveOrg)}"); sb.AppendLine($"lastActiveOrg: {(string.IsNullOrEmpty(VM.DiagLastActiveOrg) ? "(not read)" : VM.DiagLastActiveOrg)}");
sb.AppendLine($"Error: {VM.ErrorMessage ?? "(none)"}"); sb.AppendLine($"Error: {VM.ErrorMessage ?? "(none)"}");
@@ -637,9 +644,12 @@ public partial class PopupWindow : Window
sb.AppendLine("Stored cookies:"); sb.AppendLine("Stored cookies:");
foreach (var c in storedNames) foreach (var c in storedNames)
sb.AppendLine($" {c.Domain} {c.Name}"); sb.AppendLine($" {c.Domain} {c.Name}");
return sb.ToString(); return RedactUUIDs(sb.ToString());
} }
private static string RedactUUIDs(string text) =>
Regex.Replace(text, @"[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}", "****");
// ── Event handlers ─────────────────────────────────────────────── // ── Event handlers ───────────────────────────────────────────────
private void Settings_Click(object s, RoutedEventArgs e) private void Settings_Click(object s, RoutedEventArgs e)