@bobfrankston/mailx 1.0.142 → 1.0.143
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/package.json
CHANGED
|
@@ -91,7 +91,9 @@ export { getSharedDir };
|
|
|
91
91
|
/** Initialize local config if it doesn't exist */
|
|
92
92
|
export declare function initLocalConfig(sharedDir?: string, storePath?: string): void;
|
|
93
93
|
/** Initialize config with Google Drive cloud storage.
|
|
94
|
-
*
|
|
94
|
+
* Finds or creates the app-owned "mailx" folder via Drive API and stores its ID.
|
|
95
|
+
* No mount scanning — API only. Existing settings at other paths (e.g., home/.mailx
|
|
96
|
+
* from Desktop sync) must be migrated manually or via config.jsonc importPath. */
|
|
95
97
|
export declare function initCloudConfig(provider?: "gdrive"): Promise<void>;
|
|
96
98
|
declare const DEFAULT_SETTINGS: MailxSettings;
|
|
97
99
|
/** Get historyDays for an account: per-account override > system override > shared default */
|
|
@@ -548,28 +548,14 @@ export function initLocalConfig(sharedDir, storePath) {
|
|
|
548
548
|
atomicWrite(LOCAL_CONFIG_PATH, config);
|
|
549
549
|
}
|
|
550
550
|
/** Initialize config with Google Drive cloud storage.
|
|
551
|
-
*
|
|
551
|
+
* Finds or creates the app-owned "mailx" folder via Drive API and stores its ID.
|
|
552
|
+
* No mount scanning — API only. Existing settings at other paths (e.g., home/.mailx
|
|
553
|
+
* from Desktop sync) must be migrated manually or via config.jsonc importPath. */
|
|
552
554
|
export async function initCloudConfig(provider = "gdrive") {
|
|
553
555
|
const existing = readLocalConfig();
|
|
554
556
|
if (existing.sharedDir)
|
|
555
557
|
return; // Already configured
|
|
556
|
-
//
|
|
557
|
-
const home = process.env.USERPROFILE || process.env.HOME || "";
|
|
558
|
-
const mountPaths = [
|
|
559
|
-
path.join(home, "Google Drive", "My Drive", "home", ".mailx"),
|
|
560
|
-
path.join(home, "Google Drive Streaming", "My Drive", "home", ".mailx"),
|
|
561
|
-
];
|
|
562
|
-
for (const mountPath of mountPaths) {
|
|
563
|
-
if (fs.existsSync(path.join(mountPath, "accounts.jsonc")) || fs.existsSync(path.join(mountPath, "settings.jsonc"))) {
|
|
564
|
-
console.log(` Found existing settings on GDrive mount: ${mountPath}`);
|
|
565
|
-
const sharedDir = { provider, path: "home/.mailx" };
|
|
566
|
-
const config = { ...existing, sharedDir, storePath: existing.storePath || DEFAULT_STORE_PATH };
|
|
567
|
-
fs.mkdirSync(LOCAL_DIR, { recursive: true });
|
|
568
|
-
atomicWrite(LOCAL_CONFIG_PATH, config);
|
|
569
|
-
return;
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
// No mount — find or create the "mailx" folder via Drive API
|
|
558
|
+
// Find or create the "mailx" folder via Drive API
|
|
573
559
|
const folderId = await gDriveFindOrCreateFolder();
|
|
574
560
|
const sharedDir = { provider, path: "mailx", folderId: folderId || undefined };
|
|
575
561
|
const config = { ...existing, sharedDir, storePath: existing.storePath || DEFAULT_STORE_PATH };
|