A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix: encrypt items before sync
thecodrrebe06bd4e000
diff --git a/packages/core/api/sync/collector.js b/packages/core/api/sync/collector.jsindex 995a1fb98..91fa2b896 100644--- a/packages/core/api/sync/collector.js+++ b/packages/core/api/sync/collector.js@@ -61,15 +61,28 @@ class Collector {}, []);}- _map(item) {+ // _map(item) {+ // return {+ // id: item.id,+ // v: CURRENT_DATABASE_VERSION,+ // iv: item.iv,+ // cipher: item.cipher,+ // length: item.length,+ // alg: item.alg,+ // dateModified: item.dateModified,+ // };+ // }++ async _map(item) {+ // in case of resolved content+ delete item.resolved;+ // turn the migrated flag off so we don't keep syncing this item repeated+ delete item.migrated;+return {id: item.id,v: CURRENT_DATABASE_VERSION,- iv: item.iv,- cipher: item.cipher,- length: item.length,- alg: item.alg,- dateModified: item.dateModified,+ ...(await this._serialize(item)),};}diff --git a/packages/core/api/sync/index.js b/packages/core/api/sync/index.jsindex da57fb4c1..1de5f4128 100644--- a/packages/core/api/sync/index.js+++ b/packages/core/api/sync/index.js@@ -48,7 +48,7 @@ const ITEM_TYPE_MAP = {attachments: "attachment",content: "content",notes: "note",- notebooks: "notebooks",+ notebooks: "notebook",settings: "settings",};@@ -177,7 +177,7 @@ export default class Sync {if (!item) {continue;}-+ console.log(item, type, array);if (await this.sendItemToServer(type, item, lastSynced)) {await this._queue.dequeue(id);sendSyncProgressEvent("upload", total, i + 1);diff --git a/packages/core/api/sync/realtimeMerger.js b/packages/core/api/sync/realtimeMerger.jsindex dbb6646b2..189c3903d 100644--- a/packages/core/api/sync/realtimeMerger.js+++ b/packages/core/api/sync/realtimeMerger.js@@ -59,6 +59,11 @@ class RealtimeMerger {attachment: {set: async (item) => {const remoteAttachment = await this._deserialize(item);+ if (remoteAttachment.deleted) {+ await this._db.attachments.merge(remoteAttachment);+ return;+ }+const localAttachment = this._db.attachments.attachment(remoteAttachment.metadata.hash);