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
refactor: use a single crypto worker path
thecodrrf07f5718ce29
diff --git a/apps/web/src/interfaces/fs.js b/apps/web/src/interfaces/fs.jsindex 7d813ff6c..4c0b5193d 100644--- a/apps/web/src/interfaces/fs.js+++ b/apps/web/src/interfaces/fs.js@@ -3,10 +3,8 @@ import localforage from "localforage";import { xxhash64, createXXHash64 } from "hash-wasm";import axios from "axios";import { AppEventManager, AppEvents } from "../common";-// eslint-disable-next-line import/no-webpack-loader-syntax-import "worker-loader?filename=static/workers/nncrypto.worker.js!nncryptoworker/dist/src/worker.js";import { StreamableFS } from "streamablefs";-import NNCrypto from "./nncrypto.stub";+import NNCrypto, { WORKER_PATH } from "./nncrypto.stub";import hosts from "notes-core/utils/constants";import { sendAttachmentsProgressEvent } from "notes-core/common";import { saveAs } from "file-saver";@@ -17,7 +15,7 @@ const ENCRYPTED_CHUNK_SIZE = CHUNK_SIZE + ABYTES;const UPLOAD_PART_REQUIRED_CHUNKS = Math.ceil((5 * 1024 * 1024) / ENCRYPTED_CHUNK_SIZE);-const crypto = new NNCrypto("/static/workers/nncrypto.worker.js");+const crypto = new NNCrypto(WORKER_PATH);const streamablefs = new StreamableFS("streamable-fs");/**diff --git a/apps/web/src/interfaces/nncrypto.stub.js b/apps/web/src/interfaces/nncrypto.stub.jsindex 1d226455f..b6213cc91 100644--- a/apps/web/src/interfaces/nncrypto.stub.js+++ b/apps/web/src/interfaces/nncrypto.stub.js@@ -1,6 +1,9 @@+// eslint-disable-next-line import/no-webpack-loader-syntax+import "worker-loader?filename=static/workers/nncrypto.worker.js!nncryptoworker/dist/src/worker.js";import { NNCrypto } from "nncrypto";import { NNCryptoWorker } from "nncryptoworker";export default "Worker" in window || "Worker" in global? NNCryptoWorker: NNCrypto;+export const WORKER_PATH = "/static/workers/nncrypto.worker.js";diff --git a/apps/web/src/interfaces/storage.js b/apps/web/src/interfaces/storage.jsindex 053888b43..e06d231ef 100644--- a/apps/web/src/interfaces/storage.js+++ b/apps/web/src/interfaces/storage.js@@ -1,11 +1,9 @@import localforage from "localforage";import { extendPrototype } from "localforage-getitems";import sort from "fast-sort";-// eslint-disable-next-line import/no-webpack-loader-syntax-import "worker-loader!nncryptoworker/dist/src/worker.js";-import NNCrypto from "./nncrypto.stub";+import NNCrypto, { WORKER_PATH } from "./nncrypto.stub";-const crypto = new NNCrypto("/static/js/bundle.worker.js");+const crypto = new NNCrypto(WORKER_PATH);extendPrototype(localforage);localforage.config({