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
monograph: fix build
Abdullah Attaca73c0c2ce80
diff --git a/apps/monograph/app/utils/env.ts b/apps/monograph/app/utils/env.tsindex e6cd1db92..6c19ec228 100644--- a/apps/monograph/app/utils/env.ts+++ b/apps/monograph/app/utils/env.ts@@ -17,8 +17,6 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-import { readFileSync } from "node:fs";-const p = "process" in globalThis ? globalThis.process : ({ env: {} } as any);export const API_HOST =import.meta.env.API_HOST || p.env.API_HOST || `https://api.notesnook.com`;@@ -28,23 +26,3 @@ export const PUBLIC_URL =`http://localhost:${import.meta.env.PORT || p.env.PORT || 5173}`;export const COMPATIBILITY_VERSION = 1;export const INSTANCE_NAME = p.env.INSTANCE_NAME || "default";--export function readSecrets<T extends string>(- names: T[]-): Record<T, string | undefined> {- const result: Record<T, string | undefined> = {} as Record<- T,- string | undefined- >;- for (const name of names) result[name] = readSecret(name);- return result;-}--export function readSecret(name: string): string | undefined {- const value = process.env[name];- if (value) return value;- const file = process.env[`${name}_FILE`];- if (file) {- return readFileSync(file, "utf-8");- }-}diff --git a/apps/monograph/app/utils/secrets.ts b/apps/monograph/app/utils/secrets.tsnew file mode 100644index 000000000..b86f490cc--- /dev/null+++ b/apps/monograph/app/utils/secrets.ts@@ -0,0 +1,40 @@+/*+This file is part of the Notesnook project (https://notesnook.com/)++Copyright (C) 2023 Streetwriters (Private) Limited++This program is free software: you can redistribute it and/or modify+it under the terms of the GNU General Public License as published by+the Free Software Foundation, either version 3 of the License, or+(at your option) any later version.++This program is distributed in the hope that it will be useful,+but WITHOUT ANY WARRANTY; without even the implied warranty of+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+GNU General Public License for more details.++You should have received a copy of the GNU General Public License+along with this program. If not, see <http://www.gnu.org/licenses/>.+*/++import { readFileSync } from "node:fs";++export function readSecrets<T extends string>(+ names: T[]+): Record<T, string | undefined> {+ const result: Record<T, string | undefined> = {} as Record<+ T,+ string | undefined+ >;+ for (const name of names) result[name] = readSecret(name);+ return result;+}++export function readSecret(name: string): string | undefined {+ const value = process.env[name];+ if (value) return value;+ const file = process.env[`${name}_FILE`];+ if (file) {+ return readFileSync(file, "utf-8");+ }+}diff --git a/apps/monograph/app/utils/storage/kv.ts b/apps/monograph/app/utils/storage/kv.tsindex 4dcc4c707..d97dd957e 100644--- a/apps/monograph/app/utils/storage/kv.ts+++ b/apps/monograph/app/utils/storage/kv.ts@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.*/import WorkersKVREST from "@sagi.io/workers-kv";-import { readSecrets } from "../env";+import { readSecrets } from "../secrets";const env = readSecrets(["CLOUDFLARE_ACCOUNT_ID",diff --git a/apps/monograph/package-lock.json b/apps/monograph/package-lock.jsonindex d0567ae38..858fe1c70 100644--- a/apps/monograph/package-lock.json+++ b/apps/monograph/package-lock.json@@ -26,6 +26,7 @@"@sagi.io/workers-kv": "^0.0.14","@theme-ui/components": "^0.16.2","@theme-ui/core": "^0.16.2",+ "buffer": "^6.0.3","canvas-hypertxt": "^1.0.3","comlink": "^4.4.1","date-fns": "^4.1.0",@@ -2946,6 +2947,22 @@"@styled-system/css": "^5.1.5"}},+ "node_modules/@theme-ui/color-modes": {+ "version": "0.16.2",+ "resolved": "https://registry.npmjs.org/@theme-ui/color-modes/-/color-modes-0.16.2.tgz",+ "integrity": "sha512-jWEWx53lxNgWCT38i/kwLV2rsvJz8lVZgi5oImnVwYba9VejXD23q1ckbNFJHosQ8KKXY87ht0KPC6BQFIiHtQ==",+ "license": "MIT",+ "peer": true,+ "dependencies": {+ "@theme-ui/core": "^0.16.2",+ "@theme-ui/css": "^0.16.2",+ "deepmerge": "^4.2.2"+ },+ "peerDependencies": {+ "@emotion/react": "^11.11.1",+ "react": ">=18"+ }+ },"node_modules/@theme-ui/components": {"version": "0.16.2","resolved": "https://registry.npmjs.org/@theme-ui/components/-/components-0.16.2.tgz",@@ -2991,6 +3008,22 @@"@emotion/react": "^11.11.1"}},+ "node_modules/@theme-ui/theme-provider": {+ "version": "0.16.2",+ "resolved": "https://registry.npmjs.org/@theme-ui/theme-provider/-/theme-provider-0.16.2.tgz",+ "integrity": "sha512-LRnVevODcGqO0JyLJ3wht+PV3ZoZcJ7XXLJAJWDoGeII4vZcPQKwVy4Lpz/juHsZppQxKcB3U+sQDGBnP25irQ==",+ "license": "MIT",+ "peer": true,+ "dependencies": {+ "@theme-ui/color-modes": "^0.16.2",+ "@theme-ui/core": "^0.16.2",+ "@theme-ui/css": "^0.16.2"+ },+ "peerDependencies": {+ "@emotion/react": "^11.11.1",+ "react": ">=18"+ }+ },"node_modules/@types/acorn": {"version": "4.0.6","resolved": "https://registry.npmjs.org/@types/acorn/-/acorn-4.0.6.tgz",@@ -3120,14 +3153,14 @@"version": "15.7.13","resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.13.tgz","integrity": "sha512-hCZTSvwbzWGvhqxp/RqVqwU999pBf2vp7hzIjiYOsl8wqOmUxkQ6ddw1cV3l8811+kdUFus/q4d1Y3E3SyEifA==",- "dev": true,+ "devOptional": true,"license": "MIT"},"node_modules/@types/react": {"version": "18.3.10","resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.10.tgz","integrity": "sha512-02sAAlBnP39JgXwkAq3PeU9DVaaGpZyF3MGcC0MKgQVkZor5IiiDAipVaxQHtDJAmO4GIy/rVBy/LzVj76Cyqg==",- "dev": true,+ "devOptional": true,"license": "MIT","dependencies": {"@types/prop-types": "*",@@ -3505,7 +3538,6 @@"version": "1.5.1","resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz","integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",- "dev": true,"funding": [{"type": "github",@@ -3756,6 +3788,30 @@"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"}},+ "node_modules/buffer": {+ "version": "6.0.3",+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",+ "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "base64-js": "^1.3.1",+ "ieee754": "^1.2.1"+ }+ },"node_modules/buffer-from": {"version": "0.1.2","resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-0.1.2.tgz",@@ -5827,7 +5883,6 @@"version": "1.2.1","resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz","integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",- "dev": true,"funding": [{"type": "github",@@ -12213,7 +12268,7 @@"version": "3.23.8","resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz","integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==",- "dev": true,+ "devOptional": true,"license": "MIT","funding": {"url": "https://github.com/sponsors/colinhacks"diff --git a/apps/monograph/package.json b/apps/monograph/package.jsonindex 8a6192cdd..d5cc64771 100644--- a/apps/monograph/package.json+++ b/apps/monograph/package.json@@ -30,6 +30,7 @@"@sagi.io/workers-kv": "^0.0.14","@theme-ui/components": "^0.16.2","@theme-ui/core": "^0.16.2",+ "buffer": "^6.0.3","canvas-hypertxt": "^1.0.3","comlink": "^4.4.1","date-fns": "^4.1.0",