fix: authorize verified offline data sync
Build web service image / build (push) Successful in 1m6s

This commit is contained in:
2026-09-30 13:30:48 +08:00
parent edba7d0d38
commit e8abb15f68
12 changed files with 218 additions and 22 deletions
+14 -1
View File
@@ -98,6 +98,10 @@ public sealed class WindowsAgentBackend(AccountBindingStore bindings, ServiceOpt
if (refreshUiIdentity)
await AutoBindMatchesAsync(accounts, targets, cancellationToken);
var current = bindings.ReadAll();
var databaseIdentities = accounts
.Where(account => account.Identity is not null)
.Select(account => account.Identity!)
.ToArray();
var singleBoundTarget = !refreshUiIdentity && current.Count == 1 && targets.Count == 1;
var live = current.Where(binding => targets.Any(target =>
(target.ProcessId == binding.ProcessId && target.WindowHandle == binding.WindowHandle &&
@@ -110,8 +114,17 @@ public sealed class WindowsAgentBackend(AccountBindingStore bindings, ServiceOpt
{
var binding = bindings.Get(account.AccountId);
var isLive = binding is not null && live.Contains(binding.AccountId);
var isVerifiedForReadOnlySync = binding is not null &&
string.Equals(binding.AccountId, account.AccountId, StringComparison.OrdinalIgnoreCase) &&
AccountBindingMatcher.IsUniquelyMatchedToAccount(
account.AccountId,
new UiAccountIdentity(binding.WechatId, binding.Nickname),
databaseIdentities);
return new AccountInfo(account.AccountId, account.Identity?.Nickname, account.Identity?.WechatId, null,
account.AccountId, isLive, binding, binding is null ? "Unbound" : isLive ? "Bound" : "Stale");
account.AccountId, isLive, binding, binding is null ? "Unbound" : isLive ? "Bound" : "Stale")
{
IsVerifiedForReadOnlySync = isVerifiedForReadOnlySync
};
}).ToArray();
}