Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: add push-only syncing

thecodrr310899d0d6f5
diff --git a/packages/core/api/index.js b/packages/core/api/index.js
index b9bfc7e35..5fad17500 100644
--- a/packages/core/api/index.js
+++ b/packages/core/api/index.js
@@ -134,8 +134,8 @@ class Database {
}, 15 * 1000);
}
- sync() {
- return this.syncer.start();
+ sync(full) {
+ return this.syncer.start(full);
}
host(host) {
diff --git a/packages/core/api/sync/index.js b/packages/core/api/sync/index.js
index 2cfab3022..0f22bcddb 100644
--- a/packages/core/api/sync/index.js
+++ b/packages/core/api/sync/index.js
@@ -65,16 +65,18 @@ export default class Sync {
return { user, lastSynced, token };
}
- async start() {
+ async start(full) {
let { lastSynced, token } = await this._performChecks();
- let serverResponse = await this._fetch(lastSynced, token);
+ if (full) var serverResponse = await this._fetch(lastSynced, token);
// we prepare local data before merging so we always have correct data
const data = await this._collector.collect(lastSynced);
- // merge the server response
- await this._merger.merge(serverResponse, lastSynced);
+ if (full) {
+ // merge the server response
+ await this._merger.merge(serverResponse, lastSynced);
+ }
// check for conflicts and throw
await this._db.conflicts.check();