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: db.host
thecodrr9f3f1e718b92
diff --git a/packages/core/__tests__/db.test.js b/packages/core/__tests__/db.test.jsindex 44de8f638..a2a792955 100644--- a/packages/core/__tests__/db.test.js+++ b/packages/core/__tests__/db.test.js@@ -4,6 +4,6 @@ import StorageInterface from "../__mocks__/storage.mock";test("db.host should change HOST", () => {const db = new DB(StorageInterface);- db.host("hello world");- expect(Constants.HOST).toBe("hello world");+ db.host({ API_HOST: "hello world" });+ expect(Constants.API_HOST).toBe("hello world");});diff --git a/packages/core/api/index.js b/packages/core/api/index.jsindex 2a2cc9a5e..c73d53401 100644--- a/packages/core/api/index.js+++ b/packages/core/api/index.js@@ -96,7 +96,7 @@ class Database {}if (!user) return;- this.evtSource = new NNEventSource(`${Constants.HOST}/events`, {+ this.evtSource = new NNEventSource(`${Constants.SSE_HOST}/sse`, {headers: { Authorization: `Bearer ${user.accessToken}` },});@@ -153,9 +153,15 @@ class Database {return this.syncer.start(full, force);}- host(host) {+ /**+ *+ * @param {{AUTH_HOST: string, API_HOST: string, SSE_HOST: string}} hosts+ */+ host(hosts) {if (process.env.NODE_ENV !== "production") {- Constants.HOST = host || Constants.HOST;+ Constants.AUTH_HOST = hosts.AUTH_HOST || Constants.AUTH_HOST;+ Constants.API_HOST = hosts.API_HOST || Constants.API_HOST;+ Constants.SSE_HOST = hosts.SSE_HOST || Constants.SSE_HOST;}}}diff --git a/packages/core/utils/constants.js b/packages/core/utils/constants.jsindex 4f889e63c..752106206 100644--- a/packages/core/utils/constants.js+++ b/packages/core/utils/constants.js@@ -7,6 +7,10 @@ const module = {process.env.NODE_ENV === "production"? "https://auth.streetwriters.co": "http://localhost:8264",+ SSE_HOST:+ process.env.NODE_ENV === "production"+ ? "https://events.streetwriters.co"+ : "http://localhost:8264",};export default module;