clawkeep 0.2.3 → 0.2.4
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 +1 -1
- package/src/core/backup.js +15 -6
package/package.json
CHANGED
package/src/core/backup.js
CHANGED
|
@@ -141,12 +141,13 @@ class BackupManager {
|
|
|
141
141
|
|
|
142
142
|
let result;
|
|
143
143
|
let transport;
|
|
144
|
+
let syncManager;
|
|
144
145
|
if (target === 'local' || target === 's3' || target === 'cloud') {
|
|
145
146
|
// Encrypted incremental sync (local, S3, or cloud)
|
|
146
147
|
if (!password) throw new Error('Password required for encrypted sync');
|
|
147
148
|
transport = createTransport(backup, this.claw);
|
|
148
|
-
|
|
149
|
-
result = await
|
|
149
|
+
syncManager = new SyncManager(this.claw, transport, password);
|
|
150
|
+
result = await syncManager.sync();
|
|
150
151
|
} else if (target === 'git') {
|
|
151
152
|
await this.claw.push();
|
|
152
153
|
result = { ok: true, target: 'git', synced: true };
|
|
@@ -158,10 +159,18 @@ class BackupManager {
|
|
|
158
159
|
this.claw.saveConfig(freshConfig);
|
|
159
160
|
|
|
160
161
|
// Report sync stats to cloud API (fire-and-forget)
|
|
161
|
-
if (target === 'cloud' && transport.reportSync) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
if (target === 'cloud' && transport && transport.reportSync) {
|
|
163
|
+
try {
|
|
164
|
+
// Get accurate stats from manifest (result may be "already up to date" with no sizes)
|
|
165
|
+
const status = await syncManager.getStatus();
|
|
166
|
+
const chunkCount = status.chunkCount || freshConfig.backup.chunkCount || 0;
|
|
167
|
+
const totalSize = status.totalSize || 0;
|
|
168
|
+
transport.reportSync({ chunkCount, totalSize }).catch(() => {});
|
|
169
|
+
} catch {
|
|
170
|
+
// Fall back to result data if getStatus fails
|
|
171
|
+
const chunkCount = freshConfig.backup.chunkCount || result.chunkCount || 0;
|
|
172
|
+
transport.reportSync({ chunkCount, totalSize: result.totalSize || 0 }).catch(() => {});
|
|
173
|
+
}
|
|
165
174
|
}
|
|
166
175
|
|
|
167
176
|
return { ...result, lastSync: freshConfig.backup.lastSync };
|