@bobfrankston/rmfmail 1.1.9 → 1.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9505,7 +9505,15 @@ var AndroidSyncManager = class {
9505
9505
  return existing;
9506
9506
  }
9507
9507
  emitEvent({ type: "syncProgress", accountId, phase: "folders", progress: 0 });
9508
- const providerFolders = await provider.listFolders();
9508
+ console.log(`[sync] ${accountId}: listing folders from provider`);
9509
+ let providerFolders = [];
9510
+ try {
9511
+ providerFolders = await provider.listFolders();
9512
+ } catch (e) {
9513
+ console.error(`[sync] ${accountId}: listFolders threw: ${e?.message || e}`);
9514
+ throw e;
9515
+ }
9516
+ console.log(`[sync] ${accountId}: provider returned ${providerFolders.length} folders` + (providerFolders.length > 0 ? ` (sample: ${providerFolders.slice(0, 3).map((f) => f.path || f.name).join(", ")})` : ""));
9509
9517
  for (const folder of providerFolders) {
9510
9518
  const flags = folder.flags || [];
9511
9519
  if (flags.some((f) => f.toLowerCase() === "\\noselect")) continue;
@@ -9513,6 +9521,7 @@ var AndroidSyncManager = class {
9513
9521
  }
9514
9522
  emitEvent({ type: "syncProgress", accountId, phase: "folders", progress: 100 });
9515
9523
  const dbFolders = this.db.getFolders(accountId);
9524
+ console.log(`[sync] ${accountId}: ${dbFolders.length} folders in db, inbox=${dbFolders.some((f) => f.specialUse === "inbox") ? "yes" : "no"}`);
9516
9525
  emitEvent({ type: "folderCountsChanged", accountId, counts: {} });
9517
9526
  return dbFolders;
9518
9527
  }
@@ -9891,9 +9900,17 @@ var OAUTH_SCOPES = "https://mail.google.com/ https://www.googleapis.com/auth/con
9891
9900
  async function getCachedToken(email) {
9892
9901
  const key = `oauth-token-${email.replace(/[@.]/g, "_")}`;
9893
9902
  const raw = localStorage.getItem(key);
9894
- if (!raw) return null;
9903
+ if (!raw) {
9904
+ console.log(`[oauth] no cached token for ${email} (localStorage key=${key} missing \u2014 fresh consent will follow)`);
9905
+ return null;
9906
+ }
9895
9907
  try {
9896
- return JSON.parse(raw);
9908
+ const parsed = JSON.parse(raw);
9909
+ const hasRefresh = !!parsed?.refresh_token;
9910
+ const expiresAt = parsed?.expires_at || 0;
9911
+ const expiresIn = expiresAt ? Math.round((expiresAt - Date.now()) / 1e3) : 0;
9912
+ console.log(`[oauth] cached token for ${email}: hasRefresh=${hasRefresh}, expiresIn=${expiresIn}s`);
9913
+ return parsed;
9897
9914
  } catch {
9898
9915
  return null;
9899
9916
  }