





















@@ -10,7 +10,7 @@ import {
1010log,
1111} from "./constants.js";
1212import { overlayExternalAuthProfiles, shouldPersistExternalAuthProfile } from "./external-auth.js";
13-import { hasOAuthIdentity, isSafeToAdoptMainStoreOAuthIdentity } from "./oauth-shared.js";
13+import { isSafeToAdoptMainStoreOAuthIdentity } from "./oauth-shared.js";
1414import {
1515ensureAuthStoreFile,
1616resolveAuthStatePath,
@@ -86,8 +86,10 @@ function isInheritedMainOAuthCredential(params: {
8686return (
8787mainCredential?.type === "oauth" &&
8888(isDeepStrictEqual(mainCredential, params.credential) ||
89-(hasOAuthIdentity(params.credential) &&
90-isSafeToAdoptMainStoreOAuthIdentity(params.credential, mainCredential)))
89+shouldUseMainOwnerForLocalOAuthCredential({
90+local: params.credential,
91+main: mainCredential,
92+}))
9193);
9294}
9395@@ -228,6 +230,31 @@ function buildLocalAuthProfileStoreForSave(params: {
228230}),
229231),
230232);
233+const keptProfileIds = new Set(Object.keys(localStore.profiles));
234+localStore.order = localStore.order
235+ ? Object.fromEntries(
236+Object.entries(localStore.order)
237+.map(([provider, profileIds]) => [
238+provider,
239+profileIds.filter((profileId) => keptProfileIds.has(profileId)),
240+])
241+.filter(([, profileIds]) => profileIds.length > 0),
242+)
243+ : undefined;
244+localStore.lastGood = localStore.lastGood
245+ ? Object.fromEntries(
246+Object.entries(localStore.lastGood).filter(([, profileId]) =>
247+keptProfileIds.has(profileId),
248+),
249+)
250+ : undefined;
251+localStore.usageStats = localStore.usageStats
252+ ? Object.fromEntries(
253+Object.entries(localStore.usageStats).filter(([profileId]) =>
254+keptProfileIds.has(profileId),
255+),
256+)
257+ : undefined;
231258return localStore;
232259}
233260此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。