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
web: treat mac app store build specially
Abdullah Attade0bbff296ee
diff --git a/.github/workflows/desktop.publish.yml b/.github/workflows/desktop.publish.ymlindex 83e503485..22a76ecfa 100644--- a/.github/workflows/desktop.publish.yml+++ b/.github/workflows/desktop.publish.yml@@ -109,10 +109,6 @@ jobs:- name: Install packagesrun: npm iworking-directory: ./apps/web/desktop-- - name: Build Electron wrapper- run: npm run build- working-directory: ./apps/web/desktop- name: Install provisioning profilerun: echo "${{ secrets.MAC_PROVISIONING_PROFILE }}" | base64 --decode > embedded.provisionprofile@@ -124,6 +120,7 @@ jobs:CSC_LINK: ${{ secrets.mac_certs }}CSC_KEY_PASSWORD: ${{ secrets.mac_certs_password }}run: |+ npm run build:masnpx electron-builder --mac mas --universal -p neverworking-directory: ./apps/web/desktop@@ -133,6 +130,7 @@ jobs:CSC_LINK: ${{ secrets.mac_certs }}CSC_KEY_PASSWORD: ${{ secrets.mac_certs_password }}run: |+ npm run buildif [ ${{ inputs.publish-github }} == true ]; thennpx electron-builder --mac zip dmg -p alwayselsediff --git a/apps/web/desktop/package.json b/apps/web/desktop/package.jsonindex b6270b1d7..f547ba69f 100644--- a/apps/web/desktop/package.json+++ b/apps/web/desktop/package.json@@ -27,7 +27,8 @@"zx": "^7.0.7"},"scripts": {- "build": "esbuild ./electron.js ./preload.js --minify --external:electron --external:fsevents --bundle --outdir=./build --platform=node --tsconfig=tsconfig.json",+ "build": "esbuild ./electron.js ./preload.js --minify --external:electron --external:fsevents --bundle --outdir=./build --platform=node --tsconfig=tsconfig.json --define:MAC_APP_STORE=false",+ "build:mas": "esbuild ./electron.js ./preload.js --minify --external:electron --external:fsevents --bundle --outdir=./build --platform=node --tsconfig=tsconfig.json --define:MAC_APP_STORE=true","pack": "rm -rf ./build && cp -r ../build ./ && npm run build && yarn electron-builder --linux AppImage && ./dist/notesnook_x86_64.AppImage"},"author": {diff --git a/apps/web/desktop/preload.js b/apps/web/desktop/preload.jsindex 153779ff6..cd62d0b84 100644--- a/apps/web/desktop/preload.js+++ b/apps/web/desktop/preload.js@@ -19,9 +19,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.const { contextBridge, ipcRenderer } = require("electron");+// eslint-disable-next-line no-undef+contextBridge.exposeInMainWorld("os", MAC_APP_STORE ? "mas" : process.platform);+// Expose protected methods that allow the renderer process to use// the ipcRenderer without exposing the entire object-contextBridge.exposeInMainWorld("os", process.platform);contextBridge.exposeInMainWorld("api", {send: (channel, data) => {// whitelist channelsdiff --git a/apps/web/src/components/dialogs/buy-dialog/buy-dialog.tsx b/apps/web/src/components/dialogs/buy-dialog/buy-dialog.tsxindex abb5ddfb8..08793f412 100644--- a/apps/web/src/components/dialogs/buy-dialog/buy-dialog.tsx+++ b/apps/web/src/components/dialogs/buy-dialog/buy-dialog.tsx@@ -40,7 +40,7 @@ import { db } from "../../../common/db";import { useCheckoutStore } from "./store";import { getCurrencySymbol } from "./helpers";import { Theme } from "@notesnook/theme";-import { isMacApp } from "../../../utils/platform";+import { isMacStoreApp } from "../../../utils/platform";type BuyDialogProps = {couponCode?: string;@@ -284,7 +284,7 @@ function TrialOrUpgrade(props: TrialOrUpgradeProps) {{formatPeriod(plan.period)}</Text>)}- {isMacApp() ? (+ {isMacStoreApp() ? (<><Text variant={"subBody"} mt={2} sx={{ textAlign: "center" }}>You cannot upgrade from the macOS app.diff --git a/apps/web/src/components/dialogs/buy-dialog/features.tsx b/apps/web/src/components/dialogs/buy-dialog/features.tsxindex a34bc31ad..fd368c9d3 100644--- a/apps/web/src/components/dialogs/buy-dialog/features.tsx+++ b/apps/web/src/components/dialogs/buy-dialog/features.tsx@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.*/import { Text, Flex, Box } from "@theme-ui/components";-import { isMacApp } from "../../../utils/platform";+import { isMacStoreApp } from "../../../utils/platform";import {Accent,Android,@@ -122,7 +122,7 @@ const sections: Section[] = [title: "100% cross platform",detail: "Notesnook is available on all major platforms — for everyone.",columns: 8,- isVisible: () => !isMacApp(),+ isVisible: () => !isMacStoreApp(),features: [{id: "ios",diff --git a/apps/web/src/utils/platform.js b/apps/web/src/utils/platform.jsindex 31b83ed76..c58c2c11a 100644--- a/apps/web/src/utils/platform.js+++ b/apps/web/src/utils/platform.js@@ -126,8 +126,8 @@ export function isDesktop() {return "api" in window;}-export function isMacApp() {- return true; // window.os === "darwin";+export function isMacStoreApp() {+ return window.os === "mas";}export function isTesting() {diff --git a/apps/web/src/views/settings.js b/apps/web/src/views/settings.jsindex 350dba4d8..751ed70ef 100644--- a/apps/web/src/views/settings.js+++ b/apps/web/src/views/settings.js@@ -54,7 +54,7 @@ import { appVersion } from "../utils/version";import { CHECK_IDS } from "@notesnook/core/common";import Tip from "../components/tip";import Toggle from "../components/toggle";-import { isDesktop, isMacApp } from "../utils/platform";+import { isDesktop, isMacStoreApp } from "../utils/platform";import Vault from "../common/vault";import { isUserPremium } from "../hooks/use-is-user-premium";import { Slider } from "@theme-ui/components";@@ -103,11 +103,11 @@ const otherItems = [link: "https://discord.com/invite/zQBK97EE22"},{- title: isMacApp() ? "Download for iOS" : "Download for iOS & Android",- description: isMacApp()+ title: isMacStoreApp() ? "Download for iOS" : "Download for iOS & Android",+ description: isMacStoreApp()? "Notesnook is also available on iOS": "Notesnook is available on Android & iOS",- link: isMacApp()+ link: isMacStoreApp()? "https://apps.apple.com/us/app/notesnook-take-private-notes/id1544027013": "https://notesnook.com/"},