@bobfrankston/mailx-settings 0.1.24 → 0.1.25
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.
- package/cloud.d.ts.map +1 -1
- package/cloud.js +46 -0
- package/package.json +1 -1
package/cloud.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud.d.ts","sourceRoot":"","sources":["cloud.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;
|
|
1
|
+
{"version":3,"file":"cloud.d.ts","sourceRoot":"","sources":["cloud.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA+RH;;;;;;;;;oDASoD;AACpD,wBAAsB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA8BnF;AAcD;;;;;;;;;;;;;;;;;6CAiB6C;AAC7C,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAwBvE;AA6FD,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE1D,MAAM,WAAW,SAAS;IACtB,kFAAkF;IAClF,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC/C,uGAAuG;IACvG,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,8BAA8B;IAC9B,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAuBtF;AAED;;;;2DAI2D;AAC3D,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAoBvG"}
|
package/cloud.js
CHANGED
|
@@ -75,6 +75,7 @@ function archiveStaleTokenDirs(activeDirs) {
|
|
|
75
75
|
return;
|
|
76
76
|
const archiveRoot = path.join(tokensDir, ".archive");
|
|
77
77
|
let archived = 0;
|
|
78
|
+
let migrated = 0;
|
|
78
79
|
try {
|
|
79
80
|
for (const entry of fs.readdirSync(tokensDir)) {
|
|
80
81
|
// Preserve: special sub-dirs, the archive itself, all active entries.
|
|
@@ -92,6 +93,48 @@ function archiveStaleTokenDirs(activeDirs) {
|
|
|
92
93
|
catch {
|
|
93
94
|
continue;
|
|
94
95
|
}
|
|
96
|
+
// MIGRATE before archive: older builds wrote the token dir with
|
|
97
|
+
// different casing (Pascal vs. lowercase) or different dot handling.
|
|
98
|
+
// If this dir's lowercased name matches an active dir, it's the
|
|
99
|
+
// same account's tokens under an obsolete naming convention —
|
|
100
|
+
// moving the token file to the canonical dir lets the user keep
|
|
101
|
+
// signing in instead of being thrown back to Google's consent
|
|
102
|
+
// screen for the third time (Bob 2026-05-26 "why authenticating
|
|
103
|
+
// again"). The migration preserves the oauth-token.json file; the
|
|
104
|
+
// now-empty source dir falls through to archive below.
|
|
105
|
+
const entryLc = entry.toLowerCase();
|
|
106
|
+
if (activeDirs.has(entryLc) && entryLc !== entry) {
|
|
107
|
+
const tokenFile = path.join(src, "oauth-token.json");
|
|
108
|
+
if (fs.existsSync(tokenFile)) {
|
|
109
|
+
const dstDir = path.join(tokensDir, entryLc);
|
|
110
|
+
const dstTokenFile = path.join(dstDir, "oauth-token.json");
|
|
111
|
+
try {
|
|
112
|
+
if (fs.existsSync(dstTokenFile)) {
|
|
113
|
+
// Target dir already has a token — pick the newer one.
|
|
114
|
+
const srcMtime = fs.statSync(tokenFile).mtimeMs;
|
|
115
|
+
const dstMtime = fs.statSync(dstTokenFile).mtimeMs;
|
|
116
|
+
if (srcMtime > dstMtime) {
|
|
117
|
+
fs.copyFileSync(tokenFile, dstTokenFile);
|
|
118
|
+
console.log(` [cloud] Migrated newer token from ${entry} → ${entryLc} (replacing older)`);
|
|
119
|
+
migrated++;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
console.log(` [cloud] Skipped migrating ${entry} → ${entryLc} (target token is newer)`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
fs.mkdirSync(dstDir, { recursive: true });
|
|
127
|
+
fs.copyFileSync(tokenFile, dstTokenFile);
|
|
128
|
+
console.log(` [cloud] Migrated token from ${entry} → ${entryLc}`);
|
|
129
|
+
migrated++;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch (e) {
|
|
133
|
+
console.error(` [cloud] Token migration ${entry} → ${entryLc} failed: ${e?.message || e}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// Fall through to archive — the source dir is now an artifact.
|
|
137
|
+
}
|
|
95
138
|
const stamp = new Date().toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
96
139
|
const dst = path.join(archiveRoot, `${stamp}-${entry}`);
|
|
97
140
|
try {
|
|
@@ -108,6 +151,9 @@ function archiveStaleTokenDirs(activeDirs) {
|
|
|
108
151
|
catch (e) {
|
|
109
152
|
console.error(` [cloud] tokens dir scan failed: ${e?.message || e}`);
|
|
110
153
|
}
|
|
154
|
+
if (migrated > 0) {
|
|
155
|
+
console.log(` [cloud] Stale token cleanup: ${migrated} token(s) migrated to canonical dirs`);
|
|
156
|
+
}
|
|
111
157
|
if (archived > 0) {
|
|
112
158
|
console.log(` [cloud] Stale token cleanup: ${archived} dir(s) archived to tokens/.archive/`);
|
|
113
159
|
}
|