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
feat: impl premium/trial feature lockdown
thecodrrb0c57965fdfa
diff --git a/apps/web/src/components/editor/index.js b/apps/web/src/components/editor/index.jsindex 10683224c..336dee3f3 100644--- a/apps/web/src/components/editor/index.js+++ b/apps/web/src/components/editor/index.js@@ -5,6 +5,7 @@ import { Flex } from "rebass";import Properties from "../properties";import { useStore, SESSION_STATES } from "../../stores/editor-store";import { useStore as useAppStore } from "../../stores/app-store";+import { useStore as useUserStore } from "../../stores/user-store";import Animated from "../animated";import EditorMenu from "./editormenu";import Header from "./header";@@ -15,6 +16,7 @@ function Editor() {const setSession = useStore((store) => store.setSession);const saveSession = useStore((store) => store.saveSession);const isFocusMode = useAppStore((store) => store.isFocusMode);+ const isPremium = useUserStore((store) => store.isPremium);const quillRef = useRef();useEffect(() => {@@ -54,6 +56,7 @@ function Editor() {id="quill"ref={quillRef}refresh={sessionState === SESSION_STATES.new}+ isSimple={!isPremium}initialContent={delta}placeholder="Type anything here"container=".editor"@@ -70,7 +73,7 @@ function Editor() {}}/></Flex>- <Properties />+ <Properties /></Animated.Flex>);}diff --git a/apps/web/src/components/editor/react-quill.js b/apps/web/src/components/editor/react-quill.jsindex 0fc81d523..9bdc31dce 100644--- a/apps/web/src/components/editor/react-quill.js+++ b/apps/web/src/components/editor/react-quill.js@@ -35,6 +35,20 @@ const quillModules = {magicUrl: true,};+const simpleQuillModules = {+ toolbar: [+ [{ header: 1 }, { header: 2 }],+ ["bold", "italic", "underline", "strike", "blockquote"],+ [+ { align: "" },+ { align: "center" },+ { align: "right" },+ { align: "justify" },+ ],+ [{ direction: "rtl" }, "clean"],+ ],+};+export default class ReactQuill extends Component {/** @private */quill;@@ -44,7 +58,9 @@ export default class ReactQuill extends Component {shouldComponentUpdate(nextProps) {return (- this.props.readOnly !== nextProps.readOnly || nextProps.refresh || false+ this.props.readOnly !== nextProps.readOnly ||+ nextProps.refresh ||+ this.props.isSimple !== nextProps.isSimple);}@@ -68,12 +84,12 @@ export default class ReactQuill extends Component {onSave,modules,id,+ isSimple,} = this.props;-this.quill = new Quill("#" + id, {placeholder,bounds: container,- modules: modules || quillModules,+ modules: modules || (isSimple ? simpleQuillModules : quillModules),theme: "snow",readOnly,});diff --git a/apps/web/src/stores/user-store.js b/apps/web/src/stores/user-store.jsindex 37a8cb712..90d4f8f6b 100644--- a/apps/web/src/stores/user-store.js+++ b/apps/web/src/stores/user-store.js@@ -11,13 +11,16 @@ class UserStore extends BaseStore {isSigningIn = false;isSyncing = false;user = undefined;+ isPremium = false;init = () => {- return db.user.get().then((user) => {+ return db.user.get().then(async (user) => {if (!user) return false;+ const isPremium = await db.user.isPremium();this.set((state) => {state.user = user;state.isLoggedIn = true;+ state.isPremium = isPremium;});db.ev.subscribe("sync", () => {this.sync();diff --git a/apps/web/yarn.lock b/apps/web/yarn.lockindex 438f86ab0..7d470db61 100644--- a/apps/web/yarn.lock+++ b/apps/web/yarn.lock@@ -7295,7 +7295,7 @@ normalize-url@^3.0.0, normalize-url@^3.0.1:"notes-core@git+ssh://[email protected]:streetwriters/notesnook-core.git":version "1.5.0"- resolved "git+ssh://[email protected]:streetwriters/notesnook-core.git#e82c3e702e0c191040ebcdfd2b05861a17d40309"+ resolved "git+ssh://[email protected]:streetwriters/notesnook-core.git#57f6e79aa1f0ec5b861ea93cc3c0026c478deb53"dependencies:fast-sort "^2.0.1"fuzzysearch "^1.0.3"