Skip to content

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

feat: allow creating new NNStorage based databases

thecodrr8cb974fec804
diff --git a/apps/web/src/common/db.js b/apps/web/src/common/db.js
index 21ce62243..8e5d0460a 100644
--- a/apps/web/src/common/db.js
+++ b/apps/web/src/common/db.js
@@ -12,7 +12,7 @@ async function initializeDatabase(persistence) {
);
const { NNStorage } = await import("../interfaces/storage");
const { default: FS } = await import("../interfaces/fs");
- db = new Database(new NNStorage(persistence), EventSource, FS);
+ db = new Database(new NNStorage("Notesnook", persistence), EventSource, FS);
// if (isTesting()) {
db.host({
diff --git a/apps/web/src/interfaces/storage.ts b/apps/web/src/interfaces/storage.ts
index f3b8b5a4e..ba5805079 100644
--- a/apps/web/src/interfaces/storage.ts
+++ b/apps/web/src/interfaces/storage.ts
@@ -12,13 +12,13 @@ const APP_SALT = "oVzKtazBo7d8sb7TBvY9jw";
export class NNStorage {
database: LocalForage;
- constructor(persistence: "memory" | "db" = "db") {
+ constructor(name: string, persistence: "memory" | "db" = "db") {
const drivers =
persistence === "memory"
? [MemoryDriver._driver]
: [localforage.INDEXEDDB, localforage.WEBSQL, localforage.LOCALSTORAGE];
this.database = localforage.createInstance({
- name: "Notesnook",
+ name,
driver: drivers,
});
}