MCPcopy Create free account
hub / github.com/anus-dev/ANUS / cacheGoogleAccount

Function cacheGoogleAccount

packages/core/src/utils/user_account.ts:40–57  ·  view source on GitHub ↗
(email: string)

Source from the content-addressed store, hash-verified

38}
39
40export async function cacheGoogleAccount(email: string): Promise<void> {
41 const filePath = getGoogleAccountsCachePath();
42 await fsp.mkdir(path.dirname(filePath), { recursive: true });
43
44 const accounts = await readAccounts(filePath);
45
46 if (accounts.active && accounts.active !== email) {
47 if (!accounts.old.includes(accounts.active)) {
48 accounts.old.push(accounts.active);
49 }
50 }
51
52 // If the new email was in the old list, remove it
53 accounts.old = accounts.old.filter((oldEmail) => oldEmail !== email);
54
55 accounts.active = email;
56 await fsp.writeFile(filePath, JSON.stringify(accounts, null, 2), 'utf-8');
57}
58
59export function getCachedGoogleAccount(): string | null {
60 try {

Callers 2

fetchAndCacheUserInfoFunction · 0.85

Calls 3

readAccountsFunction · 0.85
mkdirMethod · 0.80

Tested by

no test coverage detected