Compare commits

...

556 Commits

Author SHA1 Message Date
Ammar Ahmed
d19b4ea709 Merge branch 'master' into mobile/fix-quick-notes
Signed-off-by: Ammar Ahmed <40239442+ammarahm-ed@users.noreply.github.com>
2023-09-04 14:36:15 +05:00
ammarahm-ed
7eab77ba01 mobile: fix share sheet sorting 2023-09-04 14:34:53 +05:00
ammarahm-ed
89413c56e2 mobile: auto update pinned note in notif 2023-09-04 14:33:39 +05:00
Muhammad Ali
4d89643203 web: fix multi-select context menu for list items (#3159) 2023-09-04 14:31:00 +05:00
ammarahm-ed
e119590249 mobile: prevent login/signup request when loading 2023-09-04 14:27:35 +05:00
ammarahm-ed
ace2dfac30 core: increase server timeout 2023-09-04 14:27:35 +05:00
Abdullah Atta
5843df0ce8 web: allow encrypted backups for basic users 2023-09-04 14:24:46 +05:00
Abdullah Atta
403ed8adb6 web: do not clear attachment upload status on complete 2023-09-04 14:24:24 +05:00
Abdullah Atta
1eb5c8bc46 core: do not trigger auto sync on settings merge 2023-09-04 14:24:24 +05:00
Abdullah Atta
46f7ec5e00 core: do not trigger autosync on attachment upload 2023-09-04 14:24:24 +05:00
Abdullah Atta
52adece147 web: upload arraybuffer on desktop builds for attachments 2023-09-04 14:24:24 +05:00
Abdullah Atta
de50be9d1b desktop: use net.fetch instead when handling protocol 2023-09-04 14:24:24 +05:00
Abdullah Atta
0f9e32b49f desktop: update electron to 26.1.0 2023-09-04 14:24:24 +05:00
Muhammad Ali
b4c15adf5d editor: fix formatting issues when pasting from ChatGPT (#3217)
Co-authored-by: Abdullah Atta <abdullahatta@streetwriters.co>
2023-09-04 14:22:45 +05:00
Abdullah Atta
a3d3886c51 editor: refactor clipboard extension 2023-09-04 14:22:45 +05:00
Abdullah Atta
0cfa7ce774 editor: paste single line of code as inline code 2023-09-04 14:22:45 +05:00
Abdullah Atta
8299ea909e editor: improve code block detection when pasting from vscode 2023-09-04 14:22:45 +05:00
Abdullah Atta
8b056fe610 editor: preserve formatting when pasting text 2023-09-04 14:22:45 +05:00
Abdullah Atta
511c40db5c editor: do not replace newlines with br when pasting 2023-09-04 14:22:45 +05:00
Muhammad Ali
42d0d42188 web: scroll to top when navigating within settings (#3223) 2023-09-04 13:43:07 +05:00
Abdullah Atta
c80a998444 editor: fix image shuffling on real-time editor sync 2023-09-04 13:41:32 +05:00
ammarahm-ed
0a10df75d1 mobile: add encryptMulti 2023-09-04 13:16:22 +05:00
Abdullah Atta
40d755d191 core: fix all tests 2023-09-04 13:16:22 +05:00
Abdullah Atta
0409a610ab core: improve sync status updates 2023-09-04 13:16:22 +05:00
Abdullah Atta
aa9cd23cf3 core: add fix for localOnly items getting deleted on sync 2023-09-04 13:16:22 +05:00
Abdullah Atta
12d89114a4 core: fix tags & colors not resolving on sync 2023-09-04 13:16:22 +05:00
Abdullah Atta
d5b679187a core: send sync completed event udp style 2023-09-04 13:16:22 +05:00
ammarahm-ed
463ba3754a mobile: add encryptMulti function 2023-09-04 13:16:22 +05:00
Abdullah Atta
2fa8fd14e7 core: migrate to sync v2 for data uploads 2023-09-04 13:16:22 +05:00
Abdullah Atta
fac788d2a9 crypto: remove crypto-worker & simplify crypto interface 2023-09-04 13:16:22 +05:00
ammarahm-ed
6554f900d7 mobile: do not start sync if sync is running 2023-09-04 13:16:22 +05:00
Abdullah Atta
81d3ec83d9 core: fix realtime sync 2023-09-04 13:16:22 +05:00
Abdullah Atta
339c5a357b core: update note-storage mock for tests 2023-09-04 13:16:22 +05:00
ammarahm-ed
b484992037 core: remove console.log 2023-09-04 13:16:22 +05:00
ammarahm-ed
87e42e98c6 mobile: fix logout page ui 2023-09-04 13:16:22 +05:00
ammarahm-ed
51bef01609 mobile: fix logout loading ui 2023-09-04 13:16:22 +05:00
ammarahm-ed
6a49244614 core: fix item not loaded on sync 2023-09-04 13:16:22 +05:00
ammarahm-ed
dad2b61a74 mobile: fix crash when logging out user 2023-09-04 13:16:22 +05:00
ammarahm-ed
fabc595f3d mobile: fix storage 2023-09-04 13:16:22 +05:00
Abdullah Atta
a700787cf3 core: make sure all tests are passing 2023-09-04 13:16:22 +05:00
ammarahm-ed
fb26229715 mobile: update libraries 2023-09-04 13:16:22 +05:00
ammarahm-ed
c4f894f8d0 mobile: add async storage & encryption 2023-09-04 13:16:22 +05:00
Abdullah Atta
ddd1c19c64 core: improve merging performance 2023-09-04 13:16:22 +05:00
Abdullah Atta
79cb3bdba4 core: merge vault key on sync 2023-09-04 13:16:22 +05:00
Abdullah Atta
8447c2150b core: improve sync fetch performance 2023-09-04 13:16:22 +05:00
Abdullah Atta
bc465971be web: add support for bulk writes 2023-09-04 13:16:22 +05:00
Abdullah Atta
f8ce23aa11 crypto: add support for bulk decryption 2023-09-04 13:16:22 +05:00
Abdullah Atta
84004c4d73 global: update lockfiles 2023-08-25 14:30:41 +05:00
Muhammad Ali
2b6aa9b89b ui: allow changing menu button icon color (#3170) 2023-08-21 16:38:21 +05:00
ammarahm-ed
54b8a3e789 mobile: refactor to typescript 2023-08-16 10:14:39 +05:00
ammarahm-ed
46fb6677b4 mobile: fix quick notes from notifications
- Add note to default notebook
- Respect paragraph spacing
2023-08-14 19:47:10 +05:00
Abdullah Atta
7ff5f0001c core: tagging an empty note should not create a content item 2023-08-14 13:41:19 +05:00
Abdullah Atta
d384aa9dcf core: use isolated storage for each test for more reliability 2023-08-14 09:54:57 +05:00
Abdullah Atta
1190da7c91 crypto: use buffer from node:buffer 2023-08-14 09:54:57 +05:00
Abdullah Atta
6561791530 setup: remove dist, build & out dirs during cleanup 2023-08-14 09:54:57 +05:00
Abdullah Atta
26e233d3eb global: update lockfiles 2023-08-14 09:54:57 +05:00
Abdullah Atta
0417981538 global: remove maxNodeModuleJsDepth from tsconfig 2023-08-14 09:54:57 +05:00
Abdullah Atta
81fc56937e web: fix syntax errors 2023-08-14 09:54:57 +05:00
Abdullah Atta
cb778d7e35 core: make dateFormat optional 2023-08-14 09:54:57 +05:00
Abdullah Atta
8442b43715 core: don't include tests & unnecessary files during build 2023-08-14 09:54:57 +05:00
Abdullah Atta
28b3306506 core: import isomorphic-fetch 2023-08-14 09:54:57 +05:00
Abdullah Atta
f51f45aeb2 editor: move isomorphic-fetch import 2023-08-14 09:54:57 +05:00
Abdullah Atta
7f1184736c core: use isomorphic-fetch 2023-08-14 09:54:57 +05:00
Abdullah Atta
e4c8e7a0c5 core: download prismjs languages before tests 2023-08-14 09:54:57 +05:00
Abdullah Atta
44e4722de2 global: fix @notesnook/core direct paths 2023-08-14 09:54:57 +05:00
Abdullah Atta
7c2b0c5947 core: start migrating core to typescript & vitest 2023-08-14 09:54:57 +05:00
Abdullah Atta
6ea912ad0e themebuilder: bump version to 1.1.1 2023-08-11 09:54:09 +05:00
Abdullah Atta
124bbb6ac1 web: do not show website link if there's no homepage 2023-08-11 09:53:01 +05:00
Abdullah Atta
30d6345152 theme: make homepage property in themes optional 2023-08-11 09:53:01 +05:00
Abdullah Atta
60ff7b2f97 themebuilder: update themes manually in themebuilder 2023-08-11 09:51:43 +05:00
Abdullah Atta
c6e90142bb themebuilder: bump version to 1.1.0 2023-08-10 07:20:07 +05:00
Abdullah Atta
1289a025a5 web: skip initiation for theme builder 2023-08-10 07:18:49 +05:00
Abdullah Atta
18d0b72785 themebuilder: fix various bugs 2023-08-10 07:18:18 +05:00
Abdullah Atta
0157cf496f themebuilder: add support for loading from pr, url & base64 2023-08-10 07:17:37 +05:00
Abdullah Atta
3450f2d19d setup: support generating flatpak sources from windows 2023-08-09 16:56:29 +05:00
Abdullah Atta
e509c82807 web: bump version to 2.6.1 2023-08-09 16:31:52 +05:00
Abdullah Atta
d5afd6f32e editor: fix recursive loop on loading a code lang that never registered 2023-08-09 16:26:31 +05:00
Abdullah Atta
fb34dd2864 core: do not throw if language grammar is not found on export 2023-08-09 16:26:31 +05:00
Abdullah Atta
0cd1ce3431 core: don't use require in desktop app 2023-08-09 16:26:31 +05:00
Abdullah Atta
a24447d569 web: fix unstyled "0" in theme details dialog 2023-08-09 16:25:43 +05:00
Abdullah Atta
0bf26afa33 web: fix error on installing theme from file 2023-08-09 16:25:43 +05:00
Abdullah Atta
49455e8054 docs: add documentation for custom themes (#3118)
* themebuilder: add docs

* themebuilder: update theme docs

* docs: finalize docs for custom themes

---------

Co-authored-by: ammarahm-ed <ammarahmed6506@gmail.com>
2023-08-09 15:49:33 +05:00
Abdullah Atta
1136e43115 themebuilder: fix layout 2023-08-08 13:54:56 +05:00
Abdullah Atta
4b74cba4e4 themebuilder: fix builder layout with app on the side 2023-08-08 13:42:28 +05:00
Abdullah Atta
c8a77934f2 ci: use themebuilder scope during bootstrap 2023-08-08 13:26:34 +05:00
Abdullah Atta
e1739e04d1 themebuilder: adjust app branding 2023-08-08 13:19:29 +05:00
Abdullah Atta
a5d39a18a7 web: allow custom app title 2023-08-08 13:19:29 +05:00
Abdullah Atta
77eb661b0e themebuilder: update theme builder on theme switch 2023-08-08 13:19:29 +05:00
Abdullah Atta
667d0d16ea themebuilder: finalize 2023-08-08 13:19:29 +05:00
Abdullah Atta
445ea660c3 web: make web app embeddable 2023-08-08 13:19:29 +05:00
ammarahm-ed
7a35640739 themebuilder: add basic search/replace 2023-08-08 13:19:29 +05:00
ammarahm-ed
f1650fd383 themebuilder: fix accordion 2023-08-08 13:19:29 +05:00
ammarahm-ed
5d67a554d6 themebuilder: fix screenshot 2023-08-08 13:19:29 +05:00
ammarahm-ed
380bfba776 theme: add theme builder app 2023-08-08 13:19:29 +05:00
Abdullah Atta
ed6d125391 clipper: publish v0.3.0 2023-08-08 11:07:22 +05:00
Abdullah Atta
adaa5fd56d clipper: bump version to 0.3.0 2023-08-08 10:29:13 +05:00
Abdullah Atta
0a8db237eb clipper: finalize integration with new theming system 2023-08-08 10:29:13 +05:00
ammarahm-ed
6d723e022b mobile: release v2.6.1 2023-08-08 00:49:29 +05:00
ammarahm-ed
dc3b739719 mobile: fix theme reset on app restart 2023-08-08 00:48:28 +05:00
Abdullah Atta
8d67599278 ci: deploy directly using wrangler 2023-08-07 20:11:11 +05:00
Abdullah Atta
c8da5770c8 web: add list of new features 2023-08-07 14:55:00 +05:00
ammarahm-ed
51c11d9d1a mobile: update release notes 2023-08-07 14:52:28 +05:00
ammarahm-ed
414c164100 mobile: enable remove console.log in release 2023-08-07 14:45:10 +05:00
ammarahm-ed
aa5fd6d946 mobile: release v2.6.0 2023-08-07 14:42:12 +05:00
ammarahm-ed
c89f74d35b mobile: fix ui and cleanup 2023-08-07 14:42:12 +05:00
ammarahm-ed
8c2fdf8554 mobile: fix share extension on ios 2023-08-07 14:42:12 +05:00
ammarahm-ed
f2438d9524 mobile: fix loading local theme 2023-08-07 14:42:12 +05:00
ammarahm-ed
54e7b29716 mobile: update fonts 2023-08-07 14:42:12 +05:00
Abdullah Atta
1d7f4036ec theme: do not send scopes when getting all themes 2023-08-07 12:39:36 +05:00
Abdullah Atta
a2d5eda538 web: fix applied theme status not showing on themes 2023-08-07 12:32:52 +05:00
Abdullah Atta
1b6a27376c web: fix editor & toolbar alignment 2023-08-07 12:00:15 +05:00
Abdullah Atta
8431150f0a web: always show currently applied themes in list 2023-08-07 12:00:02 +05:00
ammarahm-ed
ed5107afaa misc: remove notesnook-themes pulled repo 2023-08-07 09:51:10 +05:00
Abdullah Atta
e52bdd7ca5 web: disable sourcemaps even in testing 2023-08-07 09:18:13 +05:00
Abdullah Atta
26e50848da web: set root to src in vitejs for more focused builds 2023-08-07 09:17:04 +05:00
Abdullah Atta
41fa52c9d5 web: adapt dialog announcements to the new theme 2023-08-07 09:02:26 +05:00
Abdullah Atta
885aa3035e editor: show keyboard shortcuts for tools where possible 2023-08-07 08:47:11 +05:00
Abdullah Atta
b20c20983a ui: improve ui for modifiers in menu items 2023-08-07 08:46:45 +05:00
Abdullah Atta
42994847e9 editor: counter in toolbar should have 100% height 2023-08-07 08:46:13 +05:00
Abdullah Atta
b59a12e743 ui: simplify sub-menus markup 2023-08-07 08:45:18 +05:00
Abdullah Atta
f67792cd30 editor: use error color for errors in math blocks 2023-08-07 08:44:45 +05:00
Abdullah Atta
60ba345e6c editor: add font-display: swap to hack fontface 2023-08-07 08:44:27 +05:00
Abdullah Atta
0074548b84 web: fix broken colors in some places 2023-08-07 06:54:33 +05:00
Abdullah Atta
5af5549173 web: introduce "dangerous" variant for menu items 2023-08-07 06:54:11 +05:00
Abdullah Atta
f9f0235d7b editor: replace all old css colors with new ones 2023-08-07 06:03:25 +05:00
Abdullah Atta
cd51420931 web: replace all old css colors with new ones 2023-08-07 06:03:11 +05:00
Abdullah Atta
000d11976b web: update playwright to 1.36.2 2023-08-07 05:49:02 +05:00
Abdullah Atta
392261c208 web: add helper to imperitively match a media query 2023-08-07 05:49:02 +05:00
Abdullah Atta
71aee40f8d web: improve backups test reliability 2023-08-07 05:49:02 +05:00
Abdullah Atta
565ef2c321 web: don't check for notification permission in tests 2023-08-07 05:49:02 +05:00
Abdullah Atta
2d5c8c9e6d web: only allow changing title via event 2023-08-07 05:49:02 +05:00
Abdullah Atta
800f983688 web: show progress when restoring encrypted backups 2023-08-07 05:49:02 +05:00
ammarahm-ed
7291e54db7 mobile: update detox to latest 2023-08-05 16:46:26 +05:00
ammarahm-ed
794b1c70eb mobile: fix editor stuck in loading state 2023-08-05 16:46:26 +05:00
Abdullah Atta
330b227027 web: improve real time sync test reliability 2023-08-05 16:27:42 +05:00
Abdullah Atta
59a66a63c5 web: update all checkout snapshots 2023-08-05 13:52:19 +05:00
Abdullah Atta
ceb28f08c5 web: load paddle checkout in test mode during testing 2023-08-05 12:27:10 +05:00
Abdullah Atta
7287754218 web: bump version to 2.6.0 2023-08-05 12:19:43 +05:00
Abdullah Atta
80d2f64f10 desktop: bring app to front on start of 2nd instance 2023-08-05 12:10:47 +05:00
Abdullah Atta
9951b83539 web: fix navigation menu resizing on tablet mode 2023-08-05 12:01:06 +05:00
Abdullah Atta
66d50be35a theme: improve check for inheriting emotion theme 2023-08-05 11:27:56 +05:00
Abdullah Atta
9eb5a4cee4 web: update all test screenshot snapshots for linux 2023-08-05 11:20:08 +05:00
Abdullah Atta
3c575c01ad web: fix storage for Firefox & Tor private mode 2023-08-05 11:16:18 +05:00
ammarahm-ed
643028f5d8 mobile: update deps 2023-08-05 11:15:06 +05:00
ammarahm-ed
3831b9409e editor: load theme from local storage on init 2023-08-05 11:15:06 +05:00
ammarahm-ed
985ae848d3 mobile: fix tags wrapping in share extension 2023-08-05 11:15:06 +05:00
Abdullah Atta
0c8c8b6040 editor: fix sub toolbar not getting aligned correctly 2023-08-05 11:15:06 +05:00
ammarahm-ed
a01c084045 mobile: fix react-native-html-to-pdf-lite 2023-08-05 11:15:06 +05:00
ammarahm-ed
7577adf09d mobile: ensure that font size is always number 2023-08-05 11:15:06 +05:00
Abdullah Atta
394002eb4c editor(mobile): add theme to global styles 2023-08-05 11:15:06 +05:00
Abdullah Atta
5c386148a4 editor: fix action sheets not opening 2023-08-05 11:15:06 +05:00
Abdullah Atta
3558d3db93 editor: do not try to download image if src is invalid 2023-08-05 11:15:06 +05:00
ammarahm-ed
2bed812df1 mobile: fix editor 2023-08-05 11:15:06 +05:00
ammarahm-ed
c5db2e0ea9 mobile: fix content in share ext editor takes too long to load 2023-08-05 11:15:06 +05:00
ammarahm-ed
6cd1d7c41b mobile: fix webpack build 2023-08-05 11:15:06 +05:00
ammarahm-ed
36662d58da mobile: fix editor when app enter foreground from share ext 2023-08-05 11:15:06 +05:00
ammarahm-ed
e85cc6ac56 mobile: fix ext height behind keyboard on mobile 2023-08-05 11:15:06 +05:00
ammarahm-ed
a17d2d69ef mobile: fix opening search causes crash in share ext 2023-08-05 11:15:06 +05:00
Abdullah Atta
3ec615a6ec web: update export html snapshot for linux 2023-08-05 10:19:48 +05:00
Abdullah Atta
8eadc6aea1 web: do not redirect automatically on login session expire 2023-08-05 09:50:47 +05:00
Abdullah Atta
506678e72c web: format reminder time correctly (fixes #3085) 2023-08-04 20:05:53 +05:00
Abdullah Atta
aa3561555e desktop: fix desktop toggle settings 2023-08-04 19:34:46 +05:00
Abdullah Atta
405a8aaad0 editor: fix embeds in readonly mode are not visible 2023-08-04 19:33:57 +05:00
Abdullah Atta
7edd45419e editor: align outline bullet in the center of item 2023-08-04 19:00:54 +05:00
Abdullah Atta
5af028698c editor: only put bullet before 1st p tag in outline list 2023-08-04 18:27:04 +05:00
Abdullah Atta
ce822e7538 web: fix toggle colors 2023-08-04 16:09:29 +05:00
Abdullah Atta
9936bee8e0 editor: copying 1 nested list item shouldn't copy list meta 2023-08-04 16:07:31 +05:00
Abdullah Atta
b903e8461d web: make monograph password field hidden 2023-08-04 12:58:05 +05:00
ammarahm-ed
4d2c42330e mobile: fix crash on opening sheet with icon 2023-08-04 12:10:58 +05:00
Abdullah Atta
0ea37fdb31 web: improve checkout responsiveness 2023-08-04 10:23:36 +05:00
Abdullah Atta
22bf738d21 web: make sure all tests are passing 2023-08-03 18:48:51 +05:00
Abdullah Atta
922ba7d192 web: fix errored attachment icon color 2023-08-03 15:55:54 +05:00
Abdullah Atta
c38a98c239 web: upload files < 25mb in a single request 2023-08-03 15:55:54 +05:00
Abdullah Atta
0f9452f6ca web: improve handling of errors during upload 2023-08-03 15:55:54 +05:00
Abdullah Atta
5cc9c6e3e4 web: change themes api url to themes-api.notesnook.com 2023-08-03 15:48:42 +05:00
Abdullah Atta
5da30faf71 web: use settings scroller for themes 2023-08-03 15:46:15 +05:00
ammarahm-ed
99d984f516 core: flush once every 10 sec 2023-08-03 15:02:37 +05:00
ammarahm-ed
20f0760f13 core: fix logger performance 2023-08-03 15:02:37 +05:00
ammarahm-ed
20ffa9bee5 mobile: use themes-api server 2023-08-03 13:58:40 +05:00
Abdullah Atta
bdd003f177 web: fix colors in various places 2023-08-03 13:21:59 +05:00
Abdullah Atta
a45a960bfd editor(mobile): do not override background color 2023-08-03 13:21:59 +05:00
ammarahm-ed
fbf56f2663 mobile: fix incorrect colors uage 2023-08-03 12:01:11 +05:00
ammarahm-ed
0e7ac37b9d mobile: remove prism.css 2023-08-03 11:18:22 +05:00
Abdullah Atta
bcf0d86605 web: use new error icon color 2023-08-03 04:12:08 +05:00
Abdullah Atta
954f894738 web: fix crash when opening attachment menu 2023-08-03 01:44:21 +05:00
Abdullah Atta
908def1b69 editor: update lockfile 2023-08-02 19:50:41 +05:00
Abdullah Atta
f26f638ad4 editor: fix action sheet not closing via drag 2023-08-02 19:50:41 +05:00
Abdullah Atta
700f47fd49 web: disable overscroll behavior 2023-08-02 19:50:41 +05:00
Abdullah Atta
3d0eaacaac theme: allow passing ref to emotion theme provider 2023-08-02 19:50:40 +05:00
Abdullah Atta
c76118d9d6 web: load full framer-motion 2023-08-02 19:50:40 +05:00
Abdullah Atta
148c39158b editor: fix crash on action sheet opening 2023-08-02 19:50:40 +05:00
Ammar Ahmed
89c2d45a4b mobile: reduce app size (#3068)
* mobile: reduce app size

* editor: substitute all @mdi/js icons at build time

* mobile: add script to tree shake icon font file

* mobile: fix icon loading

* mobile: remove html-entities dep

* mobile: add missing icon fonts

* mobile: include plain editor

* mobile: add missing fonts

* mobile: use webpack-bundle

* mobile: keep generated fonts in repo

* mobile: update fonts

* mobile: fix duplicate key warning

* mobile: update fonts

* mobile: disable gesure on reminder sheet

* mobile: update fonts

* mobile: reset session correctly on logout

* mobile: update icon fonts

* mobile: set button action on reminder sheet

* mobile: add missing icons

* mobile: fix crash

* mobile: fix right menus

* mobile: remove console.log

* mobile: disable bounce effect

* mobile: update deps

---------

Co-authored-by: Abdullah Atta <abdullahatta@streetwriters.co>
2023-08-02 15:35:15 +05:00
Muhammad Ali
c30c54ab97 web: fix cursor jumps on edit in sticky title (#3028)
Co-authored-by: Abdullah Atta <abdullahatta@streetwriters.co>
2023-08-02 15:18:52 +05:00
Abdullah Atta
734cfba45d ci: publish preview on PR open 2023-08-02 15:04:27 +05:00
Abdullah Atta
3b363a1b20 web: prevent scroll jump when toggling focus mode 2023-08-02 15:04:27 +05:00
Abdullah Atta
a747bafa69 web: use new editorSidebar 2023-08-02 13:10:23 +05:00
Abdullah Atta
9d0c11b051 web: unlock view should use base theme scope 2023-08-02 13:09:56 +05:00
Abdullah Atta
bd9e997ef1 theme: add new editorSidebar scope 2023-08-02 13:09:30 +05:00
Abdullah Atta
f222327a89 theme: fix menu buttons have no hover 2023-08-02 13:09:09 +05:00
Abdullah Atta
4e5351134f global: update lockfiles 2023-08-02 12:26:35 +05:00
Abdullah Atta
ec1d5cc211 setup: only grab local deps during bootstrap 2023-08-02 12:26:22 +05:00
Abdullah Atta
8f41e25ac1 ci: ignore paths unrelated to web app 2023-08-02 12:12:32 +05:00
Abdullah Atta
2d90caafc6 ci: use unlike-ltd/github-actions-cloudflare-pages for deployment 2023-08-02 12:12:32 +05:00
Abdullah Atta
a9f36076b3 ci: deploy master branch to cloudflare as beta 2023-08-02 11:38:35 +05:00
Abdullah Atta
8365e557d5 editor: do not copy prism-theme during build 2023-08-02 11:37:15 +05:00
Abdullah Atta
080160ca70 vericrypt: use old @notesnook/theme version 2023-08-02 11:28:54 +05:00
Abdullah Atta
e6164b0b3e setup: use 4 threads at the minimum when bootstrapping 2023-08-01 20:45:08 +05:00
Abdullah Atta
26d786a368 editor: fix codeblock tests 2023-08-01 20:45:08 +05:00
Abdullah Atta
c6172644f0 editor: DOMSerializer2 -> ClipboardDOMSerializer 2023-08-01 20:45:08 +05:00
Abdullah Atta
5810947a5d editor: improve copy pasting 2023-08-01 20:45:08 +05:00
Abdullah Atta
708c2d373d editor: remove unnecessary console.logs 2023-08-01 20:45:08 +05:00
Abdullah Atta
d11a9b2219 editor: fix tests 2023-08-01 20:39:16 +05:00
Abdullah Atta
32b8b008f2 web: make export tests pass 2023-08-01 20:39:16 +05:00
Abdullah Atta
e066d1ce8d global: update lockfiles 2023-08-01 20:39:16 +05:00
Abdullah Atta
4f3f19a785 web: extract editor styles into a fixed css file during build 2023-08-01 20:39:16 +05:00
Abdullah Atta
6c3ea4517d core: inline codeblock styles into html template 2023-08-01 20:39:16 +05:00
Abdullah Atta
1e7e3b8c42 core: use explicit import/require for dynamic imports 2023-08-01 20:39:16 +05:00
Abdullah Atta
a54c18e89b web: remove require transform plugin 2023-08-01 20:39:16 +05:00
Abdullah Atta
ed4d5efea6 editor: generate code languages index during build 2023-08-01 20:39:16 +05:00
Abdullah Atta
4bab279345 global: fix conflicting package versions across subprojects 2023-08-01 20:39:16 +05:00
ammarahm-ed
ec32eeba0b mobile: fix pdf exports with codeblock & katex 2023-08-01 20:39:16 +05:00
Abdullah Atta
2b74e2afb2 web: fix Dynamic module import is disabled error 2023-08-01 20:33:37 +05:00
Abdullah Atta
c4a9d244a9 editor: bump katex version to 0.16.4 2023-08-01 18:35:31 +05:00
Abdullah Atta
6643fb0d63 web: fix old usage of hooks/useTheme 2023-08-01 18:32:58 +05:00
Abdullah Atta
b2a3949ad0 web: auto detect text direction where possible 2023-08-01 15:48:52 +05:00
Abdullah Atta
93c1a44285 editor: infer text direction from parent before insertion 2023-08-01 15:48:52 +05:00
Abdullah Atta
62c4fb328c editor: use single input rule for heading 2023-08-01 15:48:52 +05:00
Muhammad Ali
578fb72ddc editor: infer dir from parent when adding heading 2023-08-01 15:48:52 +05:00
Abdullah Atta
19faaea10e editor: do not save note with codeblock on open 2023-08-01 12:36:41 +05:00
Muhammad Ali
9951aae398 web: use current color scheme in all fields (#3039)
Co-authored-by: Abdullah Atta <abdullahatta@streetwriters.co>
2023-08-01 12:32:36 +05:00
Abdullah Atta
0963559a5f global: update lockfiles 2023-08-01 12:09:10 +05:00
Ammar Ahmed
622294b807 global: implement the new theme engine (#2196)
* mobile: theme

* theme: add theme engine

* mobile: migrate app colors to new theme engine

* mobile: fixed some colors

* mobile: fix colors

* mobile: store theme info in store

* theme: `ColorsType` -> `Variants`

* theme: use explicit return type for `useThemeColors`

* theme: add `backdrop` color

* mobile: `const colors` -> `const {colors}

* theme: add default pitch-black theme

* mobile: manage theme state via theme-engine

* mobile: add theme scopes

* mobile: commit

* mobile: fix button width on applock screen

* mobile: fix typings

* mobile: fix theme definition

* web: add partial support for custom themes

only context menus & popups are left.

* theme: add dialog & sheet scopes

* global: sync with master branch and make everything work again

* mobile: fix theme-engine usage in editor & app

* mobile: fix colors

* mobile: fix colors

* mobile: cleanup

* mobile: fix status bar color incorrect on entering foreground

* mobile: fix dark color scheme

* web: move emotion theme provider to @notesnook/theme

* editor: add support for theme enging

* web: adjust hover & focus colors on list item

* mobile: migrate share ext to theme engine

* mobile: fix editor theme provider

* clipper: add support for the new theme engine

* mobile: fix statusbar color on switch from bg

* misc: fix build

* mobile: fix build

* misc: fix colors

* mobile: fix theme colors

* mobile: fix bottom padding

* server: add theme server

* theme: add previewColors

* server: support themes query pagination

* mobile: add client from theme server

* server: reset cache on sync repo

* server: fix types

* server: show ip & port on start server

* server: theme updates

* web: finalize new theme engine on web

* editor: fix build

* global: fix @emotion/react version to 11.11.1

* editor: update katex patch

* web: fix imports

* global: fix @trpc/* versions

* global: a huge set of changes

1. get rid of ThemeVariant. All variants can now be accessed anywhere.
2. remove unnecessary button variants
3. make buttons more responsive
4. implement themes server

* web: add support for theme search and theme switching

* global: update lockfiles

* mobile: fix error

* theme: use vite-plugin-react to start theme server

* web: add support for auto updating themes

* mobile: update theme selector

* mobile: update theme if new verison available

* theme: add `isomorphic-fetch` package

* global: update lockfiles

* web: add theme details dialog

* setup: add scope for themes server in bootstrap script

* web: add production server url

* web: update lockfile

* web: update lockfile

* mobile: remove `react-native-blob-util`

* web: add support for endless scrolling in themes

* web: bring back dark/light mode option in settings

* web: fix colors in places

* theme: add selected variant

* global: use single typescript version across the projects

* web: fix sort & group options not having submenus

* web: apply selected variant where appropriate

* ui: use unique id for all menu items

* config: add ui scope for commits

* theme: export button variant creation fn

* web: fix only 1 theme showing in theme selector

* web: fix navigation item hover & other colors

* mobile: update theme

* editor: fix toolbar group alignments

* editor: set theme provider at app level

* theme: use scope name to get current scope

* mobile: fix color usage in message card

* theme: remove caching

* editor: bring back icons in table menus

* theme: use zustand to manage theme engine state

* web: fix login/signup theming

* mobile: fix webpack build

* misc: remove ThemeProvider usage

* editor: adjust theming and styling of editor toolbar

* mobile: refactor

* editor: fix toolbar group padding everywhere

* web: fix settings sidebar is not scrollable

* web: add loading indicator for themes loading

* mobile: fix warning

* mobile: fix ui issues

* web: fix Loader errors on build

* theme: add getPreviewColors & validateTheme

* theme: fix theme validation

* mobile: load theme from file

* mobile: fix share extension crash

* mobile: rename state

* theme: add sourceURL property

* theme: refactor theme-engine

* web: add support for loading theme from file

* web: improve button hover interaction

* mobile: fix floating button color

* mobile: update theme

* mobile: fix border radius of context menu

* mobile: set sheet overlay color to theme backdrop

* mobile: set sidemenu backdrop to theme backdrop

---------

Co-authored-by: Abdullah Atta <abdullahatta@streetwriters.co>
2023-08-01 12:07:21 +05:00
Abdullah Atta
ba72a92a8a setup: switch to fdir from fast-glob 2023-08-01 10:42:21 +05:00
Abdullah Atta
5a5e072fb4 global: update all lockfiles 2023-08-01 10:42:07 +05:00
Abdullah Atta
91cb2935eb logger: publish to npm 2023-08-01 09:33:45 +05:00
Abdullah Atta
387aeab319 core: bump version to 7.4.1 2023-08-01 09:33:28 +05:00
Abdullah Atta
4db7b54a5f theme: bump version to 1.2.0 2023-08-01 09:32:23 +05:00
Abdullah Atta
ddfd7254f1 crypto: publish v1 of @notesnook/sodium 2023-08-01 09:32:09 +05:00
Abdullah Atta
2e410c521a crypto: bump version to 1.1.1 2023-08-01 09:31:45 +05:00
Abdullah Atta
5dd22e85fa editor: bump version to 1.6.1 2023-08-01 09:31:06 +05:00
Abdullah Atta
022dd78eda ci: add workflow for vericrypt publishing 2023-07-31 11:40:09 +05:00
Abdullah Atta
2b1812b5de vericrypt: initial commit 2023-07-31 11:40:09 +05:00
Abdullah Atta
3c9678c6d5 core: reduce sync logger verbosity 2023-07-27 17:12:58 +05:00
Abdullah Atta
4f1f9ecb6b docs: make first step clear as; go to importer.notesnook.com 2023-07-26 13:34:20 +05:00
Abdullah Atta
07fb572a67 core: fix html export empty p tag regex 2023-07-26 12:08:51 +05:00
Abdullah Atta
7d7f4acc8c clipper: remove unnecessary packages 2023-07-25 12:35:31 +05:00
Abdullah Atta
efba05291d global: update lockfiles 2023-07-25 12:31:41 +05:00
Abdullah Atta
8b0d7a5cdb web: include __tests__ directory in tsconfig 2023-07-25 12:28:54 +05:00
Abdullah Atta
162deccf04 web: remove unused renderMath function 2023-07-25 12:28:54 +05:00
alihamuh
083f14bf50 editor: use dom parser to convert br to p tags 2023-07-25 12:28:54 +05:00
Abdullah Atta
cae3f7354e web: convert require to await import 2023-07-25 08:09:27 +05:00
Muhammad Ali
75e62a3fac core: pre-render math & code blocks before HTML export 2023-07-25 08:09:27 +05:00
Abdullah Atta
69dee3be78 web: get rid of print-js lib for printing 2023-07-24 15:50:36 +05:00
Abdullah Atta
36bf7c5cc6 web: don't show "Failed to unlock vault" error when exporting 1 note 2023-07-24 15:50:36 +05:00
Muhammad Ali
c041819930 web: add &nbsp; in empty p tags for printing 2023-07-24 15:50:36 +05:00
Muhammad Ali
dd4d00eae6 web: move focus to editor on Tab press in note title (#2983)
Co-authored-by: Abdullah Atta <abdullahatta@streetwriters.co>
2023-07-24 14:33:00 +05:00
Abdullah Atta
d12e14ab34 ci: add workflow for publishing help 2023-07-22 06:05:17 +05:00
ammarahm-ed
c0a444d0c6 editor: use contentCopy icon for copy tool 2023-07-21 17:00:12 +05:00
ammarahm-ed
e16a5524b8 editor: use accent color for link 2023-07-21 17:00:12 +05:00
ammarahm-ed
c386e92831 desktop: add buttons in context menu for copy link
& copy link text
2023-07-21 17:00:12 +05:00
ammarahm-ed
ed277a95fb editor: add copy link tool 2023-07-21 17:00:12 +05:00
Abdullah Atta
c14b09ee1d docs: improve importing documentation 2023-07-21 15:58:19 +05:00
Ammar Ahmed
52fecc27ce editor: fix color picker height with bottom toolbar on desktop (#2976) 2023-07-19 13:10:20 +05:00
ammarahm-ed
056b24e936 mobile: fix landscape tablet mode 2023-07-19 07:45:02 +05:00
ammarahm-ed
e34607f244 mobile: fix sorting favorites 2023-07-19 07:37:26 +05:00
ammarahm-ed
7ba7bf64f0 editor: fix copy button is disabled in readonly mode 2023-07-19 06:12:31 +05:00
ammarahm-ed
6f51a98477 web: fix entering password closes publish dialog 2023-07-19 06:12:11 +05:00
Abdullah Atta
cd7e0f5380 setup: parallelize bootstrap depending on device cpu cores 2023-07-18 15:14:40 +05:00
Abdullah Atta
d95aba8cdd setup: add support for offline bootstrapping 2023-07-18 00:09:28 +05:00
Abdullah Atta
922fce7bcc ci: download build to apps/web 2023-07-17 23:34:07 +05:00
Abdullah Atta
9e3646ebc5 web: bump version to 2.5.8 2023-07-17 23:18:37 +05:00
Abdullah Atta
cdf3ea9dab web: disable native crypto due to stream encryption issues 2023-07-17 23:17:19 +05:00
Abdullah Atta
e38ac19a58 setup: fix bootstrap script for non-existent packages 2023-07-17 09:40:47 +05:00
absolutez3
9d3f309fc3 web: fix mastodon link in Settings (#2943)
Fix desktop Mastodon link

Signed-off-by: absolutez3 <43919538+absolutez3@users.noreply.github.com>
2023-07-13 22:04:44 +05:00
ammarahm-ed
6b7eb9a1f2 mobile: release v2.5.6 2023-07-13 15:39:43 +05:00
ammarahm-ed
d2165c99f1 editor: fix cursor position on return 2023-07-13 13:35:45 +05:00
ammarahm-ed
8b538b833b mobile: fix trash cleanup interval text 2023-07-13 11:18:43 +05:00
ammarahm-ed
2977fb39e4 mobile: prevent action if already processing 2023-07-13 10:38:36 +05:00
ammarahm-ed
01cb43ba2e core: do not download media for text exports 2023-07-13 10:38:36 +05:00
ammarahm-ed
4b68a083c5 mobile: fix file and image upload 2023-07-13 09:57:58 +05:00
Abdullah Atta
5854a3eef5 web: fix service worker to allow Notesnook to behave as a PWA again (#2905)
* web: make service worker work again

* web: only enable sourcemap during dev
2023-07-12 06:51:14 +05:00
ammarahm-ed
df5cbacc8a mobile: search tags with db.lookup 2023-07-11 19:03:18 +05:00
Ammar Ahmed
05fa30a039 mobile: fix setting Monographs as default home causes crash (#2919)
* mobile: navigation params can be undefined

* mobile: fix setting Monographs as default home causes crash
2023-07-11 18:58:25 +05:00
Abdullah Atta
adabf488ee web: change output hash size to 12 chars 2023-07-08 11:13:48 +05:00
Abdullah Atta
e86b7c68e6 web: remove CSP 2023-07-06 15:35:53 +05:00
Abdullah Atta
c5b974e055 web: add worker-src to CSP 2023-07-06 15:18:04 +05:00
ammarahm-ed
b3695d4a93 misc: update lock files 2023-07-06 11:51:10 +05:00
ammarahm-ed
b5e5450452 mobile: bump version to v2.5.5 2023-07-06 11:30:20 +05:00
ammarahm-ed
d19cddccea editor: use 16px as default font size if font
value is string
2023-07-06 11:30:20 +05:00
ammarahm-ed
c61649f7fa editor: fix clipboard on mobile 2023-07-06 11:30:20 +05:00
Abdullah Atta
13b8580b2f desktop: add support for automatic updates 2023-07-06 11:15:44 +05:00
Abdullah Atta
aba2b0ea19 web: update last synced time on sync complete 2023-07-06 11:14:04 +05:00
Abdullah Atta
0894637b61 desktop: add @types/yargs 2023-07-06 11:14:04 +05:00
Abdullah Atta
5970aabb0d misc: remove mention of Lerna 2023-07-06 11:14:04 +05:00
Abdullah Atta
72a25dcf34 global: get rid of lerna 2023-07-06 11:14:04 +05:00
Ammar Ahmed
6fff30bd89 mobile: hide new update sheet (#2893) 2023-07-06 09:29:35 +05:00
Abdullah Atta
a9a71834b8 config: fix eslint on vscode 2023-07-06 08:34:07 +05:00
Abdullah Atta
8ec4865e23 desktop: fix tray icons not loading 2023-07-05 22:41:31 +05:00
Abdullah Atta
111c7ef954 core: fix Cannot read properties of undefined (reading 'length') error 2023-07-05 22:19:43 +05:00
Abdullah Atta
35a37458e4 web: make sure vault settings all have unique key 2023-07-05 22:03:33 +05:00
Abdullah Atta
92bafbafa7 web: bump version to 2.5.7 2023-07-05 17:22:43 +05:00
Abdullah Atta
2705caf6bd web: do not show update available dialog 2023-07-05 17:18:01 +05:00
Abdullah Atta
8380c7d994 web: rename reminder to notice for in-app notices 2023-07-05 17:00:23 +05:00
Ammar Ahmed
550c0f3854 mobile: fix topic sheet hidden on tablet (#2886) 2023-07-05 16:36:04 +05:00
Abdullah Atta
04cd135295 web: nav menu should be narrow on tablet 2023-07-05 15:46:47 +05:00
Abdullah Atta
e212a080c2 web: hide duplicate buttons on tablet 2023-07-05 15:46:30 +05:00
Abdullah Atta
533abb58db web: various fixes to settings 2023-07-05 15:46:10 +05:00
Abdullah Atta
941a542cc6 desktop: fix start command 2023-07-05 15:44:24 +05:00
ammarahm-ed
5bcda2cd3a editor: fix error Cannot find name 'Writeable' 2023-07-05 13:52:08 +05:00
Abdullah Atta
869d8ba8f9 config: set git.rebaseWhenSync to true 2023-07-05 13:41:06 +05:00
Abdullah Atta
984e8f8780 global: use node scripts directly everywhere 2023-07-05 13:40:09 +05:00
ammarahm-ed
750b61fb75 mobile: fix size scaling on tablets 2023-07-05 13:29:08 +05:00
Abdullah Atta
4a2defa300 web: allow changing primary 2fa method 2023-07-05 13:24:09 +05:00
Felipe Muñoz Mazur
5c9f7a8bcb editor: add clipboard button to the codeblock (#2710)
Signed-off-by: Felipe Muñoz Mazur <felipe.munoz.mazur@protonmail.com>
Co-authored-by: Abdullah Atta <abdullahatta@streetwriters.co>
2023-07-05 13:09:12 +05:00
Abdullah Atta
b66caa9848 web: fix sync test 2023-07-05 12:14:58 +05:00
Ammar Ahmed
81cac1e54f mobile: fix saving note from share extension (#2874) 2023-07-05 12:07:48 +05:00
Abdullah Atta
36a99cd64f web: add missing change password logic 2023-07-05 11:56:41 +05:00
Abdullah Atta
8c494642e4 editor: do not cache images without hash 2023-07-05 11:56:00 +05:00
Ammar Ahmed
7ab4088331 mobile: optimize screens for very small displays (#2885) 2023-07-05 11:52:13 +05:00
Abdullah Atta
580af33caf Merge branch 'master' of https://github.com/streetwriters/notesnook 2023-07-05 11:49:08 +05:00
Abdullah Atta
bbeeacc480 desktop: use node directly for dev server instead of turbowatch 2023-07-05 11:45:13 +05:00
Ammar Ahmed
51efef5005 mobile: fix tablet mode (#2884) 2023-07-05 09:51:32 +05:00
Abdullah Atta
ee030c8f61 web: fix @trpc/client version 2023-07-05 01:07:44 +05:00
Abdullah Atta
20835e1fb3 web: migrate views to typescript 2023-07-04 22:52:23 +05:00
Abdullah Atta
b542680e7a web: convert home view to typescript (rename to all-notes) 2023-07-04 22:48:14 +05:00
Abdullah Atta
fb32aedd69 web: convert more code to typescript 2023-07-04 22:44:55 +05:00
Abdullah Atta
56f6d34995 web: fix @trpc/{client,server} versions 2023-07-04 22:44:38 +05:00
Abdullah Atta
c68e380a0f web: remove unnecessary code 2023-07-04 22:05:15 +05:00
Abdullah Atta
fc5507bdd3 web: ignore Could not connect to the Sync server error 2023-07-04 18:06:17 +05:00
Abdullah Atta
3f0a656a36 web: force update token if email is already confirmed (#2879) 2023-07-04 16:50:52 +05:00
Abdullah Atta
60667149d4 web: check for internet reachability before sync 2023-07-04 16:43:40 +05:00
Abdullah Atta
cdb3ede207 config: update vscode settings 2023-07-04 16:33:52 +05:00
Abdullah Atta
445494ce95 web: set status as completed whenever sync completes 2023-07-04 16:33:31 +05:00
Abdullah Atta
972f52fd01 core: key should always be present in old attachment 2023-07-04 15:14:40 +05:00
ammarahm-ed
f5e86d668f mobile: set hosts before db setup 2023-07-04 12:19:18 +05:00
Abdullah Atta
0e817236a1 Merge branch 'master' of https://github.com/streetwriters/notesnook 2023-07-04 11:12:31 +05:00
Abdullah Atta
0ea3b3ac2a web: set hosts before database setup 2023-07-04 11:12:24 +05:00
Abdullah Atta
7bfaef82d8 web: debounce page visibility events 2023-07-04 11:11:55 +05:00
ammarahm-ed
f51220c9a8 mobile: remove db.notes.init 2023-07-04 11:02:19 +05:00
Abdullah Atta
88e9ca721a desktop: further improve window creation time 2023-07-04 09:43:17 +05:00
Abdullah Atta
c1ab444646 clipper: update lockfile 2023-07-04 09:43:17 +05:00
Abdullah Atta
b497b53ef2 desktop: fix run command on all platforms 2023-07-04 09:43:17 +05:00
Abdullah Atta
80decaae8a desktop: use app icon path from asset manager 2023-07-04 09:43:17 +05:00
Abdullah Atta
41197cb52c desktop: do not use asar for faster startup 2023-07-04 09:43:17 +05:00
Abdullah Atta
d14abcbba7 desktop: restructure window creation for faster loading 2023-07-04 09:43:17 +05:00
Abdullah Atta
cd36fc8d4a desktop: remove unneeded stat call when loading files 2023-07-04 09:43:17 +05:00
Abdullah Atta
e872487724 desktop: use vitejs for loading the correct bridge 2023-07-04 09:43:17 +05:00
Abdullah Atta
5e7e91caf0 desktop: stop unnecessary animations 2023-07-04 09:43:17 +05:00
Abdullah Atta
a971a29ff2 desktop: load db before app render 2023-07-04 09:43:17 +05:00
Abdullah Atta
a967482c4f core: init notes with database 2023-07-04 09:43:17 +05:00
Abdullah Atta
f91ada3c48 web: use own kvstore instead of localforage
localforage is unmaintained and also has a huge footprint not to mention
the performance issues.
2023-07-04 09:43:17 +05:00
Abdullah Atta
44782d552d web: make compression async 2023-07-04 09:43:17 +05:00
Ammar Ahmed
a51dfb4033 editor: fix toolbar buttons alignment (#2876) 2023-07-03 23:01:35 +05:00
Ammar Ahmed
ccb18e9335 mobile: fix changing font family causes editor crash (#2875) 2023-07-03 21:54:24 +05:00
Abdullah Atta
194556a0a1 clipper: remove comlink-extension package 2023-06-30 20:14:25 +05:00
Abdullah Atta
8f828bca80 web: bump version to 2.5.6 2023-06-30 19:07:17 +05:00
Abdullah Atta
a967234ddb web: fix subscription plan not changing from monthly 2023-06-30 19:05:52 +05:00
Abdullah Atta
bbcf7d1206 desktop: fix backups not saving 2023-06-28 16:15:15 +05:00
ammarahm-ed
6904045c7f mobile: disable updates check in fdroid release 2023-06-27 16:17:44 +05:00
ammarahm-ed
59c4052765 mobile: update project.pbxproj 2023-06-27 10:04:41 +05:00
ammarahm-ed
d3c47d3321 mobile: release 2.5.4 2023-06-27 09:11:54 +05:00
Abdullah Atta
221767ed4d misc: make generate-sources script independent of zx 2023-06-27 05:57:59 +05:00
Ammar Ahmed
4843d1c39e mobile: update mobile app to react-native 0.72.0 (#2814)
* mobile: upgrade to react-native 0.71

* mobile: update to react-native 0.72.0

* mobile: fix release build on android

* mobile: fix editor stuck in loading state

* mobile: fix bootsplash logo in dark mode

* mobile: update patch files

* mobile: cleanup

* mobile: increase delay

* mobile: add logs on upload

* mobile: ensure editor is ready before note loading

* mobile: fix ui

* mobile: fix

* ci: update workflow

* ci: undo workflow changes

---------

Signed-off-by: Ammar Ahmed <40239442+ammarahm-ed@users.noreply.github.com>
2023-06-26 21:50:20 +05:00
Abdullah Atta
ebc28bca62 crypto: update vitest to 0.32.2 2023-06-26 17:51:53 +05:00
Abdullah Atta
52dcf868b4 misc: add script for generating flatpak sources 2023-06-26 15:07:59 +05:00
Abdullah Atta
e7bcad29f7 web: bump version to 2.5.5 2023-06-26 14:53:44 +05:00
ammarahm-ed
33c939f5ca web: fix account deletion not working 2023-06-26 13:45:39 +05:00
Abdullah Atta
e6b9219d75 crypto: set length when converting uint8array to buffer 2023-06-26 13:44:51 +05:00
Abdullah Atta
5774daf3a9 web: update fflate to v0.8.0 2023-06-26 13:44:39 +05:00
Abdullah Atta
b8181c4a1b web: remove leading "/" in zip filenames 2023-06-26 13:44:39 +05:00
Abdullah Atta
408cd5a9f3 global: run prettier & eslint on all files 2023-06-26 13:43:57 +05:00
Abdullah Atta
42a76c6b03 Merge branch 'master' of https://github.com/streetwriters/notesnook 2023-06-26 13:25:54 +05:00
Abdullah Atta
7fa88ff8fb desktop: make it possible to run dev server on Windows 2023-06-26 13:25:46 +05:00
Abdullah Atta
cafd854b8c web: add support for exporting locked notes 2023-06-26 13:14:28 +05:00
Abdullah Atta
8c58c512ed core: only rewrite html if images are found 2023-06-26 13:14:28 +05:00
Abdullah Atta
3ab104e000 core: do not send download event if notify is false 2023-06-26 13:14:28 +05:00
Abdullah Atta
55f8a226c8 web: use async zip for faster zipping 2023-06-26 13:14:28 +05:00
Abdullah Atta
0cca9e1ff8 core: fix crash when exporting note with task list 2023-06-26 13:14:28 +05:00
Abdullah Atta
1fb43b7dfe core: export with empty content if no content found 2023-06-26 13:14:28 +05:00
Abdullah Atta
e138aef6a9 config: force unix style line endings 2023-06-26 13:14:28 +05:00
Abdullah Atta
8d7b444664 core: autofix issue where locked note is not encrypted 2023-06-26 13:14:28 +05:00
Abdullah Atta
4a5c5fd3bf config: set default eol sequence to LF 2023-06-26 13:14:28 +05:00
Abdullah Atta
8fb0071cf0 ci: only bootstrap the required projects when building desktop app 2023-06-23 19:12:41 +05:00
Abdullah Atta
bb1cb8dc33 web: consider canceled Pro subscription as Pro 2023-06-23 19:05:53 +05:00
Abdullah Atta
533884e534 desktop: make window.os a function 2023-06-23 19:04:34 +05:00
Abdullah Atta
f5c2962951 web: bump version to 2.5.4 2023-06-23 14:23:27 +05:00
Abdullah Atta
8d285c93d9 editor: insert image/attachment after selected node 2023-06-23 14:23:03 +05:00
ammarahm-ed
fc10e957fb editor: fix search-replace regex 2023-06-23 14:21:12 +05:00
Abdullah Atta
eb35d41321 desktop: fix "object has been destoryed" error 2023-06-23 11:51:01 +05:00
Abdullah Atta
99808293a7 web: pin pdfjs-dist version 2023-06-23 11:42:10 +05:00
Abdullah Atta
10fafa885a crypto: convert to buffer before using input length 2023-06-23 11:40:20 +05:00
Abdullah Atta
9096e7711d web: do not bundle pwa assets for desktop build 2023-06-23 11:40:03 +05:00
Abdullah Atta
25cbdbd409 desktop: fix crash due to undici fetch 2023-06-23 11:40:03 +05:00
Abdullah Atta
0216867fa9 web: reset importer on pressing "Start over" 2023-06-23 11:39:51 +05:00
Abdullah Atta
f832aba1a4 web: fix issues with desktop integration settings 2023-06-23 11:39:51 +05:00
Abdullah Atta
8df9c49fa1 desktop: zod considers false as undefined and throws error 2023-06-23 11:39:51 +05:00
Abdullah Atta
b733eb3c44 web: fix settings dialog going blank on clicking a checkbox 2023-06-23 11:39:51 +05:00
Abdullah Atta
addbd53d7a web: consider canceled pro users as Pro 2023-06-23 11:39:51 +05:00
Abdullah Atta
5f42f11fb1 web: simplify settings dialog markup 2023-06-23 11:39:51 +05:00
Abdullah Atta
30072576ce web: preload settings dialog for faster loading 2023-06-23 11:39:51 +05:00
Abdullah Atta
48371b6364 web: add toolbar settings in new settings dialog 2023-06-23 11:39:51 +05:00
Abdullah Atta
90ef877942 editor: only collapse/expand outline list with LMB 2023-06-23 11:39:27 +05:00
Abdullah Atta
c91bc819be web: enable CSS autoprefixing on build 2023-06-23 11:39:27 +05:00
Abdullah Atta
6c25a70a51 docs: change edit_root to master branch 2023-06-22 11:06:20 +05:00
Abdullah Atta
9e2b9fa6f1 docs: minor fixes & improvements to editor help 2023-06-22 11:06:20 +05:00
Abdullah Atta
5663c507e9 docs: fix broken navigation link 2023-06-22 11:06:20 +05:00
Abdullah Atta
d6fce5ad18 docs: add more markdown shortcuts 2023-06-22 11:06:20 +05:00
ammarahm-ed
9125e41e9a docs: add meta descriptions 2023-06-22 11:06:20 +05:00
ammarahm-ed
0498604848 docs: add clear vault & delete vault docs 2023-06-22 11:06:20 +05:00
ammarahm-ed
26902cb969 docs: add meta descriptions 2023-06-22 11:06:20 +05:00
ammarahm-ed
915f21d59a docs: adjust markdown shortcuts table 2023-06-22 11:06:20 +05:00
ammarahm-ed
e7f4ba8b57 docs: fix slug 2023-06-22 11:06:20 +05:00
ammarahm-ed
0bdcfff561 docs: update slugs 2023-06-22 11:06:20 +05:00
ammarahm-ed
b330445531 docs: update slug 2023-06-22 11:06:20 +05:00
ammarahm-ed
053ad1927b docs: optimize docs 2023-06-22 11:06:20 +05:00
ammarahm-ed
31ff047a34 docs: add table & task lists docs 2023-06-22 11:06:20 +05:00
ammarahm-ed
7f9c24e061 docs: add help for editor & toolbar 2023-06-22 11:06:20 +05:00
ammarahm-ed
9d8689bbce docs: add pages for editor help 2023-06-22 11:06:20 +05:00
Abdullah Atta
5dabd07f38 docs: add page about deleting your account 2023-06-22 11:06:20 +05:00
ammarahm-ed
41f0a4e101 docs: fix ui & typos 2023-06-22 11:06:20 +05:00
Abdullah Atta
ce1bc83e38 docs: add analytics 2023-06-22 11:06:20 +05:00
Abdullah Atta
0ef53f17cb docs: add 404 page for not found errors 2023-06-22 11:06:20 +05:00
Abdullah Atta
574d638c94 docs: change base_url to help.notesnook.com 2023-06-22 11:06:20 +05:00
Abdullah Atta
78a543dad4 docs: organization -> organizing-notes 2023-06-22 11:06:20 +05:00
Abdullah Atta
8c857e58b7 docs: add robots.txt 2023-06-22 11:06:20 +05:00
Abdullah Atta
61c96e7b58 docs: add meta title & favicon 2023-06-22 11:06:20 +05:00
Abdullah Atta
ea02552634 docs: finalize slugs & other minor fixes 2023-06-22 11:06:20 +05:00
Abdullah Atta
4438d96d9c docs: minor fixes to mobile integration docs 2023-06-22 11:06:20 +05:00
ammarahm-ed
5c4fee8f98 docs: update mobile integration docs 2023-06-22 11:06:20 +05:00
ammarahm-ed
0179a81d52 docs: add share extension help guide 2023-06-22 11:06:20 +05:00
Abdullah Atta
0d5cd2e554 docs: improve contrast of foreground colors 2023-06-22 11:06:20 +05:00
Abdullah Atta
47006b8648 docs: add docs for account recovery 2023-06-22 11:06:20 +05:00
Abdullah Atta
1a701d2a64 docs: add base_url to enable sitemap generation 2023-06-22 11:06:20 +05:00
Abdullah Atta
adae78d2df docs: add docs for desktop integration 2023-06-22 11:06:20 +05:00
Abdullah Atta
c6fe3ea91d docs: add docs for spell checker 2023-06-22 11:06:20 +05:00
Abdullah Atta
69c152948e docs: add privacy mode docs 2023-06-22 11:06:20 +05:00
Abdullah Atta
fb9a1af93c docs: improve docs theme 2023-06-22 11:06:20 +05:00
Abdullah Atta
dfe7e7d459 docs: use custom fonts 2023-06-22 11:06:20 +05:00
Abdullah Atta
2e807cdd0b docs: add docs for web clipper 2023-06-22 11:06:20 +05:00
ammarahm-ed
6f80d2e7b2 docs: minor fixes to Monographs help 2023-06-22 11:06:20 +05:00
ammarahm-ed
e49c2e8ccc docs: improve help for notes exporting 2023-06-22 11:06:20 +05:00
ammarahm-ed
3fec04466e docs: improve help for backup & restore 2023-06-22 11:06:20 +05:00
Abdullah Atta
93c2115f4b docs: add edit root to get Edit this page link at bottom 2023-06-22 11:06:20 +05:00
Abdullah Atta
8716d3076a docs: change theme colors to notesnook defaults 2023-06-22 11:06:20 +05:00
Abdullah Atta
5ec5517778 docs: reorder docs using the index frontmatter property 2023-06-22 11:06:20 +05:00
ammarahm-ed
8cb0644cd0 docs: add help on how to organize your notes 2023-06-22 11:06:20 +05:00
Abdullah Atta
56947d942d docs: fix headings hierarchy 2023-06-22 11:06:20 +05:00
Abdullah Atta
3ea810a059 docs: migrate to new callout syntax 2023-06-22 11:06:20 +05:00
ammarahm-ed
723bb67a6f docs: add help for backup/restore, vault, organization & monographs 2023-06-22 11:06:20 +05:00
ammarahm-ed
f0e68afdf8 docs: remove unused images 2023-06-22 11:06:20 +05:00
ammarahm-ed
7c0d8c25d3 docs: add importer docs 2023-06-22 11:06:20 +05:00
ammarahm-ed
641d78fdb2 docs: init and add first articles 2023-06-22 11:06:20 +05:00
Abdullah Atta
1c43da0eb0 desktop: regenerate package-lock.json 2023-06-21 15:46:25 +05:00
Abdullah Atta
87de351170 misc: move essential deps from devDependencies 2023-06-21 15:45:55 +05:00
Abdullah Atta
31726f6d86 ci: use npx electron-builder directly 2023-06-20 20:31:32 +05:00
Abdullah Atta
548eda9a26 desktop: do not load native crypto on ARM windows app 2023-06-20 20:24:10 +05:00
Abdullah Atta
dc6fa89c9c desktop: fix build script 2023-06-20 20:21:14 +05:00
Abdullah Atta
cdda26f32f Merge branch 'master' of https://github.com/streetwriters/notesnook 2023-06-20 20:17:07 +05:00
Abdullah Atta
a8470c9fea desktop: make builds work on windows 2023-06-20 20:16:48 +05:00
Abdullah Atta
4fa2bc6bb6 desktop: set cwd as data path for portable binaries 2023-06-20 20:15:58 +05:00
Abdullah Atta
8aacf49f07 ci: minor changes to desktop publish workflow 2023-06-20 18:41:00 +05:00
Abdullah Atta
d14c712b79 web: only run top-level-await transform in prod builds 2023-06-20 17:50:23 +05:00
Abdullah Atta
fb90ef3137 web: support top-level-await transform in desktop builds 2023-06-20 17:49:23 +05:00
Abdullah Atta
f733e6e95b core: convert object-id to es2015 class 2023-06-20 17:48:48 +05:00
Abdullah Atta
3ae3465e84 web: bump version to 2.5.3 2023-06-20 16:00:45 +05:00
Abdullah Atta
9abe85f1c9 web: minor UI fixes 2023-06-20 16:00:45 +05:00
ammarahm-ed
6194367c1e mobile: release 2.5.3 2023-06-20 14:43:48 +05:00
Abdullah Atta
4e793317ca desktop: set NO_COLOR=true when running scripts 2023-06-20 14:43:29 +05:00
Abdullah Atta
eb6927cbce web: add image source cache for caching blobs 2023-06-20 14:42:20 +05:00
Abdullah Atta
b7762ceaae crypto: make base64 enc compatible on node & browser 2023-06-20 13:18:11 +05:00
ammarahm-ed
53b545f84c mobile: enable encrypted backups on login 2023-06-20 12:43:37 +05:00
Abdullah Atta
4195150005 web: enable encrypted backups for all logged in users 2023-06-20 12:43:37 +05:00
Abdullah Atta
0a8c045f6f web: disable auto backups by default 2023-06-20 12:43:37 +05:00
ammarahm-ed
f4fe2c6a65 mobile: enable encrypted backups by default 2023-06-20 12:43:37 +05:00
ammarahm-ed
11e109740b core: allow encrypted backups for all users 2023-06-20 12:43:37 +05:00
ammarahm-ed
d882c7cf9f mobile: disable default auto-backup on 2023-06-20 12:43:37 +05:00
Abdullah Atta
eb8b58a559 web: migrate navigation to typescript 2023-06-20 12:36:21 +05:00
ammarahm-ed
2b94212552 mobile: fix module resolution 2023-06-20 12:04:38 +05:00
Ammar Ahmed
04d122c47c mobile: fix input hides behind keyboard on focus (#2767) 2023-06-20 11:33:48 +05:00
Ammar Ahmed
6c9c99681e mobile: fix scroll into view on keyboard shown (#2762) 2023-06-19 19:04:53 +05:00
ammarahm-ed
f0a4a61e1d mobile: add email support button in settings 2023-06-19 16:15:55 +05:00
Abdullah Atta
f88c610495 editor: make web clips selectable in readonly mode 2023-06-19 13:16:39 +05:00
Abdullah Atta
f9cb9fa3cc web: add option to contact us via email in settings 2023-06-19 12:54:34 +05:00
Abdullah Atta
3c6622ccf0 web: create vault should be under pro 2023-06-19 12:35:43 +05:00
ammarahm-ed
df82e84c83 web: add default dropdown value text 2023-06-19 12:19:56 +05:00
ammarahm-ed
abd136c7c2 web: disable import button when no files selected 2023-06-19 12:19:56 +05:00
Abdullah Atta
c61082cdee web: add manage attachments button in settings 2023-06-19 12:19:42 +05:00
ammarahm-ed
b9b21a760a mobile: limit input value between min/max 2023-06-19 11:58:50 +05:00
ammarahm-ed
acc852e23b web: limit input value between mix/max 2023-06-19 11:58:50 +05:00
ammarahm-ed
36ae9383ba web: fix onChange not fired on input 2023-06-19 11:42:39 +05:00
ammarahm-ed
c04df4b4c8 mobile: fix failing tests 2023-06-19 07:49:40 +05:00
Abdullah Atta
5c849c39b4 web: update sync status on auto sync completion 2023-06-17 19:13:54 +05:00
Abdullah Atta
9bae058d16 crypto: force convert IV to urlsafe base64 variant 2023-06-17 19:13:30 +05:00
Abdullah Atta
db2d48a083 web: fix navigation on small screens & mobiles 2023-06-17 18:20:13 +05:00
Abdullah Atta
628d3bd9ff core: do not include trashed notes in total notebook notes 2023-06-17 18:20:04 +05:00
Abdullah Atta
cdbca8ac22 web: fix crash on viewing a merge conflict 2023-06-17 18:19:58 +05:00
Abdullah Atta
8d2c0762db web: allow focusing editor by clicking at the bottom 2023-06-17 18:19:52 +05:00
Abdullah Atta
992f4fc697 web: fix pane sizes getting reset randomly on startup 2023-06-17 18:19:39 +05:00
Abdullah Atta
cb1d09904b web: remove settings test from navigation tests 2023-06-17 13:36:01 +05:00
Abdullah Atta
2441a4505e web: remove react-toggle 2023-06-17 13:36:01 +05:00
Abdullah Atta
79aae86906 web: fix broken build 2023-06-17 13:36:01 +05:00
Abdullah Atta
cd792625ac web: use named imports for icons 2023-06-17 13:36:01 +05:00
Abdullah Atta
605e045ff7 web: fix type in SearchViewModel 2023-06-17 13:36:01 +05:00
Abdullah Atta
8c17233e67 web: move dialogs out to top-most level 2023-06-17 13:36:01 +05:00
Abdullah Atta
08480188fa web: remove progress-bar component 2023-06-17 13:36:01 +05:00
Abdullah Atta
87402251a5 web: add types for svgr 2023-06-17 13:36:01 +05:00
Abdullah Atta
e3a818378d core: userId is not mandatory when sending bug report 2023-06-17 13:36:01 +05:00
Abdullah Atta
6d82b0a5ba common: use fixed react version at 17.0.2 2023-06-17 13:36:01 +05:00
Abdullah Atta
e3f0d0ada7 web: load polyfills before everything else 2023-06-17 13:36:01 +05:00
Abdullah Atta
9e2f54fd0b web: use utils from @notesnook/common 2023-06-17 13:36:01 +05:00
Abdullah Atta
19eb512198 common: add utils for debounce, random & string 2023-06-17 13:36:01 +05:00
ammarahm-ed
86a7fd9b93 mobile: refactor 2023-06-17 13:36:01 +05:00
ammarahm-ed
fa7900aef6 core: fix tests 2023-06-17 13:36:01 +05:00
ammarahm-ed
561d7a8bbc common: add @notesnook/core dep 2023-06-17 13:36:01 +05:00
ammarahm-ed
fb616a246e mobile: refactor 2023-06-17 13:36:01 +05:00
ammarahm-ed
c881e74aae web: call database.setup() before db init 2023-06-17 13:36:01 +05:00
ammarahm-ed
0f2acb2801 core: Init DB instance without platform APIs 2023-06-17 13:36:01 +05:00
Abdullah Atta
9b5e2c108b editor: persist text alignment & direction on heading creation 2023-06-16 19:11:22 +05:00
ammarahm-ed
ba900b3a0f web: fix trial expired notice shows to new users 2023-06-16 19:10:46 +05:00
ammarahm-ed
49df1bcd9e mobile: fix trial expired notice shows to new users 2023-06-16 19:10:46 +05:00
Abdullah Atta
5d1ba7fa0a web: new dialog based settings (#2745) 2023-06-16 19:10:02 +05:00
ammarahm-ed
a6d5a618b0 mobile: picker follow time format set in settings 2023-06-16 18:57:29 +05:00
Abdullah Atta
8f4bd20253 web: fix delete all notes in topic test 2023-06-16 16:54:04 +05:00
ammarahm-ed
8b4270f7df web: add null checks 2023-06-16 16:54:04 +05:00
ammarahm-ed
9a4877bdbd mobile: include topic notes in notebook search 2023-06-16 16:54:04 +05:00
ammarahm-ed
0a45e963a6 web: lookup topic notes at notebook level 2023-06-16 16:54:04 +05:00
ammarahm-ed
fb7b306bc5 web: fix search in topic returns no results 2023-06-16 16:54:04 +05:00
Abdullah Atta
4035751264 clipper(web): bump version to 0.2.2 2023-06-16 15:38:51 +05:00
Ammar Ahmed
07bb35395c clipper: fix duplicate notes created on save (#2722)
* clipper: fix duplicate notes created on save

* clipper(web): move singleton checks inside the fn

---------

Co-authored-by: Abdullah Atta <abdullahatta@streetwriters.co>
2023-06-16 15:15:14 +05:00
ammarahm-ed
09cd19d3b7 core: fix incorrect snooze time format 2023-06-16 10:23:46 +05:00
ammarahm-ed
a3988fd309 mobile: fix image replaces content if note is locked
& app lock is also enabled
2023-06-16 10:06:06 +05:00
ammarahm-ed
574c4cc8a9 mobile: fix appending link to empty note stuck 2023-06-15 16:43:54 +05:00
Abdullah Atta
5041e47902 core: fix require is not defined 2023-06-12 13:02:56 +05:00
Abdullah Atta
f3a03dc813 crypto: eagerly init sodium in dev mode 2023-06-12 12:57:39 +05:00
Abdullah Atta
942c9556f6 web: fix editor theme not changing with app theme 2023-06-12 12:00:47 +05:00
Abdullah Atta
5374f2b56c web: migrate to vitejs from webpack (#2715) 2023-06-12 11:49:37 +05:00
Abdullah Atta
3f128da55d docs: update readme 2023-06-10 16:03:09 +05:00
Abdullah Atta
0aa689ca03 desktop: add readme & other docs 2023-06-10 15:54:17 +05:00
Abdullah Atta
93e1ae5830 ci: set extraMetadata in package.json 2023-06-10 15:54:17 +05:00
Abdullah Atta
ef5aebdb3b ci: fix electron-builder command 2023-06-10 15:54:17 +05:00
Abdullah Atta
c152796767 ci: use yarn electron-builder on windows 2023-06-10 15:54:17 +05:00
Abdullah Atta
b75382f8b6 ci: change entrypoint before build 2023-06-10 15:54:17 +05:00
Abdullah Atta
80893a5011 ci: use electron-builder directly from ./node_modules/.bin directory 2023-06-10 15:54:17 +05:00
Abdullah Atta
0f9ac0e068 desktop: add dmg-license as optional dependency 2023-06-10 15:54:17 +05:00
Abdullah Atta
46e4ac127c ci: do not bootstrap after adding dmg-license 2023-06-10 15:54:17 +05:00
Abdullah Atta
3da4ced75b desktop: add build script & use nx to run build commands 2023-06-10 15:54:17 +05:00
Abdullah Atta
3f79ae6403 desktop: rename build script to release 2023-06-10 15:54:17 +05:00
Abdullah Atta
2d78b05e8d desktop: remove electron-builder install-app-deps from post-install 2023-06-10 15:54:17 +05:00
Abdullah Atta
c7c4ae4615 desktop: fix post-install command 2023-06-10 15:54:17 +05:00
Abdullah Atta
ee2cbea0c4 ci: add ./ before local action path 2023-06-10 15:54:17 +05:00
Abdullah Atta
782fc575a9 ci: improve node cache by using a common action 2023-06-10 15:54:17 +05:00
Abdullah Atta
151a527444 desktop: improve build scripts 2023-06-10 15:54:17 +05:00
Abdullah Atta
6ab0911970 desktop: finalize new desktop core 2023-06-10 15:54:17 +05:00
Abdullah Atta
28927e705b desktop: overhaul desktop core and migrate to typescript 2023-06-10 15:54:17 +05:00
ammarahm-ed
2a31f70b4a mobile: fix compactMode indicators show always 2023-06-10 12:25:48 +05:00
Abdullah Atta
0596bd9e84 desktop: update electron to v25.1.0 2023-06-08 18:20:47 +05:00
1533 changed files with 143876 additions and 171911 deletions

View File

@@ -14,13 +14,16 @@ const SCOPES = [
"mobile",
"web",
"vericrypt",
"desktop",
"crypto",
"editor",
"logger",
"theme",
"server",
"core",
"fs",
"ui",
"clipper",
"config",
"ci",
@@ -28,7 +31,10 @@ const SCOPES = [
"docs",
"refactor",
"misc",
"global"
"common",
"global",
"docs",
"themebuilder"
];
module.exports = {

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
* text=auto eol=lf

View File

@@ -0,0 +1,27 @@
name: "Setup node with cache action"
description: "Setups node with cache"
runs:
using: "composite"
steps:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "npm"
cache-dependency-path: |
package-lock.json
apps/mobile/package-lock.json
apps/desktop/package-lock.json
apps/web/package-lock.json
extensions/web-clipper/package-lock.json
packages/core/package-lock.json
packages/crypto/package-lock.json
packages/sodium/package-lock.json
packages/clipper/package-lock.json
packages/crypto-worker/package-lock.json
packages/editor-mobile/package-lock.json
packages/editor/package-lock.json
packages/logger/package-lock.json
packages/streamable-fs/package-lock.json
packages/theme/package-lock.json

4
.github/dco.yml vendored
View File

@@ -1,4 +0,0 @@
allowRemediationCommits:
individual: true
require:
members: false

View File

@@ -11,31 +11,20 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-node@master
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: |
apps/mobile/package-lock.json
apps/web/package-lock.json
packages/core/package-lock.json
packages/crypto/package-lock.json
packages/crypto-worker/package-lock.json
packages/editor-mobile/package-lock.json
packages/editor/package-lock.json
packages/logger/package-lock.json
packages/streamable-fs/package-lock.json
packages/theme/package-lock.json
- name: Setup Node
uses: ./.github/actions/setup-node-with-cache
- name: Use specific Java version for the builds
uses: joschi/setup-jdk@v2
with:
java-version: '11'
architecture: 'x64'
java-version: "11"
architecture: "x64"
- name: Install node modules
run: |
npm ci
npm ci --ignore-scripts --prefer-offline --no-audit
npm run bootstrap -- --scope=mobile
- name: Make Gradlew Executable
run: cd apps/mobile/native/android && chmod +x ./gradlew
@@ -50,7 +39,7 @@ jobs:
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- name: Publish to Playstore
id: deploy
@@ -61,4 +50,4 @@ jobs:
releaseFile: ${{steps.sign_app.outputs.signedReleaseFile}}
track: internal
status: completed
whatsNewDirectory: apps/mobile/native/android/releasenotes/
whatsNewDirectory: apps/mobile/native/android/releasenotes/

View File

@@ -11,31 +11,20 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-node@master
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: |
apps/mobile/package-lock.json
apps/web/package-lock.json
packages/core/package-lock.json
packages/crypto/package-lock.json
packages/crypto-worker/package-lock.json
packages/editor-mobile/package-lock.json
packages/editor/package-lock.json
packages/logger/package-lock.json
packages/streamable-fs/package-lock.json
packages/theme/package-lock.json
- name: Setup Node
uses: ./.github/actions/setup-node-with-cache
- name: Use specific Java version for the builds
uses: joschi/setup-jdk@v2
with:
java-version: '11'
architecture: 'x64'
java-version: "11"
architecture: "x64"
- name: Install node modules
run: |
npm ci
npm ci --ignore-scripts --prefer-offline --no-audit
npm run bootstrap -- --scope=mobile
- name: Make Gradlew Executable
run: cd apps/mobile/native/android && chmod +x ./gradlew
@@ -50,7 +39,7 @@ jobs:
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- name: Publish to Playstore
id: deploy
@@ -61,7 +50,7 @@ jobs:
releaseFiles: ${{steps.sign_app.outputs.signedReleaseFile}}
track: production
status: completed
whatsNewDirectory: apps/mobile/native/android/releasenotes/
whatsNewDirectory: apps/mobile/native/android/releasenotes/
- name: Build apks for Github release
run: yarn release:android
@@ -74,7 +63,7 @@ jobs:
signingKeyBase64: ${{ secrets.PUBLIC_SIGNING_KEY }}
alias: ${{ secrets.PUBLIC_ALIAS }}
keyStorePassword: ${{ secrets.PUBLIC_KEY_PASSWORD }}
keyPassword: ${{ secrets.PUBLIC_KEY_PASSWORD }}
keyPassword: ${{ secrets.PUBLIC_KEY_PASSWORD }}
- name: Rename apk files
run: |
@@ -102,4 +91,4 @@ jobs:
apps/mobile/native/android/app/build/outputs/apk/release/notesnook-arm64-v8a.apk
apps/mobile/native/android/app/build/outputs/apk/release/notesnook-armeabi-v7a.apk
apps/mobile/native/android/app/build/outputs/apk/release/notesnook-x86.apk
apps/mobile/native/android/app/build/outputs/apk/release/notesnook-x86_64.apk
apps/mobile/native/android/app/build/outputs/apk/release/notesnook-x86_64.apk

View File

@@ -8,7 +8,7 @@ on:
paths:
- "packages/core/**"
# re-run workflow if workflow file changes
- ".github/workflows/core.tests.yml"
- ".github/workflows/core.tests.yml"
pull_request:
types:
- "ready_for_review"
@@ -24,25 +24,12 @@ jobs:
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "npm"
cache-dependency-path: |
apps/mobile/package-lock.json
apps/web/package-lock.json
packages/core/package-lock.json
packages/crypto/package-lock.json
packages/crypto-worker/package-lock.json
packages/editor-mobile/package-lock.json
packages/editor/package-lock.json
packages/logger/package-lock.json
packages/streamable-fs/package-lock.json
packages/theme/package-lock.json
uses: ./.github/actions/setup-node-with-cache
- name: Prepare environment
run: |
npm ci --prefer-offline --no-audit
npm ci --ignore-scripts --prefer-offline --no-audit
npm run bootstrap -- --scope=core
- name: Add environment variables
run: |
echo "USER_EMAIL=${{ secrets.USER_EMAIL }}" >> $GITHUB_ENV

View File

@@ -28,26 +28,12 @@ jobs:
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "npm"
cache-dependency-path: |
apps/mobile/package-lock.json
apps/web/package-lock.json
packages/core/package-lock.json
packages/crypto/package-lock.json
packages/crypto-worker/package-lock.json
packages/editor-mobile/package-lock.json
packages/editor/package-lock.json
packages/logger/package-lock.json
packages/streamable-fs/package-lock.json
packages/theme/package-lock.json
uses: ./.github/actions/setup-node-with-cache
- name: Install packages
run: |
npm i --ignore-scripts --prefer-offline --no-audit
npx lerna bootstrap --ignore=@notesnook/mobile -- --prefer-offline --no-audit
npm ci --ignore-scripts --prefer-offline --no-audit
npm run bootstrap -- --scope=web
- name: Setup environment
run: |
@@ -64,7 +50,7 @@ jobs:
- name: Collect app metadata
id: app_metadata
working-directory: ./apps/web/desktop
working-directory: ./apps/desktop
run: |
echo ::set-output name=app_version::$(cat package.json | jq -r .version)
@@ -91,6 +77,9 @@ jobs:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Setup Node
uses: ./.github/actions/setup-node-with-cache
- name: Setup notarization
run: |
mkdir -p ~/private_keys/
@@ -98,13 +87,13 @@ jobs:
- name: Collect app metadata
id: app_metadata
working-directory: ./apps/web/desktop
working-directory: ./apps/desktop
run: |
echo ::set-output name=apple_app_id::$(cat package.json | jq -r .appAppleId)
echo ::set-output name=app_bundle_id::$(cat package.json | jq -r .build.appId)
echo ::set-output name=app_version::$(cat package.json | jq -r .version)
echo ::set-output name=bundle_version::$(cat package.json | jq -r .build.mac.bundleVersion)
- name: Get App Store Version
id: appstore
uses: streetwriters/appstore-connect-app-version@develop
@@ -115,26 +104,20 @@ jobs:
private-key-raw: ${{ secrets.api_key }}
platform: "MAC_OS"
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Download build
uses: actions/download-artifact@v3
with:
name: build
path: ./apps/web/desktop/build
path: ./apps/web/build
- name: Install packages
run: |
npm i
npm i dmg-license
working-directory: ./apps/web/desktop
npm ci --ignore-scripts --prefer-offline --no-audit
npm run bootstrap -- --scope=desktop
- name: Install provisioning profile
run: echo "${{ secrets.MAC_PROVISIONING_PROFILE }}" | base64 --decode > embedded.provisionprofile
working-directory: ./apps/web/desktop
working-directory: ./apps/desktop
- name: Build app for Mac App Store
if: inputs.publish-apple && steps.appstore.outputs.app-version-latest != steps.app_metadata.outputs.app_version
@@ -142,9 +125,9 @@ jobs:
CSC_LINK: ${{ secrets.mac_certs }}
CSC_KEY_PASSWORD: ${{ secrets.mac_certs_password }}
run: |
npm run build:mas
npx nx run release --project @notesnook/desktop -- --variant=mas
npx electron-builder --mac mas --universal -p never
working-directory: ./apps/web/desktop
working-directory: ./apps/desktop
- name: Build zip and dmg
env:
@@ -155,26 +138,26 @@ jobs:
APPLE_API_KEY_ID: ${{ secrets.api_key_id }}
APPLE_API_KEY_ISSUER: ${{ secrets.api_key_issuer_id }}
run: |
npm run build
npx nx run release --project @notesnook/desktop
if [ ${{ inputs.publish-github }} == true ]; then
npx electron-builder --mac zip dmg --arm64 --x64 -p always
else
npx electron-builder --mac zip dmg --arm64 --x64 -p never
fi
working-directory: ./apps/web/desktop
working-directory: ./apps/desktop
- name: Deploy to Testflight
if: inputs.publish-apple && steps.appstore.outputs.app-version-latest != steps.app_metadata.outputs.app_version
env:
API_KEY_ID: ${{ secrets.api_key_id }}
API_KEY_ISSUER_ID: ${{ secrets.api_key_issuer_id }}
run: |
package=$(find ./dist/mas-universal/notesnook*.pkg)
run: |
package=$(find ./output/mas-universal/notesnook*.pkg)
echo "Uploading ${package} using altool..."
xcrun altool --upload-package $package -t osx --apiKey $API_KEY_ID --apiIssuer $API_KEY_ISSUER_ID --apple-id ${{ steps.app_metadata.outputs.apple_app_id }} --bundle-id ${{ steps.app_metadata.outputs.app_bundle_id }} --bundle-short-version-string ${{ steps.app_metadata.outputs.app_version }} --bundle-version ${{ steps.app_metadata.outputs.bundle_version }}
working-directory: ./apps/web/desktop
working-directory: ./apps/desktop
build-linux:
name: Build for Linux
@@ -185,6 +168,9 @@ jobs:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Setup Node
uses: ./.github/actions/setup-node-with-cache
- name: Setup Snapcraft Auth
if: inputs.publish-snap
run: echo "SNAPCRAFT_STORE_CREDENTIALS=${{ secrets.snapcraft_token }}" >> $GITHUB_ENV
@@ -192,31 +178,27 @@ jobs:
- name: Install Snapcraft
uses: samuelmeuli/action-snapcraft@v1
if: inputs.publish-snap
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Download build
uses: actions/download-artifact@v3
with:
name: build
path: ./apps/web/desktop/build
path: ./apps/web/build
- name: Install packages
run: npm i
working-directory: ./apps/web/desktop
run: |
npm ci --ignore-scripts --prefer-offline --no-audit
npm run bootstrap -- --scope=desktop
- name: Build Electron wrapper
run: npm run build
working-directory: ./apps/web/desktop
run: npx nx run release --project @notesnook/desktop
working-directory: ./apps/desktop
- name: Build snap
if: inputs.publish-snap
run: |
npx electron-builder --linux snap:x64 -p never
working-directory: ./apps/web/desktop
working-directory: ./apps/desktop
- name: Build AppImage
env:
@@ -227,13 +209,13 @@ jobs:
else
npx electron-builder --linux AppImage:x64 AppImage:arm64 -p never
fi
working-directory: ./apps/web/desktop
working-directory: ./apps/desktop
- name: Publish on Snapcraft
if: inputs.publish-snap
run: |
snapcraft upload --release=stable ./dist/notesnook_linux_amd64.snap
working-directory: ./apps/web/desktop
snapcraft upload --release=stable ./output/notesnook_linux_amd64.snap
working-directory: ./apps/desktop
build-windows:
name: Build for Windows
@@ -245,31 +227,29 @@ jobs:
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
uses: ./.github/actions/setup-node-with-cache
- name: Download build
uses: actions/download-artifact@v3
with:
name: build
path: ./apps/web/desktop/build
path: ./apps/web/build
- name: Install packages
run: npm i
working-directory: ./apps/web/desktop
run: |
npm ci --ignore-scripts --prefer-offline --no-audit
npm run bootstrap -- --scope=desktop
- name: Build Electron wrapper
run: npm run build
working-directory: ./apps/web/desktop
- name: Build
run: npx nx run release --project @notesnook/desktop
- name: Build app
- name: Publish
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if ($${{ inputs.publish-github }} -eq $true) {
npx electron-builder --win --publish always
yarn electron-builder --win --publish always
} else {
npx electron-builder --win --publish never
yarn electron-builder --win --publish never
}
working-directory: ./apps/web/desktop
working-directory: ./apps/desktop

View File

@@ -25,26 +25,12 @@ jobs:
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "npm"
cache-dependency-path: |
apps/mobile/package-lock.json
apps/web/package-lock.json
packages/core/package-lock.json
packages/crypto/package-lock.json
packages/crypto-worker/package-lock.json
packages/editor-mobile/package-lock.json
packages/editor/package-lock.json
packages/logger/package-lock.json
packages/streamable-fs/package-lock.json
packages/theme/package-lock.json
uses: ./.github/actions/setup-node-with-cache
- name: Install packages
run: |
npm i --ignore-scripts --prefer-offline --no-audit
npx lerna bootstrap --ignore=@notesnook/mobile -- --prefer-offline --no-audit
npm ci --ignore-scripts --prefer-offline --no-audit
npm run bootstrap -- --scope=editor
- name: Setup environment
run: |

35
.github/workflows/help.publish.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Publish Notesnook Help
on:
workflow_dispatch:
push:
branches:
- "master"
paths:
- "docs/help/**"
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install docgen
run: cargo install --git https://github.com/thecodrr/docgen
- name: Build site
run: docgen build --release
working-directory: docs/help
- name: Setup environment
run: |
echo "CLOUDFLARE_ACCOUNT_ID=${{ secrets.CLOUDFLARE_ACCOUNT_ID }}" >> $GITHUB_ENV
echo "CLOUDFLARE_API_TOKEN=${{ secrets.CLOUDFLARE_API_TOKEN }}" >> $GITHUB_ENV
- name: Publish on Cloudflare Pages
run: npx --yes wrangler pages deploy --project-name notesnook-help ./docs/help/site/ --branch main

View File

@@ -11,4 +11,4 @@ jobs:
steps:
- name: Run ats-diagnostics
run: nscurl --ats-diagnostics https://payments.streetwriters.co
run: nscurl --ats-diagnostics https://payments.streetwriters.co

View File

@@ -0,0 +1,31 @@
name: Publish @notesnook/theme-builder
on: workflow_dispatch
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: ./.github/actions/setup-node-with-cache
- name: Install packages
run: |
npm ci --ignore-scripts --prefer-offline --no-audit
npm run bootstrap -- --scope=themebuilder
- name: Setup environment
run: |
echo "NX_CLOUD_ACCESS_TOKEN=${{ secrets.NX_CLOUD_ACCESS_TOKEN }}" >> $GITHUB_ENV
echo "CLOUDFLARE_ACCOUNT_ID=${{ secrets.CLOUDFLARE_ACCOUNT_ID }}" >> $GITHUB_ENV
echo "CLOUDFLARE_API_TOKEN=${{ secrets.CLOUDFLARE_API_TOKEN }}" >> $GITHUB_ENV
- name: Generate build
run: npm run build:theme-builder
- name: Publish to Cloudflare Pages
run: npx --yes wrangler pages deploy --project-name=notesnook-theme-builder ./apps/theme-builder/build/

31
.github/workflows/vericrypt.publish.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
name: Publish @notesnook/vericrypt
on: workflow_dispatch
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: ./.github/actions/setup-node-with-cache
- name: Install packages
run: |
npm ci --ignore-scripts --prefer-offline --no-audit
npm run bootstrap -- --scope=vericrypt
- name: Setup environment
run: |
echo "NX_CLOUD_ACCESS_TOKEN=${{ secrets.NX_CLOUD_ACCESS_TOKEN }}" >> $GITHUB_ENV
echo "CLOUDFLARE_ACCOUNT_ID=${{ secrets.CLOUDFLARE_ACCOUNT_ID }}" >> $GITHUB_ENV
echo "CLOUDFLARE_API_TOKEN=${{ secrets.CLOUDFLARE_API_TOKEN }}" >> $GITHUB_ENV
- name: Generate build
run: npm run build:vericrypt
- name: Publish on Cloudflare Pages
run: npx --yes wrangler pages deploy --project-name=vericrypt ./apps/vericrypt/build/

67
.github/workflows/web.beta.publish.yml vendored Normal file
View File

@@ -0,0 +1,67 @@
name: Publish @notesnook/web Beta
on:
workflow_dispatch:
push:
branches:
- master
paths-ignore:
- "apps/mobile/**"
- "packages/editor-mobile/**"
- "apps/desktop/**"
- "apps/vericrypt/**"
- "servers/**"
- "packages/clipper/**"
- "extensions/web-clipper/**"
pull_request:
types:
- closed
- ready_for_review
- reopened
- opened
- synchronize
branches:
- master
paths-ignore:
- "apps/mobile/**"
- "packages/editor-mobile/**"
- "apps/desktop/**"
- "apps/vericrypt/**"
- "servers/**"
- "packages/clipper/**"
- "extensions/web-clipper/**"
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: ./.github/actions/setup-node-with-cache
- name: Install packages
run: |
npm ci --ignore-scripts --prefer-offline --no-audit
npm run bootstrap -- --scope=web
- name: Setup environment
run: |
echo "NX_CLOUD_ACCESS_TOKEN=${{ secrets.NX_CLOUD_ACCESS_TOKEN }}" >> $GITHUB_ENV
echo "CLOUDFLARE_ACCOUNT_ID=${{ secrets.CLOUDFLARE_ACCOUNT_ID }}" >> $GITHUB_ENV
echo "CLOUDFLARE_API_TOKEN=${{ secrets.CLOUDFLARE_API_TOKEN }}" >> $GITHUB_ENV
- name: Generate beta build
run: npm run build:beta:web
- name: Publish to Cloudflare Pages
uses: unlike-ltd/github-actions-cloudflare-pages@v0.1.1
id: pages
with:
cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
cloudflare-project-name: notesnook-beta-app
directory: ./apps/web/build
github-token: ${{ secrets.GITHUB_TOKEN }}
github-environment: ${{ (github.ref == 'refs/heads/master' && 'beta') || 'preview' }}

View File

@@ -11,26 +11,12 @@ jobs:
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "npm"
cache-dependency-path: |
apps/mobile/package-lock.json
apps/web/package-lock.json
packages/core/package-lock.json
packages/crypto/package-lock.json
packages/crypto-worker/package-lock.json
packages/editor-mobile/package-lock.json
packages/editor/package-lock.json
packages/logger/package-lock.json
packages/streamable-fs/package-lock.json
packages/theme/package-lock.json
uses: ./.github/actions/setup-node-with-cache
- name: Install packages
run: |
npm i --ignore-scripts --prefer-offline --no-audit
npx lerna bootstrap --ignore=@notesnook/mobile -- --prefer-offline --no-audit
npm ci --ignore-scripts --prefer-offline --no-audit
npm run bootstrap -- --scope=web
- name: Setup environment
run: |
@@ -38,8 +24,8 @@ jobs:
echo "CLOUDFLARE_ACCOUNT_ID=${{ secrets.CLOUDFLARE_ACCOUNT_ID }}" >> $GITHUB_ENV
echo "CLOUDFLARE_API_TOKEN=${{ secrets.CLOUDFLARE_API_TOKEN }}" >> $GITHUB_ENV
- name: Generate desktop build
- name: Generate build
run: npm run build:web
- name: Publish on Cloudflare Pages
run: npx --yes wrangler pages publish --project-name=notesnook-app ./apps/web/build/
- name: Publish to Cloudflare Pages
run: npx --yes wrangler pages deploy --project-name=notesnook-app ./apps/web/build/

View File

@@ -25,26 +25,12 @@ jobs:
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "npm"
cache-dependency-path: |
apps/mobile/package-lock.json
apps/web/package-lock.json
packages/core/package-lock.json
packages/crypto/package-lock.json
packages/crypto-worker/package-lock.json
packages/editor-mobile/package-lock.json
packages/editor/package-lock.json
packages/logger/package-lock.json
packages/streamable-fs/package-lock.json
packages/theme/package-lock.json
uses: ./.github/actions/setup-node-with-cache
- name: Install packages
run: |
npm i --ignore-scripts --prefer-offline --no-audit
npx lerna bootstrap --ignore=@notesnook/mobile -- --prefer-offline --no-audit
npm ci --ignore-scripts --prefer-offline --no-audit
npm run bootstrap -- --scope=web
- name: Setup environment
run: |
@@ -76,25 +62,11 @@ jobs:
path: ./apps/web/build
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "npm"
cache-dependency-path: |
apps/mobile/package-lock.json
apps/web/package-lock.json
packages/core/package-lock.json
packages/crypto/package-lock.json
packages/crypto-worker/package-lock.json
packages/editor-mobile/package-lock.json
packages/editor/package-lock.json
packages/logger/package-lock.json
packages/streamable-fs/package-lock.json
packages/theme/package-lock.json
uses: ./.github/actions/setup-node-with-cache
- name: Install packages
run: |
npm i --ignore-scripts --prefer-offline --no-audit
npm ci --ignore-scripts --prefer-offline --no-audit
npm install -D @playwright/test otplib
- name: Validate build extraction

4
.gitignore vendored
View File

@@ -7,4 +7,6 @@ nx-cloud.env
.idea
.eslintcache
.env.local
.nyc_output
.nyc_output
site
node_modules.backup

View File

@@ -5,5 +5,6 @@ module.exports = {
printWidth: 80,
useTabs: false,
tabWidth: 2,
bracketSpacing: true
bracketSpacing: true,
endOfLine: "lf"
};

View File

@@ -1,72 +0,0 @@
{
"folders": [
{
"name": "✨ notesnook",
"path": ".."
},
{
"name": "🚀 @notesnook/mobile",
"path": "../apps/mobile"
},
{
"name": "🚀 @notesnook/web",
"path": "../apps/web"
},
{
"name": "🚀 @notesnook/desktop",
"path": "../apps/web/desktop"
},
{
"name": "🚀 @notesnook/web-clipper",
"path": "../extensions/web-clipper"
},
{
"name": "📦 @notesnook/clipper",
"path": "../packages/clipper"
},
{
"name": "📦 @notesnook/core",
"path": "../packages/core"
},
{
"name": "📦 @notesnook/crypto",
"path": "../packages/crypto"
},
{
"name": "📦 @notesnook/crypto-worker",
"path": "../packages/crypto-worker"
},
{
"name": "📦 @notesnook/editor",
"path": "../packages/editor"
},
{
"name": "📦 @notesnook/editor-mobile",
"path": "../packages/editor-mobile"
},
{
"name": "📦 @notesnook/logger",
"path": "../packages/logger"
},
{
"name": "📦 @notesnook/streamable-fs",
"path": "../packages/streamable-fs"
},
{
"name": "📦 @notesnook/theme",
"path": "../packages/theme"
}
],
"settings": {
"typescript.tsdk": "node_modules/typescript/lib",
"javascript.format.enable": true,
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "modificationsIfAvailable",
"eslint.packageManager": "npm",
"eslint.run": "onSave",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"eslint.execArgv": ["--cache"]
}
}

15
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,15 @@
{
"files.eol": "\n",
"typescript.tsdk": "node_modules/typescript/lib",
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
"eslint.run": "onSave",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"eslint.options": {
"cache": true,
"cacheStrategy": "content"
},
"git.rebaseWhenSync": true
}

View File

@@ -25,25 +25,30 @@ Notesnook is built using the following technologies:
1. JavaScript/Typescript — this repo is in a hybrid state. A lot of the newer code is being written in Typescript & the old code is slowly being ported over.
2. React — the whole front-end across all platforms is built using React.
3. React Native — For mobile apps we are using React Native
4. NPM — listed here because we **don't** use Yarn or PNPM or XYZ across any of our projects.
5. Lerna & Nx — maintaining monorepos is hard but Nx makes it easier.
4. Electron — For desktop app
5. NPM — listed here because we **don't** use Yarn or PNPM or XYZ across any of our projects.
6. Nx — maintaining monorepos is hard but Nx makes it easier.
> **Note: Each project in the monorepo contains its own architecture details which you can refer to.**
### Monorepo structure
| Name | Path | Description |
| -------------------------- | -------------------------------------------------- | ----------------------------------------------------------------- |
| `@notesnook/web` | [/apps/web](/apps/web) | Web/Desktop clients |
| `@notesnook/mobile` | [/apps/mobile](/apps/mobile) | Android/iOS clients |
| `@notesnook/core` | [/packages/core](/packages/core) | Shared core between all platforms |
| `@notesnook/crypto` | [/packages/crypto](/packages/crypto) | Cryptography library wrapper around libsodium |
| `@notesnook/editor` | [/packages/editor](/packages/editor) | Notesnook editor + all extensions |
| `@notesnook/editor-mobile` | [/packages/editor-mobile](/packages/editor-mobile) | A very thin wrapper around `@notesnook/editor` for mobile clients |
| `@notesnook/logger` | [/packages/logger](/packages/logger) | Simple & pluggable logger |
| `@notesnook/crypto-worker` | [/packages/crypto-worker](/packages/crypto-worker) | Helpers to use `@notesnook/crypto` from a Worker |
| `@notesnook/streamable-fs` | [/packages/streamable-fs](/packages/streamable-fs) | Streaming interface around an IndexedDB based file system |
| `@notesnook/theme` | [/packages/theme](/packages/theme) | The core theme used in web & desktop clients |
| Name | Path | Description |
| -------------------------- | -------------------------------------------------- | -------------------------------------------------------------------- |
| `@notesnook/web` | [/apps/web](/apps/web) | Web client |
| `@notesnook/desktop` | [/apps/desktop](/apps/desktop) | Desktop client |
| `@notesnook/mobile` | [/apps/mobile](/apps/mobile) | Android/iOS clients |
| `@notesnook/web-clipper` | [/extensions/web-clipper](/extensions/web-clipper) | Web clipper |
| `@notesnook/core` | [/packages/core](/packages/core) | Shared core between all platforms |
| `@notesnook/crypto` | [/packages/crypto](/packages/crypto) | Cryptography library wrapper around libsodium |
| `@notesnook/clipper` | [/packages/clipper](/packages/clipper) | Web clipper core handling everything related to actual page clipping |
| `@notesnook/editor` | [/packages/editor](/packages/editor) | Notesnook editor + all extensions |
| `@notesnook/editor-mobile` | [/packages/editor-mobile](/packages/editor-mobile) | A very thin wrapper around `@notesnook/editor` for mobile clients |
| `@notesnook/logger` | [/packages/logger](/packages/logger) | Simple & pluggable logger |
| `@notesnook/sodium` | [/packages/sodium](/packages/sodium) | Wrapper around libsodium to support Node.js & Browser |
| `@notesnook/crypto-worker` | [/packages/crypto-worker](/packages/crypto-worker) | Helpers to use `@notesnook/crypto` from a Worker |
| `@notesnook/streamable-fs` | [/packages/streamable-fs](/packages/streamable-fs) | Streaming interface around an IndexedDB based file system |
| `@notesnook/theme` | [/packages/theme](/packages/theme) | The core theme used in web & desktop clients |
### Contributing guidelines

4
apps/desktop/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
node_modules
build
output
dist

58
apps/desktop/README.md Normal file
View File

@@ -0,0 +1,58 @@
<p align="center">
<img style="align:center;" src="/resources/screenshots/web.jpg" alt="Notesnook desktop screenshot" width="600" />
</p>
<h1 align="center">Notesnook Desktop</h1>
<h3 align="center">The desktop app is built using Electron & Typescript.</h3>
<p align="center">
<a href="https://notesnook.com/downloads">Downloads</a> | <a href="#developer-guide">Developer guide</a> | <a href="#build-instructions">How to build?</a>
</p>
## Getting started
## Build instructions
> **Before you start, it is recommended that you read [the contributing guidelines](/CONTRIBUTING.md).**
### Setting up the development environment
Requirements:
1. [Node.js](https://nodejs.org/en/download/)
2. [git](https://git-scm.com/downloads)
3. NPM (not yarn or pnpm)
Before you can do anything, you'll need to [install Node.js](https://nodejs.org/en/download/) v16 or later on your system.
Once you have completed the setup, the first step is to `clone` the monorepo:
```bash
git clone https://github.com/streetwriters/notesnook.git
# change directory
cd notesnook
```
Once you are inside the `./notesnook` directory, run the preparation step:
```bash
# this might take a while to complete
npm install
```
Now you can finally start the desktop app:
```bash
npm run start:desktop
```
## Developer guide
### The tech stack
We try to keep the stack as lean as possible:
1. Electron
2. tRPC: for cross-communication between the web & desktop parts
3. zod: for runtime typechecking
4. yargs: for CLI argument parsing

View File

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View File

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

Before

Width:  |  Height:  |  Size: 520 B

After

Width:  |  Height:  |  Size: 520 B

View File

Before

Width:  |  Height:  |  Size: 917 B

After

Width:  |  Height:  |  Size: 917 B

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 353 KiB

After

Width:  |  Height:  |  Size: 353 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

58
apps/desktop/global.d.ts vendored Normal file
View File

@@ -0,0 +1,58 @@
/*
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/>.
*/
/* eslint-disable no-var */
import { BrowserWindow } from "electron";
import {
type FormData as FormDataType,
type Headers as HeadersType,
type Request as RequestType,
type Response as ResponseType
} from "undici";
declare global {
var window: BrowserWindow | null;
var RELEASE: boolean;
var MAC_APP_STORE: boolean;
// Re-export undici fetch function and various classes to global scope.
// These are classes and functions expected to be at global scope according to Node.js v18 API
// documentation.
// See: https://nodejs.org/dist/latest-v18.x/docs/api/globals.html
// eslint-disable-next-line no-var
export var {
FormData,
Headers,
Request,
Response,
fetch
}: typeof import("undici");
type FormData = FormDataType;
type Headers = HeadersType;
type Request = RequestType;
type Response = ResponseType;
}
// NOTE: the import in the global block above needs to be a var for this to work properly.
globalThis.fetch = fetch;
globalThis.FormData = FormData;
globalThis.Headers = Headers;
globalThis.Request = Request;
globalThis.Response = Response;

3976
apps/desktop/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -2,32 +2,46 @@
"name": "@notesnook/desktop",
"productName": "Notesnook",
"description": "Your private note taking space",
"version": "2.5.2",
"version": "2.6.1",
"appAppleId": "1544027013",
"private": true,
"main": "./build/electron.js",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"homepage": "https://notesnook.com/",
"repository": "https://github.com/streetwriters/notesnook",
"license": "GPL-3.0-or-later",
"dependencies": {
"diary": "^0.3.1",
"electron-updater": "^5.3.0",
"@notesnook/crypto": "file:../../packages/crypto",
"@trpc/client": "10.31.0",
"@trpc/server": "10.31.0",
"electron-trpc": "0.5.2",
"electron-updater": "6.1.1",
"icojs": "^0.17.1",
"isomorphic-fetch": "^3.0.0",
"yargs": "^17.6.2"
"typed-emitter": "^2.1.0",
"yargs": "^17.6.2",
"zod": "^3.21.4"
},
"devDependencies": {
"@types/node-fetch": "^2.6.2",
"electron": "^21.1.1",
"electron-builder": "^23.6.0",
"electron-builder-notarize": "^1.5.0",
"electron-reloader": "^1.2.3",
"esbuild": "^0.15.11",
"patch-package": "^6.5.1"
"@types/node": "18.16.1",
"@types/yargs": "^17.0.24",
"chokidar": "^3.5.3",
"electron": "^26.1.0",
"electron-builder": "^24.6.3",
"electron-builder-notarize": "^1.5.1",
"esbuild": "^0.17.19",
"tree-kill": "^1.2.2",
"undici": "^5.23.0"
},
"optionalDependencies": {
"dmg-license": "^1.0.11"
},
"scripts": {
"build": "esbuild ./electron.js ./preload.js --external:electron --external:fsevents --minify --bundle --outdir=./build --platform=node --tsconfig=tsconfig.json --define:MAC_APP_STORE=false --define:RELEASE=true",
"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 --define:RELEASE=true",
"pack": "rm -rf ./build && cp -r ../build ./ && npm run build && yarn electron-builder --linux AppImage:x64 AppImage:arm64",
"start": "node scripts/dev.mjs",
"staging": "node scripts/build.mjs --run",
"release": "node scripts/build.mjs",
"build": "tsc",
"bundle": "esbuild electron=./src/main.ts ./src/preload.ts --external:electron --external:fsevents --minify --bundle --outdir=./build --platform=node --tsconfig=tsconfig.json --define:MAC_APP_STORE=false --define:RELEASE=true",
"bundle:mas": "esbuild electron=./src/main.ts ./src/preload.ts --minify --external:electron --external:fsevents --bundle --outdir=./build --platform=node --tsconfig=tsconfig.json --define:MAC_APP_STORE=true --define:RELEASE=true",
"postinstall": "patch-package"
},
"author": {
@@ -40,12 +54,17 @@
"productName": "Notesnook",
"copyright": "Copyright © 2023 Streetwriters (Private) Limited",
"artifactName": "notesnook_${os}_${arch}.${ext}",
"npmRebuild": false,
"asar": false,
"files": [
"!*.chunk.js.map",
"!*.chunk.js.LICENSE.txt",
"build/",
"!build/screenshots",
"!node_modules"
"!build/screenshots${/*}",
"!build/banner.jpg",
"!build/*.ico",
"!build/*.png",
"!node_modules${/*}"
],
"afterSign": "electron-builder-notarize",
"afterPack": "./scripts/removeLocales.js",
@@ -174,9 +193,12 @@
"extraResources": [
"./assets/**"
],
"extraMetadata": {
"main": "./build/electron.js"
},
"directories": {
"buildResources": "assets",
"output": "./dist/"
"output": "./output/"
},
"publish": [
{

View File

@@ -1,5 +1,5 @@
diff --git a/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js b/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js
index ffcc8bd..7e57c9e 100644
index 3ba5d6a..cf8e147 100644
--- a/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js
+++ b/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js
@@ -105,6 +105,7 @@ class LinuxTargetHelper {
@@ -9,12 +9,12 @@ index ffcc8bd..7e57c9e 100644
+ actions: undefined
};
const description = this.getDescription(targetSpecificOptions);
if (!builder_util_1.isEmptyOrSpaces(description)) {
if (!(0, builder_util_1.isEmptyOrSpaces)(description)) {
@@ -148,6 +149,23 @@ class LinuxTargetHelper {
data += `\n${name}=${desktopMeta[name]}`;
}
data += "\n";
+
+
+ if (targetSpecificOptions.desktop.actions) {
+ let actionsData = "";
+ const validActions = [];

View File

@@ -0,0 +1,23 @@
diff --git a/node_modules/electron-trpc/dist/main.mjs b/node_modules/electron-trpc/dist/main.mjs
index 379cf3b..2644e5d 100644
--- a/node_modules/electron-trpc/dist/main.mjs
+++ b/node_modules/electron-trpc/dist/main.mjs
@@ -221,9 +221,16 @@ class G {
i(this, c).includes(r) || (i(this, c).push(r), I(this, T, W).call(this, r));
}
detachWindow(r) {
+
y(this, c, i(this, c).filter((n) => n !== r));
- for (const [n, t] of i(this, u).entries())
- n.startsWith(`${r.webContents.id}-`) && (t.unsubscribe(), i(this, u).delete(n));
+ for (const [n, t] of i(this, u).entries()) {
+ try {
+ n.startsWith(`${r.webContents.id}-`) && (t.unsubscribe(), i(this, u).delete(n));
+ } catch(e) {
+ console.error(e);
+ // ignore
+ }
+ }
}
}
c = new WeakMap(), u = new WeakMap(), T = new WeakSet(), W = function(r) {

View File

@@ -0,0 +1,117 @@
/*
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 path from "path";
import fs from "fs/promises";
import { existsSync } from "fs";
import yargs from "yargs-parser";
import os from "os";
import * as childProcess from "child_process";
import { fileURLToPath } from "url";
const args = yargs(process.argv);
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const sodiumNativePrebuildPath = (arch) =>
path.join(
`node_modules`,
`@notesnook`,
`crypto`,
`node_modules`,
`@notesnook`,
`sodium`,
`node_modules`,
`sodium-native`,
`prebuilds`,
`${os.platform()}-${arch}`
);
const webAppPath = path.resolve(path.join(__dirname, "..", "..", "web"));
await fs.rm("./build/", { force: true, recursive: true });
if (args.rebuild || !existsSync(path.join(webAppPath, "build"))) {
await exec(`cd ${webAppPath} && npm run build:desktop`);
}
await fs.cp(path.join(webAppPath, "build"), "build", {
recursive: true,
force: true
});
if (args.variant === "mas") {
await exec(`npm run bundle:mas`);
} else {
await exec(`npm run bundle`);
}
await exec(`npx tsc`);
if (existsSync(sodiumNativePrebuildPath("x64"))) {
console.log("copying sodium-native-x64");
await fs.cp(
sodiumNativePrebuildPath("x64"),
path.join("build", "prebuilds", `${process.platform}-x64`),
{
recursive: true,
force: true
}
);
}
if (existsSync(sodiumNativePrebuildPath("ia32"))) {
console.log("copying sodium-native-ia32");
await fs.cp(
sodiumNativePrebuildPath("ia32"),
path.join("build", "prebuilds", `${process.platform}-ia32`),
{
recursive: true,
force: true
}
);
}
if (existsSync(sodiumNativePrebuildPath("arm64"))) {
console.log("copying sodium-native-arm64");
await fs.cp(
sodiumNativePrebuildPath("arm64"),
path.join("build", "prebuilds", `${process.platform}-arm64`),
{
recursive: true,
force: true
}
);
}
if (args.run) {
await exec(`npx electron-builder --dir --x64`);
if (process.platform === "win32") {
await exec(`.\\output\\win-unpacked\\Notesnook.exe`);
} else if (process.platform === "darwin") {
await exec(`./output/darwin-unpacked/Notesnook`);
} else {
await exec(`./output/linux-unpacked/Notesnook`);
}
}
async function exec(cmd) {
return childProcess.execSync(cmd, {
env: process.env,
stdio: "inherit"
});
}

View File

@@ -0,0 +1,197 @@
/*
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 path from "path";
import fs from "fs/promises";
import chokidar from "chokidar";
import { execSync, spawn } from "child_process";
import { fileURLToPath } from "url";
import treekill from "tree-kill";
import crypto from "crypto";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const sodiumNativePrebuildPath = path.join(
`node_modules`,
`@notesnook`,
`crypto`,
`node_modules`,
`@notesnook`,
`sodium`,
`node_modules`,
`sodium-native`,
`prebuilds`
);
const RUNNING_PROCESSES = [];
const RESTARTABLE_PROCESSES = [];
let lastBundleHash = null;
await onChange(true);
console.log("Watching...");
const watcher = chokidar.watch("src/", { ignoreInitial: true });
watcher.on("all", () => {
onChange(false);
});
process.on("SIGINT", async (s) => {
await cleanup();
});
async function onChange(first) {
if (first) {
await fs.rm("./build/", { force: true, recursive: true });
}
await exec(`npm run bundle`);
execAsync(`npx`, [`tsc`]);
if (await isBundleSame()) {
console.log("Bundle is same. Doing nothing.");
return;
}
if (first) {
await fs.cp(sodiumNativePrebuildPath, "build/prebuilds", {
recursive: true,
force: true
});
}
if (first) {
await spawnAndWaitUntil(
["npx", "nx", "start:desktop", "@notesnook/web"],
path.join(__dirname, "..", "..", ".."),
(data) => data.includes("Network: use --host to expose")
);
}
if (!first) {
console.log("Restarting...", RESTARTABLE_PROCESSES.length);
await killProcesses(RESTARTABLE_PROCESSES);
}
execAsync(
"npx",
["electron", path.join("build", "electron.js")],
true,
cleanup
);
}
function spawnAndWaitUntil(cmd, cwd, predicate) {
return new Promise((resolve) => {
console.log(">", ...cmd);
const s = spawn(cmd[0], cmd.slice(1), {
cwd,
env: { ...process.env, NO_COLOR: "true" },
shell: false
});
RUNNING_PROCESSES.push(s);
s.stderr.pipe(process.stderr);
s.stdout.on("data", (data) => {
process.stdout.write(data);
if (predicate(data)) resolve(undefined); //
});
});
}
async function exec(cmd) {
try {
console.log(">", cmd);
return execSync(cmd, {
env: process.env,
stdio: "inherit",
shell: false
});
} catch {
//ignore
}
}
function execAsync(cmd, args, restartable, onExit) {
try {
console.log(">", cmd, ...args);
const proc = spawn(cmd, args, {
stdio: "inherit",
env: process.env,
shell: false
});
const array = restartable ? RESTARTABLE_PROCESSES : RUNNING_PROCESSES;
array.push(proc);
proc.on("exit", (code, signal) => {
console.log(cmd, ...args, "closed with code", code);
if (code === 0 && !signal) {
array.splice(array.indexOf(proc), 1);
onExit && onExit();
}
});
} catch {
//ignore
}
}
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
async function killProcesses(processes) {
for (const process of processes.slice()) {
processes.splice(processes.indexOf(process), 1);
await new Promise((resolve, reject) =>
treekill(process.pid, (err) => (err ? reject(err) : resolve()))
);
}
}
async function cleanup() {
console.log("Cleaning up");
await killProcesses(RESTARTABLE_PROCESSES);
await killProcesses(RUNNING_PROCESSES);
await sleep(1000);
await fs.rm("./build/", { force: true, recursive: true });
process.exit();
}
async function isBundleSame() {
const bundle = await fs.readFile(
path.join(__dirname, "..", "build", "electron.js")
);
const hashSum = crypto.createHash("sha256");
hashSum.update(bundle);
const hex = hashSum.digest("hex");
if (!lastBundleHash) {
lastBundleHash = hex;
return false;
}
if (hex === lastBundleHash) return true;
lastBundleHash = hex;
return false;
}

View File

@@ -0,0 +1,58 @@
/*
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 { initTRPC } from "@trpc/server";
import { observable } from "@trpc/server/observable";
import { EventEmitter } from "events";
import TypedEventEmitter from "typed-emitter";
export type AppEvents = {
onCreateItem(name: "note" | "notebook" | "reminder"): void;
};
const emitter = new EventEmitter();
const typedEmitter = emitter as TypedEventEmitter<AppEvents>;
const t = initTRPC.create();
export const bridgeRouter = t.router({
onCreateItem: createSubscription("onCreateItem")
});
export const bridge: AppEvents = new Proxy({} as AppEvents, {
get(_t, name) {
if (typeof name === "symbol") return;
return (...args: unknown[]) => {
emitter.emit(name, ...args);
};
}
});
function createSubscription<TName extends keyof AppEvents>(eventName: TName) {
return t.procedure.subscription(() => {
return observable<Parameters<AppEvents[TName]>[0]>((emit) => {
const listener: AppEvents[TName] = (...args: any[]) => {
emit.next(args[0]);
};
typedEmitter.addListener(eventName, listener);
return () => {
typedEmitter.removeListener(eventName, listener);
};
});
});
}

View File

@@ -18,16 +18,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import zlib from "node:zlib";
import utils from "node:util";
import { initTRPC } from "@trpc/server";
import { z } from "zod";
const t = initTRPC.create();
const gzipAsync = utils.promisify(zlib.gzip);
const gunzipAsync = utils.promisify(zlib.gunzip);
export async function gzip(args) {
const { data, level } = args;
return (await gzipAsync(data, { level })).toString("base64");
}
export async function gunzip(args) {
const { data } = args;
return (await gunzipAsync(Buffer.from(data, "base64"))).toString("utf-8");
}
export const compressionRouter = t.router({
gzip: t.procedure
.input(z.object({ data: z.string(), level: z.number() }))
.query(async ({ input }) => {
const { data, level } = input;
return (await gzipAsync(data, { level })).toString("base64");
}),
gunzip: t.procedure.input(z.string()).query(async ({ input }) => {
return (await gunzipAsync(Buffer.from(input, "base64"))).toString("utf-8");
})
});

View File

@@ -17,25 +17,25 @@ 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 { ipcMain } from "electron";
import { logger } from "../logger";
import { getAction } from "./actions";
import { getCall } from "./calls";
import { initTRPC } from "@trpc/server";
import { compressionRouter } from "./compression";
import { osIntegrationRouter } from "./os-integration";
import { spellCheckerRouter } from "./spell-checker";
import { updaterRouter } from "./updater";
import { bridgeRouter } from "./bridge";
ipcMain.on("fromRenderer", async (event, args) => {
logger.info("Action requested by renderer", args);
const t = initTRPC.create();
const { type } = args;
const action = getAction(type);
if (!action) return;
await action(args);
export const router = t.router({
compress: compressionRouter,
integration: osIntegrationRouter,
spellChecker: spellCheckerRouter,
updater: updaterRouter,
bridge: bridgeRouter
});
ipcMain.handle("fromRenderer", async (event, args) => {
const { type } = args;
logger.info("Call requested by renderer", type);
const call = getCall(type);
if (!call) return;
export const api = router.createCaller({});
return await call(args, globalThis.window);
});
// Export type router type signature,
// NOT the router itself.
export type AppRouter = typeof router;

View File

@@ -0,0 +1,160 @@
/*
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 { initTRPC } from "@trpc/server";
import { z } from "zod";
import { dialog, nativeTheme, Notification, shell } from "electron";
import { AutoLaunch } from "../utils/autolaunch";
import { config, DesktopIntegration } from "../utils/config";
import { bringToFront } from "../utils/bring-to-front";
import { getTheme, setTheme, Theme } from "../utils/theme";
import { mkdirSync, writeFileSync } from "fs";
import { dirname } from "path";
import { resolvePath } from "../utils/resolve-path";
import { observable } from "@trpc/server/observable";
import { AssetManager } from "../utils/asset-manager";
const t = initTRPC.create();
const NotificationOptions = z.object({
title: z.string().optional(),
body: z.string().optional(),
silent: z.boolean().optional(),
timeoutType: z.union([z.literal("default"), z.literal("never")]).optional(),
urgency: z
.union([z.literal("normal"), z.literal("critical"), z.literal("low")])
.optional(),
tag: z.string()
});
export const osIntegrationRouter = t.router({
zoomFactor: t.procedure.query(() => config.zoomFactor),
setZoomFactor: t.procedure.input(z.number()).mutation(({ input: factor }) => {
globalThis.window?.webContents.setZoomFactor(factor);
config.zoomFactor = factor;
}),
privacyMode: t.procedure.query(() => config.privacyMode),
setPrivacyMode: t.procedure
.input(z.object({ enabled: z.boolean() }))
.mutation(({ input: { enabled } }) => {
if (!globalThis.window || !["win32", "darwin"].includes(process.platform))
return;
globalThis.window.setContentProtection(enabled);
if (process.platform === "win32") {
globalThis.window.setThumbnailClip(
enabled
? { x: 0, y: 0, width: 1, height: 1 }
: { x: 0, y: 0, width: 0, height: 0 }
);
}
config.privacyMode = enabled;
}),
desktopIntegration: t.procedure.query(() => config.desktopSettings),
setDesktopIntegration: t.procedure
.input(DesktopIntegration)
.mutation(({ input: settings }) => {
if (settings.autoStart) {
AutoLaunch.enable(!!settings.startMinimized);
} else {
AutoLaunch.disable();
}
config.desktopSettings = settings;
}),
selectDirectory: t.procedure
.input(
z.object({
title: z.string().optional(),
buttonLabel: z.string().optional(),
defaultPath: z.string().optional()
})
)
.query(async ({ input }) => {
if (!globalThis.window) return undefined;
const { title, buttonLabel, defaultPath } = input;
const result = await dialog.showOpenDialog(globalThis.window, {
title,
buttonLabel,
properties: ["openDirectory"],
defaultPath: defaultPath && resolvePath(defaultPath)
});
if (result.canceled) return undefined;
return result.filePaths[0];
}),
saveFile: t.procedure
.input(z.object({ data: z.string(), filePath: z.string() }))
.query(({ input }) => {
const { data, filePath } = input;
if (!data || !filePath) return;
const resolvedPath = resolvePath(filePath);
mkdirSync(dirname(resolvedPath), { recursive: true });
writeFileSync(resolvedPath, data);
}),
showNotification: t.procedure
.input(NotificationOptions)
.query(({ input }) => {
const notification = new Notification({
...input,
icon: AssetManager.appIcon({
size: 64,
format: process.platform === "win32" ? "ico" : "png"
})
});
notification.show();
if (input.urgency === "critical") {
shell.beep();
}
return new Promise((resolve) => {
notification.once("close", () => resolve(undefined));
notification.once("click", () => resolve(input.tag));
});
}),
openPath: t.procedure
.input(z.object({ type: z.literal("path"), link: z.string() }))
.query(({ input }) => {
const { type, link } = input;
if (type === "path") return shell.openPath(resolvePath(link));
}),
bringToFront: t.procedure.query(() => bringToFront()),
changeTheme: t.procedure
.input(Theme)
.mutation(({ input }) => setTheme(input)),
onThemeChanged: t.procedure.subscription(() =>
observable<"dark" | "light">((emit) => {
nativeTheme.on("updated", () => {
if (getTheme() === "system") {
emit.next(nativeTheme.shouldUseDarkColors ? "dark" : "light");
}
});
})
)
});

View File

@@ -17,9 +17,13 @@ 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 { getIsSpellCheckerEnabled } from "../../config/spellChecker";
import { initTRPC } from "@trpc/server";
import { z } from "zod";
import { config } from "../utils/config";
const LANGUAGES = {
const t = initTRPC.create();
const LANGUAGES: Record<string, string> = {
af: "Afrikaans",
bg: "Bulgarian",
ca: "Catalan",
@@ -78,28 +82,41 @@ const LANGUAGES = {
vi: "Vietnamese"
};
/**
*
* @param {*} args
* @param {import("electron").BrowserWindow} win
* @returns
*/
export default function (_args, win) {
if (!win) return;
type Language = { code: string; name: string };
return {
enabled: getIsSpellCheckerEnabled(),
languages: win.webContents.session.availableSpellCheckerLanguages.map(
(code) => ({
code,
name: LANGUAGES[code]
})
export const spellCheckerRouter = t.router({
isEnabled: t.procedure.query(() => config.isSpellCheckerEnabled),
languages: t.procedure.query(
() =>
<Language[]>(
globalThis.window?.webContents.session.availableSpellCheckerLanguages.map(
(code) => ({
code,
name: LANGUAGES[code]
})
)
)
),
enabledLanguages: t.procedure.query(
() =>
<Language[]>(
globalThis.window?.webContents.session
.getSpellCheckerLanguages()
.map((code) => ({
code,
name: LANGUAGES[code]
}))
)
),
setLanguages: t.procedure
.input(z.array(z.string()))
.mutation(({ input: languages }) =>
globalThis.window?.webContents.session.setSpellCheckerLanguages(languages)
),
enabledLanguages: win.webContents.session
.getSpellCheckerLanguages()
.map((code) => ({
code,
name: LANGUAGES[code]
}))
};
}
toggle: t.procedure
.input(z.object({ enabled: z.boolean() }))
.mutation(({ input: { enabled } }) => {
globalThis.window?.webContents.session.setSpellCheckerEnabled(enabled);
config.isSpellCheckerEnabled = enabled;
})
});

View File

@@ -0,0 +1,80 @@
/*
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 { initTRPC } from "@trpc/server";
import { observable } from "@trpc/server/observable";
import { CancellationToken, autoUpdater } from "electron-updater";
import type { AppUpdaterEvents } from "electron-updater/out/AppUpdater";
import { z } from "zod";
import { config } from "../utils/config";
type UpdateInfo = { version: string };
type Progress = { percent: number };
const t = initTRPC.create();
export const updaterRouter = t.router({
autoUpdates: t.procedure.query(() => config.automaticUpdates),
install: t.procedure.query(() => autoUpdater.quitAndInstall()),
download: t.procedure.query(async () => {
const cancellationToken = new CancellationToken();
await autoUpdater.downloadUpdate(cancellationToken);
}),
check: t.procedure.query(async () => {
await autoUpdater.checkForUpdates();
}),
toggleAutoUpdates: t.procedure
.input(z.object({ enabled: z.boolean() }))
.mutation(({ input: { enabled } }) => {
config.automaticUpdates = enabled;
}),
onChecking: createSubscription("checking-for-update"),
onDownloaded: createSubscription<"update-downloaded", UpdateInfo>(
"update-downloaded"
),
onDownloadProgress: createSubscription<"download-progress", Progress>(
"download-progress"
),
onNotAvailable: createSubscription<"update-not-available", UpdateInfo>(
"update-not-available"
),
onAvailable: createSubscription<"update-available", UpdateInfo>(
"update-available"
),
onError: createSubscription("error")
});
function createSubscription<
TName extends keyof AppUpdaterEvents,
TReturnType = Parameters<AppUpdaterEvents[TName]>[0]
>(eventName: TName) {
return t.procedure.subscription(() => {
return observable<TReturnType>((emit) => {
const listener: AppUpdaterEvents[TName] = (...args: any[]) => {
emit.next(args[0]);
};
autoUpdater.addListener(eventName, listener);
return () => {
autoUpdater.removeListener(eventName, listener);
};
});
});
}

View File

@@ -21,10 +21,10 @@ import yargs from "yargs";
import { hideBin } from "yargs/helpers";
export type CLIOptions = {
note?: boolean | string;
notebook?: boolean | string;
reminder?: boolean | string;
hidden?: boolean;
note: boolean | string;
notebook: boolean | string;
reminder: boolean | string;
hidden: boolean;
};
export async function parseArguments(): Promise<CLIOptions> {
@@ -55,7 +55,7 @@ export async function parseArguments(): Promise<CLIOptions> {
"Open a note",
{ id: { string: true, description: "Id of the note" } },
(args) => {
result.note = args.id;
result.note = args.id || false;
}
)
.command(
@@ -63,7 +63,7 @@ export async function parseArguments(): Promise<CLIOptions> {
"Open a notebook",
{ id: { string: true, description: "Id of the notebook" } },
(args) => {
result.notebook = args.id;
result.notebook = args.id || false;
}
)
.command(
@@ -79,6 +79,6 @@ export async function parseArguments(): Promise<CLIOptions> {
);
})
.parse();
result.hidden = hidden;
result.hidden = hidden || false;
return result;
}

22
apps/desktop/src/index.ts Normal file
View File

@@ -0,0 +1,22 @@
/*
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/>.
*/
export * from "./constants";
export type { AppRouter } from "./api";
export { type UpdateInfo } from "builder-util-runtime";

View File

@@ -16,107 +16,104 @@ 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/>.
*/
/* global MAC_APP_STORE, RELEASE */
import "isomorphic-fetch";
import { app, BrowserWindow, nativeTheme, shell } from "electron";
import { isDevelopment } from "./utils";
import { registerProtocol, PROTOCOL_URL } from "./protocol";
import { configureAutoUpdater } from "./autoupdate";
import { getBackgroundColor, getTheme, setTheme } from "./config/theme";
import getZoomFactor from "./ipc/calls/getZoomFactor";
import { logger } from "./logger";
import { setupMenu } from "./menu";
import { WindowState } from "./config/window-state";
import { sendMessageToRenderer } from "./ipc/utils";
import { EVENTS } from "./events";
import "./ipc/index.js";
import getPrivacyMode from "./ipc/calls/getPrivacyMode";
import setPrivacyMode from "./ipc/actions/setPrivacyMode";
import { getIsSpellCheckerEnabled } from "./config/spellChecker";
import { getDesktopIntegration } from "./config/desktopIntegration";
import { AutoLaunch } from "./autolaunch";
import { setupJumplist } from "./jumplist";
import { setupTray } from "./tray";
import { parseArguments } from "./cli";
import { AssetManager } from "./asset-manager";
if (!RELEASE) {
require("electron-reloader")(module);
}
import { registerProtocol, PROTOCOL_URL } from "./utils/protocol";
import { configureAutoUpdater } from "./utils/autoupdater";
import { getBackgroundColor, getTheme, setTheme } from "./utils/theme";
import { setupMenu } from "./utils/menu";
import { WindowState } from "./utils/window-state";
import { AutoLaunch } from "./utils/autolaunch";
import { setupJumplist } from "./utils/jumplist";
import { setupTray } from "./utils/tray";
import { CLIOptions, parseArguments } from "./cli";
import { AssetManager } from "./utils/asset-manager";
import { createIPCHandler } from "electron-trpc/main";
import { router, api } from "./api";
import { config } from "./utils/config";
import path from "path";
import { bringToFront } from "./utils/bring-to-front";
// only run a single instance
if (!MAC_APP_STORE && !app.requestSingleInstanceLock()) {
console.log("Another instance is already running!");
app.exit();
}
if (process.platform == "win32" && process.env.PORTABLE_EXECUTABLE_DIR) {
console.log("Portable app: true");
const root = path.join(process.env.PORTABLE_EXECUTABLE_DIR, "Notesnook");
app.setPath("appData", path.join(root, "AppData"));
app.setPath("documents", path.join(root, "Documents"));
app.setPath("userData", path.join(root, "UserData"));
}
if (process.platform === "win32") {
app.setAppUserModelId(app.name);
}
var mainWindowState;
async function createWindow() {
await AssetManager.loadIcons();
const cliOptions = await parseArguments();
app.commandLine.appendSwitch("lang", "en-US");
mainWindowState = new WindowState({});
async function createWindow() {
const cliOptions = await parseArguments();
setTheme(getTheme());
const mainWindowState = new WindowState({});
const mainWindow = new BrowserWindow({
show: false,
show: !cliOptions.hidden,
x: mainWindowState.x,
y: mainWindowState.y,
width: mainWindowState.width,
height: mainWindowState.height,
darkTheme: getTheme() === "dark",
backgroundColor: getBackgroundColor(),
opacity: 0,
autoHideMenuBar: true,
icon: AssetManager.appIcon({
size: 512,
format: process.platform === "win32" ? "ico" : "png"
}),
webPreferences: {
zoomFactor: getZoomFactor(),
devTools: true, // isDev,
nodeIntegration: false, //true,
contextIsolation: true,
nativeWindowOpen: true,
spellcheck: getIsSpellCheckerEnabled(),
zoomFactor: config.zoomFactor,
nodeIntegration: true,
contextIsolation: false,
spellcheck: config.isSpellCheckerEnabled,
preload: __dirname + "/preload.js"
}
});
mainWindow.on("show", () => {
if (getPrivacyMode()) {
setPrivacyMode({ privacyMode: getPrivacyMode() });
}
});
mainWindowState.manage(mainWindow);
globalThis.window = mainWindow;
setupMenu();
setupJumplist();
setupDesktopIntegration(cliOptions.hidden);
mainWindowState.manage(mainWindow);
if (cliOptions.hidden && !config.desktopSettings.minimizeToSystemTray)
mainWindow.minimize();
await mainWindow.webContents.loadURL(`${createURL(cliOptions, "/")}`);
mainWindow.setOpacity(1);
if (config.privacyMode) {
await api.integration.setPrivacyMode({ enabled: config.privacyMode });
}
await AssetManager.loadIcons();
setupDesktopIntegration();
createIPCHandler({ router, windows: [mainWindow] });
mainWindow.webContents.session.setSpellCheckerDictionaryDownloadURL(
"http://dictionaries.notesnook.com/"
);
if (isDevelopment())
mainWindow.webContents.openDevTools({ mode: "right", activate: true });
try {
await mainWindow.loadURL(`${createURL(cliOptions)}`);
} catch (e) {
logger.error(e);
}
mainWindow.on("closed", () => {
mainWindow.once("closed", () => {
globalThis.window = null;
});
setupMenu();
setupJumplist();
if (isDevelopment())
mainWindow.webContents.openDevTools({ mode: "right", activate: true });
mainWindow.webContents.setWindowOpenHandler((details) => {
shell.openExternal(details.url);
return { action: "deny" };
@@ -125,42 +122,38 @@ async function createWindow() {
nativeTheme.on("updated", () => {
setupTray();
setupJumplist();
if (getTheme() === "system") {
sendMessageToRenderer(EVENTS.themeChanged, {
theme: nativeTheme.shouldUseDarkColors ? "dark" : "light"
});
}
});
}
app.commandLine.appendSwitch("lang", "en-US");
app.on("ready", async () => {
logger.info("App ready. Opening window.");
app.once("ready", async () => {
console.info("App ready. Opening window.");
registerProtocol();
if (!isDevelopment()) registerProtocol();
await createWindow();
configureAutoUpdater();
});
app.on("window-all-closed", () => {
app.once("window-all-closed", () => {
if (process.platform !== "darwin" || MAC_APP_STORE) {
app.quit();
}
});
app.on("second-instance", () => {
if (!globalThis.window) return;
bringToFront();
});
app.on("activate", () => {
if (globalThis.window === null) {
createWindow();
}
});
/**
* @param {import("./cli").CLIOptions} options
*/
function createURL(options) {
function createURL(options: CLIOptions, path = "/") {
const url = new URL(isDevelopment() ? "http://localhost:3000" : PROTOCOL_URL);
url.pathname = path;
if (options.note === true) url.hash = "/notes/create/1";
else if (options.notebook === true) url.hash = "/notebooks/create";
else if (options.reminder === true) url.hash = "/reminders/create";
@@ -172,8 +165,8 @@ function createURL(options) {
return url;
}
function setupDesktopIntegration(hidden) {
const desktopIntegration = getDesktopIntegration();
function setupDesktopIntegration() {
const desktopIntegration = config.desktopSettings;
if (
desktopIntegration.closeToSystemTray ||
@@ -182,49 +175,38 @@ function setupDesktopIntegration(hidden) {
setupTray();
}
globalThis.window.on("ready-to-show", () => {
if (!hidden) {
globalThis.window.show();
}
if (hidden && !desktopIntegration.minimizeToSystemTray) {
globalThis.window.show();
globalThis.window.minimize();
}
});
// when close to system tray is enabled, it becomes nigh impossible
// to "quit" the app. This is necessary in order to fix that.
if (desktopIntegration.closeToSystemTray) {
app.on("before-quit", () => app.exit(0));
}
globalThis.window.on("close", (e) => {
if (getDesktopIntegration().closeToSystemTray) {
globalThis.window?.once("close", (e) => {
if (config.desktopSettings.closeToSystemTray) {
e.preventDefault();
if (process.platform == "darwin") {
// on macOS window cannot be minimized/hidden if it is already fullscreen
// so we just close it.
if (globalThis.window.isFullScreen()) app.exit(0);
if (globalThis.window?.isFullScreen()) app.exit(0);
else app.hide();
} else {
globalThis.window.minimize();
globalThis.window.hide();
globalThis.window?.minimize();
globalThis.window?.hide();
}
}
});
globalThis.window.on("minimize", () => {
if (getDesktopIntegration().minimizeToSystemTray) {
globalThis.window?.on("minimize", () => {
if (config.desktopSettings.minimizeToSystemTray) {
if (process.platform == "darwin") {
app.hide();
} else {
globalThis.window.hide();
globalThis.window?.hide();
}
}
});
if (desktopIntegration.autoStart) {
AutoLaunch.enable(desktopIntegration.startMinimized);
AutoLaunch.enable(!!desktopIntegration.startMinimized);
}
}

View File

@@ -0,0 +1,51 @@
/*
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/>.
*/
/* eslint-disable no-var */
import { ELECTRON_TRPC_CHANNEL } from "electron-trpc/main";
import { type RendererGlobalElectronTRPC } from "electron-trpc/src/types";
import type { NNCrypto } from "@notesnook/crypto";
import { ipcRenderer } from "electron";
import { platform } from "os";
declare global {
var os: () => "mas" | ReturnType<typeof platform>;
var electronTRPC: RendererGlobalElectronTRPC;
var NativeNNCrypto: (new () => NNCrypto) | undefined;
}
process.once("loaded", async () => {
console.log("HELLO!");
const electronTRPC: RendererGlobalElectronTRPC = {
sendMessage: (operation) =>
ipcRenderer.send(ELECTRON_TRPC_CHANNEL, operation),
onMessage: (callback) =>
ipcRenderer.on(ELECTRON_TRPC_CHANNEL, (_event, args) => callback(args))
};
globalThis.electronTRPC = electronTRPC;
});
globalThis.NativeNNCrypto =
process.platform === "win32" &&
process.arch !== "x64" &&
process.arch !== "ia32"
? undefined
: require("@notesnook/crypto").NNCrypto;
globalThis.os = () => (MAC_APP_STORE ? "mas" : platform());

View File

@@ -19,10 +19,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { NativeImage, nativeImage } from "electron";
import path from "path";
import { isDevelopment } from "./utils";
import { isDevelopment } from "./index";
import { parse, ParsedImage } from "icojs";
import { readFileSync } from "fs";
import { getSystemTheme } from "./config/theme";
import { getSystemTheme } from "./theme";
import { readFile } from "fs/promises";
type Formats = "ico" | "png" | "icns";
type IconOptions<TFormat extends Formats> = {
@@ -30,8 +30,8 @@ type IconOptions<TFormat extends Formats> = {
format?: TFormat;
};
type IconNames = typeof icons[number];
type Prefixes = typeof prefixes[number];
type IconNames = (typeof icons)[number];
type Prefixes = (typeof prefixes)[number];
type FlexibleIcon<TFormat extends Formats> = TFormat extends "ico"
? string
@@ -70,7 +70,7 @@ export class AssetManager {
"icons",
`${icon}${prefix}.ico`
);
const icoBuffer = readFileSync(icoPath);
const icoBuffer = await readFile(icoPath);
const images = await parse(icoBuffer, "image/png");
ALL_ICONS.push({ id: icon, images, prefix });
}
@@ -80,10 +80,10 @@ export class AssetManager {
static appIcon(options: IconOptions<Formats>) {
const { size = 32, format = "png" } = options;
if (format === "ico") return path.join("assets", "icons", "app.ico");
if (format === "icns") return path.join("assets", "icons", "app.icns");
if (format === "ico") return "assets\\icons\\app.ico";
if (format === "icns") return "assets/icons/app.icns";
return path.join("assets", "icons", `${size}x${size}.png`);
return `assets/icons/${size}x${size}.png`;
}
static icon<TFormat extends Formats>(

View File

@@ -17,13 +17,20 @@ 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 { CancellationToken } from "builder-util-runtime";
import { autoUpdater } from "electron-updater";
import { EVENTS } from "../../events";
import { sendMessageToRenderer } from "../utils";
import { config } from "./config";
export default () => {
sendMessageToRenderer(EVENTS.updateDownloadProgress, { progress: 0 });
autoUpdater.cancellationToken = new CancellationToken();
autoUpdater.downloadUpdate(autoUpdater.cancellationToken);
};
async function configureAutoUpdater() {
autoUpdater.setFeedURL({
provider: "generic",
url: `https://notesnook.com/releases/${process.platform}/`,
useMultipleRangeRequest: false
});
autoUpdater.autoDownload = config.automaticUpdates;
autoUpdater.allowDowngrade = false;
autoUpdater.allowPrerelease = false;
autoUpdater.autoInstallOnAppQuit = true;
}
export { configureAutoUpdater };

View File

@@ -17,9 +17,9 @@ 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 { WindowState } from "../../config/window-state";
import { WindowState } from "./window-state";
export default () => {
export function bringToFront() {
if (!globalThis.window) return;
if (globalThis.window.isMinimized()) {
@@ -31,4 +31,4 @@ export default () => {
globalThis.window.focus();
globalThis.window.moveTop();
globalThis.window.webContents.focus();
};
}

View File

@@ -0,0 +1,56 @@
/*
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 { nativeTheme } from "electron";
import { JSONStorage } from "./json-storage";
import { z } from "zod";
export const DesktopIntegration = z.object({
autoStart: z.boolean().optional(),
startMinimized: z.boolean().optional(),
minimizeToSystemTray: z.boolean().optional(),
closeToSystemTray: z.boolean().optional()
});
export type DesktopIntegration = z.infer<typeof DesktopIntegration>;
export const config = {
desktopSettings: <DesktopIntegration>{
autoStart: false,
startMinimized: false,
minimizeToSystemTray: false,
closeToSystemTray: false
},
privacyMode: false,
isSpellCheckerEnabled: true,
zoomFactor: 1,
theme: nativeTheme.themeSource,
automaticUpdates: true
};
type ConfigKey = keyof typeof config;
for (const key in config) {
const defaultValue = config[<ConfigKey>key];
if (Object.hasOwn(config, key)) {
Object.defineProperty(config, key, {
get: () => JSONStorage.get(key, defaultValue),
set: (value) => JSONStorage.set(key, value)
});
}
}

View File

@@ -17,15 +17,15 @@ 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 { JSONStorage } from "../jsonstorage";
import { app } from "electron";
import { existsSync } from "fs";
function getPrivacyMode() {
let mode = JSONStorage.get("privacyMode");
return mode === undefined ? false : mode;
export function isDevelopment() {
return process.env.ELECTRON_IS_DEV
? Number.parseInt(process.env.ELECTRON_IS_DEV, 10) === 1
: !app.isPackaged;
}
function setPrivacyMode(mode) {
return JSONStorage.set("privacyMode", mode);
export function isFlatpak() {
return existsSync("/.flatpak-info");
}
export { setPrivacyMode, getPrivacyMode };

View File

@@ -19,9 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { app, Menu } from "electron";
import { AssetManager } from "./asset-manager";
import { EVENTS } from "./events";
import bringToFront from "./ipc/actions/bringToFront";
import { sendMessageToRenderer } from "./ipc/utils";
import { bringToFront } from "./bring-to-front";
import { bridge } from "../api/bridge";
export function setupJumplist() {
if (process.platform === "win32") {
@@ -76,7 +75,7 @@ function setDockMenuOnMacOs() {
type: "normal",
click: () => {
bringToFront();
sendMessageToRenderer(EVENTS.createItem, { itemType: "note" });
bridge.onCreateItem("note");
}
},
{
@@ -84,7 +83,7 @@ function setDockMenuOnMacOs() {
type: "normal",
click: () => {
bringToFront();
sendMessageToRenderer(EVENTS.createItem, { itemType: "notebook" });
bridge.onCreateItem("notebook");
}
},
{
@@ -92,7 +91,7 @@ function setDockMenuOnMacOs() {
type: "normal",
click: () => {
bringToFront();
sendMessageToRenderer(EVENTS.createItem, { itemType: "reminder" });
bridge.onCreateItem("reminder");
}
}
]);

View File

@@ -20,6 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { Menu, MenuItem, clipboard, shell } from "electron";
function setupMenu() {
if (!globalThis.window) return;
globalThis.window.webContents.on("context-menu", (_event, params) => {
const menu = new Menu();
@@ -29,7 +31,7 @@ function setupMenu() {
new MenuItem({
label: suggestion,
click: () =>
globalThis.window.webContents.replaceMisspelling(suggestion)
globalThis.window?.webContents.replaceMisspelling(suggestion)
})
);
}
@@ -40,7 +42,7 @@ function setupMenu() {
new MenuItem({
label: "Add to dictionary",
click: () =>
globalThis.window.webContents.session.addWordToSpellCheckerDictionary(
globalThis.window?.webContents.session.addWordToSpellCheckerDictionary(
params.misspelledWord
)
})
@@ -99,6 +101,26 @@ function setupMenu() {
})
);
if (params.linkURL?.length) {
menu.append(
new MenuItem({
label: "Copy link",
click() {
clipboard.writeText(params.linkURL);
}
})
);
menu.append(
new MenuItem({
label: "Copy link text",
click() {
clipboard.writeText(params.linkText);
}
})
);
}
if (params.selectionText.length) {
menu.append(
new MenuItem({

View File

@@ -0,0 +1,85 @@
/*
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 { protocol, net } from "electron";
import { isDevelopment } from "./index";
import { createReadStream } from "fs";
import { extname, normalize } from "path";
import { URL } from "url";
const BASE_PATH = isDevelopment() ? "../public" : "";
const HOSTNAME = `app.notesnook.com`;
const SCHEME = "https";
const extensionToMimeType: Record<string, string> = {
html: "text/html",
json: "application/json",
js: "application/javascript",
css: "text/css",
svg: "image/svg+xml",
png: "image/png",
jpg: "image/jpg",
ttf: "font/ttf",
woff: "font/woff",
woff2: "font/woff2"
};
function registerProtocol() {
protocol.handle(SCHEME, async (request) => {
const url = new URL(request.url);
if (shouldInterceptRequest(url)) {
console.info("Intercepting request:", request.url);
const loadIndex = !extname(url.pathname);
const filePath = normalize(
`${__dirname}${
loadIndex ? `${BASE_PATH}/index.html` : `${BASE_PATH}/${url.pathname}`
}`
);
if (!filePath) {
console.error("Local asset file not found at", filePath);
return new Response(undefined, {
status: 404,
statusText: "FILE_NOT_FOUND"
});
}
const fileExtension = extname(filePath).replace(".", "");
return new Response(createReadStream(filePath), {
headers: { "Content-Type": extensionToMimeType[fileExtension] }
});
} else {
try {
return net.fetch(request, {
bypassCustomProtocolHandlers: true
});
} catch (e) {
console.error(e);
}
return Response.error();
}
});
console.info(`${SCHEME} protocol inteception "successful"`);
}
const bypassedRoutes: string[] = [];
function shouldInterceptRequest(url: URL) {
const shouldIntercept = url.hostname === HOSTNAME;
return shouldIntercept && !bypassedRoutes.includes(url.pathname);
}
const PROTOCOL_URL = `${SCHEME}://${HOSTNAME}/`;
export { registerProtocol, PROTOCOL_URL };

View File

@@ -17,25 +17,17 @@ 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 { logger } from "../logger";
import { app } from "electron";
import { isAbsolute, join } from "path";
function sendMessageToRenderer(type, payload = {}) {
const message = { type, ...payload };
logger.info("Sending message to renderer", message);
if (globalThis.window)
globalThis.window.webContents.send("fromMain", message);
}
function resolvePath(_path) {
export function resolvePath(_path: string) {
if (isAbsolute(_path)) return _path;
return join(
..._path.split("/").map((segment) => {
let resolved = segment;
try {
resolved = app.getPath(resolved);
resolved = app.getPath(resolved as any);
} catch (e) {
// ignore
}
@@ -43,5 +35,3 @@ function resolvePath(_path) {
})
);
}
export { resolvePath, sendMessageToRenderer };

View File

@@ -17,19 +17,27 @@ 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 { JSONStorage } from "../jsonstorage";
import { nativeTheme } from "electron";
import { config } from "./config";
import { z } from "zod";
type Theme = typeof nativeTheme.themeSource;
function getTheme(): Theme {
return JSONStorage.get("theme", nativeTheme.themeSource);
export const Theme = z.union([
z.literal("system"),
z.literal("light"),
z.literal("dark")
]);
export type Theme = z.infer<typeof Theme>;
function getTheme() {
return config.theme;
}
function setTheme(theme: Theme) {
changeTheme(theme);
if (globalThis.window)
globalThis.window.setBackgroundColor(getBackgroundColor());
return JSONStorage.set("theme", theme);
config.theme = theme;
}
function getBackgroundColor() {

View File

@@ -19,10 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { app, Menu, Tray } from "electron";
import { AssetManager } from "./asset-manager";
import { EVENTS } from "./events";
import bringToFront from "./ipc/actions/bringToFront";
import { sendMessageToRenderer } from "./ipc/utils";
import { isFlatpak } from "./utils";
import { isFlatpak } from "./index";
import { bringToFront } from "./bring-to-front";
import { bridge } from "../api/bridge";
let tray: Tray | undefined = undefined;
export function destroyTray() {
@@ -59,7 +58,7 @@ export function setupTray() {
: AssetManager.icon("note-add", { size: trayIconSize }),
click: () => {
bringToFront();
sendMessageToRenderer(EVENTS.createItem, { itemType: "note" });
bridge.onCreateItem("note");
}
},
{
@@ -70,7 +69,7 @@ export function setupTray() {
: AssetManager.icon("notebook-add", { size: trayIconSize }),
click: () => {
bringToFront();
sendMessageToRenderer(EVENTS.createItem, { itemType: "notebook" });
bridge.onCreateItem("notebook");
}
},
{ type: "separator" },

View File

@@ -17,7 +17,7 @@ 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 { JSONStorage } from "../jsonstorage";
import { JSONStorage } from "./json-storage";
import { screen as _screen, BrowserWindow } from "electron";
const screen = _screen;

View File

@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig",
"compilerOptions": {
"outDir": "./dist/",
"lib": ["ESNext"]
},
"include": ["src", "global.d.ts"]
}

View File

@@ -17,15 +17,6 @@ jobs:
with:
persist-credentials: false
- name: Setup npmrc
run: |
echo "registry=https://npm.pkg.github.com" > .npmrc
echo "@streetwriters:registry=https://npm.pkg.github.com" >> .npmrc
echo "//npm.pkg.github.com/:_authToken=${{secrets.PACKAGES_TOKEN}}" >> .npmrc
- name: Setup yarnrc
run: echo "\"@streetwriters:registry\" \"https://npm.pkg.github.com\"" > .yarnrc
- uses: actions/setup-node@master
with:
node-version: "16"

View File

@@ -17,15 +17,6 @@ jobs:
with:
persist-credentials: false
- name: Setup npmrc
run: |
echo "registry=https://npm.pkg.github.com" > .npmrc
echo "@streetwriters:registry=https://npm.pkg.github.com" >> .npmrc
echo "//npm.pkg.github.com/:_authToken=${{secrets.PACKAGES_TOKEN}}" >> .npmrc
- name: Setup yarnrc
run: echo "\"@streetwriters:registry\" \"https://npm.pkg.github.com\"" > .yarnrc
- uses: actions/setup-node@master
with:
node-version: "16"

View File

@@ -5,7 +5,6 @@ artifacts/
.DS_Store
native/android/app/src/main/assets/
*Issues.md
build_cache/
#
@@ -14,7 +13,9 @@ build_cache/
.yarnrc.yml
.yarn
*.log
.cxx/
*.keystore
!debug.keystore
# Xcode
#

View File

@@ -25,4 +25,4 @@
"request": "attach"
}
]
}
}

View File

@@ -3,6 +3,7 @@
*/
import "react-native";
import { it } from "@jest/globals";
// Note: test renderer must be required after react-native.
import renderer from "react-test-renderer";
import Heading from "../app/components/ui/typography/heading";

View File

@@ -16,34 +16,38 @@ 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 "react-native-gesture-handler";
import "@azure/core-asynciterator-polyfill";
import SettingsService from "./services/settings";
import {
THEME_COMPATIBILITY_VERSION,
useThemeEngineStore
} from "@notesnook/theme";
import React, { useEffect } from "react";
import { View } from "react-native";
import "react-native-gesture-handler";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { SafeAreaProvider } from "react-native-safe-area-context";
import AppLockedOverlay from "./components/app-lock-overlay";
import { withErrorBoundry } from "./components/exception-handler";
import GlobalSafeAreaProvider from "./components/globalsafearea";
import Launcher from "./components/launcher";
import { useAppEvents } from "./hooks/use-app-events";
import { ApplicationHolder } from "./navigation";
import Notifications from "./services/notifications";
import SettingsService from "./services/settings";
import { TipManager } from "./services/tip-manager";
import { useThemeStore } from "./stores/use-theme-store";
import { useUserStore } from "./stores/use-user-store";
import { View } from "react-native";
import { useState } from "react";
import { themeTrpcClient } from "./screens/settings/theme-selector";
SettingsService.init();
SettingsService.checkOrientation();
const App = () => {
useAppEvents();
const [init, setInit] = useState(false);
const init = useAppEvents();
useEffect(() => {
let { appLockMode } = SettingsService.get();
if (appLockMode && appLockMode !== "none") {
useUserStore.getState().setVerifyUser(true);
useUserStore.getState().lockApp(true);
}
//BackgroundSync.start();
setInit(true);
globalThis["IS_MAIN_APP_RUNNING"] = true;
init();
setTimeout(async () => {
SettingsService.onFirstLaunch();
await Notifications.get();
@@ -52,7 +56,10 @@ const App = () => {
}
TipManager.init();
}, 100);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
return (
<View
style={{
@@ -81,10 +88,51 @@ const App = () => {
}}
>
<ApplicationHolder />
{init && <Launcher />}
</GestureHandlerRootView>
<AppLockedOverlay />
</View>
);
};
export default withErrorBoundry(App, "App");
export const withTheme = (Element) => {
return function AppWithThemeProvider() {
const [colorScheme, darkTheme, lightTheme] = useThemeStore((state) => [
state.colorScheme,
state.darkTheme,
state.lightTheme
]);
useEffect(() => {
setTimeout(() => {
const currentTheme = colorScheme === "dark" ? darkTheme : lightTheme;
if (!currentTheme) return;
themeTrpcClient.updateTheme
.query({
version: currentTheme.version,
compatibilityVersion: THEME_COMPATIBILITY_VERSION,
id: currentTheme.id
})
.then((theme) => {
if (theme) {
console.log(theme.version, "theme updated");
theme.colorScheme === "dark"
? useThemeStore.getState().setDarkTheme(theme)
: useThemeStore.getState().setLightTheme(theme);
}
})
.catch(console.log);
}, 1000);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
useEffect(() => {
useThemeEngineStore
.getState()
.setTheme(colorScheme === "dark" ? darkTheme : lightTheme);
}, [colorScheme, darkTheme, lightTheme]);
return <Element />;
};
};
export default withTheme(withErrorBoundry(App, "App"));

View File

@@ -126,6 +126,18 @@ export async function decrypt(password, data) {
return await Sodium.decrypt(password, _data);
}
export async function decryptMulti(password, data) {
if (!password.password && !password.key) return undefined;
if (password.password && password.password === "" && !password.key)
return undefined;
data = data.map((d) => {
d.output = "plain";
return d;
});
return await Sodium.decryptMulti(password, data);
}
export function parseAlgorithm(alg) {
if (!alg) return {};
const [enc, kdf, compressed, compressionAlg, base64variant] = alg.split("-");
@@ -154,3 +166,24 @@ export async function encrypt(password, data) {
alg: getAlgorithm(7)
};
}
export async function encryptMulti(password, data) {
if (!password.password && !password.key) return undefined;
if (password.password && password.password === "" && !password.key)
return undefined;
let results = await Sodium.encryptMulti(
password,
data.map((item) => ({
type: "plain",
data: item
}))
);
return !results
? []
: results.map((result) => ({
...result,
alg: getAlgorithm(7)
}));
}

View File

@@ -16,9 +16,8 @@ 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 Database from "@notesnook/core/api/index";
import { initalize, logger as dbLogger } from "@notesnook/core/logger";
import { database } from "@notesnook/common";
import { initalize, logger as dbLogger } from "@notesnook/core/dist/logger";
import { Platform } from "react-native";
import { MMKVLoader } from "react-native-mmkv-storage";
import filesystem from "../filesystem";
@@ -30,23 +29,8 @@ import * as Gzip from "react-native-gzip";
const LoggerStorage = new MMKVLoader()
.withInstanceID("notesnook_logs")
.initialize();
initalize(new KV(LoggerStorage), true);
export const DatabaseLogger = dbLogger;
/**
* @type {import("@notesnook/core/api/index").default}
*/
export var db = new Database(
Storage,
Platform.OS === "ios" ? EventSource : AndroidEventSource,
filesystem,
{
compress: Gzip.deflate,
decompress: Gzip.inflate
}
);
db.host(
database.host(
__DEV__
? {
API_HOST: "https://api.notesnook.com",
@@ -54,11 +38,11 @@ db.host(
SSE_HOST: "https://events.streetwriters.co",
SUBSCRIPTIONS_HOST: "https://subscriptions.streetwriters.co",
ISSUES_HOST: "https://issues.streetwriters.co"
// API_HOST: "http://192.168.8.101:5264",
// AUTH_HOST: "http://192.168.8.101:8264",
// SSE_HOST: "http://192.168.8.101:7264",
// SUBSCRIPTIONS_HOST: "http://192.168.8.101:9264",
// ISSUES_HOST: "http://192.168.8.101:2624"
// API_HOST: "http://192.168.43.108:5264",
// AUTH_HOST: "http://192.168.43.108:8264",
// SSE_HOST: "http://192.168.43.108:7264",
// SUBSCRIPTIONS_HOST: "http://192.168.43.108:9264",
// ISSUES_HOST: "http://192.168.43.108:2624"
}
: {
API_HOST: "https://api.notesnook.com",
@@ -68,3 +52,18 @@ db.host(
ISSUES_HOST: "https://issues.streetwriters.co"
}
);
database.setup(
Storage,
Platform.OS === "ios" ? EventSource : AndroidEventSource,
filesystem,
{
compress: Gzip.deflate,
decompress: Gzip.inflate
}
);
initalize(new KV(LoggerStorage));
export const db = database;
export const DatabaseLogger = dbLogger;

View File

@@ -18,9 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Platform } from "react-native";
import MMKVStorage, { ProcessingModes } from "react-native-mmkv-storage";
import { ProcessingModes, MMKVLoader } from "react-native-mmkv-storage";
export const MMKV = new MMKVStorage.Loader()
export const MMKV = new MMKVLoader()
.setProcessingMode(
Platform.OS === "ios"
? ProcessingModes.MULTI_PROCESS

View File

@@ -27,11 +27,16 @@ import {
getCryptoKey,
getRandomBytes,
hash,
removeCryptoKey
removeCryptoKey,
decryptMulti,
encryptMulti
} from "./encryption";
import { MMKV } from "./mmkv";
export class KV {
/**
* @type {typeof MMKV}
*/
storage = null;
constructor(storage) {
this.storage = storage;
@@ -53,6 +58,7 @@ export class KV {
key,
typeof data === "string" ? data : JSON.stringify(data)
);
return true;
}
@@ -60,27 +66,32 @@ export class KV {
if (keys.length <= 0) {
return [];
} else {
let data = await this.storage.getMultipleItemsAsync(keys.slice());
return data.map(([key, value]) => {
let obj;
try {
obj = JSON.parse(value);
} catch (e) {
obj = value;
}
return [key, obj];
});
try {
let data = await this.storage.getMultipleItemsAsync(
keys.slice(),
"string"
);
return data.map(([key, value]) => {
let obj;
try {
obj = JSON.parse(value);
} catch (e) {
obj = value;
}
return [key, obj];
});
} catch (e) {
console.log(e);
}
}
}
async remove(key) {
return await this.storage.removeItem(key);
return this.storage.removeItem(key);
}
async clear() {
return await this.storage.clearStore();
return this.storage.clearStore();
}
async getAllKeys() {
@@ -96,6 +107,10 @@ export class KV {
);
return keys;
}
async writeMulti(items) {
return this.storage.setMultipleItemsAsync(items, "object");
}
}
const DefaultStorage = new KV(MMKV);
@@ -129,8 +144,10 @@ export default {
remove: (key) => DefaultStorage.remove(key),
clear: () => DefaultStorage.clear(),
getAllKeys: () => DefaultStorage.getAllKeys(),
writeMulti: (items) => DefaultStorage.writeMulti(items),
encrypt,
decrypt,
decryptMulti,
getRandomBytes,
checkAndCreateDir,
requestPermission,
@@ -138,5 +155,6 @@ export default {
getCryptoKey,
removeCryptoKey,
hash,
generateCryptoKey
generateCryptoKey,
encryptMulti
};

View File

@@ -22,7 +22,7 @@ import {
getFileNameWithExtension,
isImage,
isDocument
} from "@notesnook/core/utils/filename";
} from "@notesnook/core/dist/utils/filename";
import React from "react";
import { Platform } from "react-native";
import * as ScopedStorage from "react-native-scoped-storage";

View File

@@ -17,7 +17,7 @@ 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 hosts from "@notesnook/core/utils/constants";
import hosts from "@notesnook/core/dist/utils/constants";
import NetInfo from "@react-native-community/netinfo";
import RNFetchBlob from "react-native-blob-util";
import { ToastEvent } from "../../services/event-manager";
@@ -46,6 +46,7 @@ export async function downloadFile(filename, data, cancelToken) {
if (!downloadUrl) throw new Error("Unable to resolve download url");
let totalSize = 0;
console.log("Download starting");
let request = RNFetchBlob.config({
path: path,
IOSBackgroundTask: true

View File

@@ -19,9 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import RNFetchBlob from "react-native-blob-util";
import { useAttachmentStore } from "../../stores/use-attachment-store";
import { db } from "../database";
import { DatabaseLogger, db } from "../database";
import { cacheDir } from "./utils";
import { isImage, isDocument } from "@notesnook/core/utils/filename";
import { isImage, isDocument } from "@notesnook/core/dist/utils/filename";
import { Platform } from "react-native";
import { IOS_APPGROUPID } from "../../utils/constants";
@@ -29,7 +29,8 @@ export async function uploadFile(filename, data, cancelToken) {
if (!data) return false;
let { url, headers } = data;
console.log("uploading file: ", filename, headers);
DatabaseLogger.info(`Preparing to upload file: ${filename}`);
try {
let res = await fetch(url, {
method: "PUT",
@@ -37,7 +38,7 @@ export async function uploadFile(filename, data, cancelToken) {
});
if (!res.ok) throw new Error(`${res.status}: Unable to resolve upload url`);
const uploadUrl = await res.text();
if (!uploadUrl) throw new Error("Unable to resolve upload url");
if (!uploadUrl) throw new Error("Unable to resolve attachment upload url");
let uploadFilePath = `${cacheDir}/${filename}`;
const iosAppGroup =
@@ -49,6 +50,8 @@ export async function uploadFile(filename, data, cancelToken) {
if (!exists && Platform.OS === "ios") {
uploadFilePath = appGroupPath;
}
DatabaseLogger.info(`Starting upload: ${filename}`);
let request = RNFetchBlob.config({
IOSBackgroundTask: !globalThis["IS_SHARE_EXTENSION"]
})
@@ -64,8 +67,11 @@ export async function uploadFile(filename, data, cancelToken) {
useAttachmentStore
.getState()
.setProgress(sent, total, filename, 0, "upload");
console.log("uploading: ", sent, total);
DatabaseLogger.info(
`File upload progress: ${filename}, ${sent}/${total}`
);
});
cancelToken.cancel = request.cancel;
let response = await request;
@@ -74,6 +80,9 @@ export async function uploadFile(filename, data, cancelToken) {
let result = status >= 200 && status < 300 && text.length === 0;
useAttachmentStore.getState().remove(filename);
if (result) {
DatabaseLogger.info(
`File upload status: ${filename}, ${status}, ${text}`
);
let attachment = db.attachments.attachment(filename);
if (!attachment) return result;
if (
@@ -82,12 +91,20 @@ export async function uploadFile(filename, data, cancelToken) {
) {
RNFetchBlob.fs.unlink(`${cacheDir}/${filename}`).catch(console.log);
}
} else {
const fileInfo = await RNFetchBlob.fs.stat(uploadFilePath);
throw new Error(
`${status}, ${text}, name: ${fileInfo.filename}, length: ${
fileInfo.size
}, info: ${JSON.stringify(response.info())}`
);
}
return result;
} catch (e) {
useAttachmentStore.getState().remove(filename);
console.log("upload file: ", e, url, headers);
DatabaseLogger.info(`File upload error: ${filename}, ${e}`);
DatabaseLogger.error(e);
return false;
}
}

View File

@@ -21,18 +21,18 @@ import React from "react";
import { FlatList, View } from "react-native";
import { useSelectionStore } from "../../stores/use-selection-store";
import { useMessageStore } from "../../stores/use-message-store";
import { useThemeStore } from "../../stores/use-theme-store";
import { useThemeColors } from "@notesnook/theme";
import { allowedOnPlatform, renderItem } from "./functions";
export const Announcement = ({ color }) => {
const colors = useThemeStore((state) => state.colors);
const { colors } = useThemeColors();
const announcements = useMessageStore((state) => state.announcements);
let announcement = announcements.length > 0 ? announcements[0] : null;
const selectionMode = useSelectionStore((state) => state.selectionMode);
return !announcement || selectionMode ? null : (
<View
style={{
backgroundColor: colors.bg,
backgroundColor: colors.primary.background,
width: "100%",
paddingHorizontal: 12,
paddingTop: 12,
@@ -44,28 +44,26 @@ export const Announcement = ({ color }) => {
width: "100%",
borderRadius: 10,
overflow: "hidden",
backgroundColor: colors.nav,
backgroundColor: colors.secondary.background,
paddingBottom: 12
}}
>
<View>
<FlatList
style={{
width: "100%",
marginTop: 12
}}
data={announcement?.body.filter((item) =>
allowedOnPlatform(item.platforms)
)}
renderItem={({ item, index }) =>
<View
style={{
width: "100%",
marginTop: 12
}}
>
{announcement?.body
.filter((item) => allowedOnPlatform(item.platforms))
.map((item, index) =>
renderItem({
item: item,
index: index,
color: colors[color],
inline: true
})
}
/>
)}
</View>
</View>
</View>

View File

@@ -22,7 +22,7 @@ import { Linking, View } from "react-native";
//import SettingsBackupAndRestore from '../../screens/settings/backup-restore';
import { eSendEvent, presentSheet } from "../../services/event-manager";
import Sync from "../../services/sync";
import { useThemeStore } from "../../stores/use-theme-store";
import { useThemeColors } from "@notesnook/theme";
import { eCloseAnnouncementDialog, eCloseSheet } from "../../utils/events";
import { SIZE } from "../../utils/size";
import { sleep } from "../../utils/time";
@@ -33,7 +33,7 @@ import { Button } from "../ui/button";
import { allowedOnPlatform, getStyle } from "./functions";
export const Cta = ({ actions, style = {}, color, inline }) => {
const colors = useThemeStore((state) => state.colors);
const { colors } = useThemeColors();
let buttons =
actions.filter((item) => allowedOnPlatform(item.platforms)) || [];
@@ -92,8 +92,7 @@ export const Cta = ({ actions, style = {}, color, inline }) => {
style={{
height: 30,
alignSelf: "flex-start",
paddingHorizontal: 0,
marginTop: -6
paddingHorizontal: 0
}}
/>
))}
@@ -111,7 +110,6 @@ export const Cta = ({ actions, style = {}, color, inline }) => {
style={{
alignSelf: "flex-start",
paddingHorizontal: 0,
marginTop: -6,
marginLeft: 12
}}
textStyle={{
@@ -129,9 +127,9 @@ export const Cta = ({ actions, style = {}, color, inline }) => {
title={item.title}
fontSize={SIZE.md}
buttonType={{
color: color ? color : colors.accent,
text: colors.light,
selected: color ? color : colors.accent,
color: color ? color : colors.primary.accent,
text: colors.static.white,
selected: color ? color : colors.primary.accent,
opacity: 1
}}
onPress={() => onPress(item)}

View File

@@ -25,7 +25,7 @@ import {
eUnSubscribeEvent
} from "../../services/event-manager";
import { useMessageStore } from "../../stores/use-message-store";
import { useThemeStore } from "../../stores/use-theme-store";
import { useThemeColors } from "@notesnook/theme";
import {
eCloseAnnouncementDialog,
eOpenAnnouncementDialog
@@ -35,7 +35,7 @@ import { allowedOnPlatform, renderItem } from "./functions";
import { useCallback } from "react";
export const AnnouncementDialog = () => {
const colors = useThemeStore((state) => state.colors);
const { colors } = useThemeColors();
const [visible, setVisible] = useState(false);
const [info, setInfo] = useState(null);
const remove = useMessageStore((state) => state.remove);
@@ -73,7 +73,7 @@ export const AnnouncementDialog = () => {
<View
style={{
width: DDS.isTab ? 600 : "100%",
backgroundColor: colors.bg,
backgroundColor: colors.primary.background,
maxHeight: DDS.isTab ? "90%" : "100%",
borderRadius: DDS.isTab ? 10 : 0,
overflow: "hidden",

View File

@@ -0,0 +1,215 @@
/*
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 React, { useCallback, useEffect, useRef } from "react";
import { Platform, View } from "react-native";
import { enabled } from "react-native-privacy-snapshot";
import { db } from "../../common/database";
import { useAppState } from "../../hooks/use-app-state";
import BiometricService from "../../services/biometrics";
import { useSettingStore } from "../../stores/use-setting-store";
import { useThemeColors } from "@notesnook/theme";
import { useUserStore } from "../../stores/use-user-store";
import { NotesnookModule } from "../../utils/notesnook-module";
import { SIZE } from "../../utils/size";
import { Button } from "../ui/button";
import { IconButton } from "../ui/icon-button";
import Input from "../ui/input";
import Seperator from "../ui/seperator";
import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph";
const AppLockedOverlay = () => {
const { colors } = useThemeColors();
const user = useUserStore((state) => state.user);
const appLocked = useUserStore((state) => state.appLocked);
const lockApp = useUserStore((state) => state.lockApp);
const deviceMode = useSettingStore((state) => state.deviceMode);
const passwordInputRef = useRef();
const password = useRef();
const appState = useAppState();
const biometricUnlockAwaitingUserInput = useRef(false);
const onUnlockAppRequested = useCallback(async () => {
if (!(await BiometricService.isBiometryAvailable())) return;
if (Platform.OS === "android") {
const activityName = await NotesnookModule.getActivityName();
if (activityName !== "MainActivity") return;
}
useSettingStore.getState().setRequestBiometrics(true);
let unlocked = await BiometricService.validateUser(
"Unlock to access your notes",
""
);
if (unlocked) {
lockApp(false);
enabled(false);
password.current = null;
}
setTimeout(() => {
biometricUnlockAwaitingUserInput.current = false;
useSettingStore.getState().setRequestBiometrics(false);
}, 1);
}, [lockApp]);
const onSubmit = async () => {
if (!password.current) return;
try {
let unlocked = await db.user.verifyPassword(password.current);
if (unlocked) {
lockApp(false);
enabled(false);
password.current = null;
}
} catch (e) {
console.error(e);
}
};
useEffect(() => {
if (
biometricUnlockAwaitingUserInput.current ||
useUserStore.getState().disableAppLockRequests
)
return;
if (appLocked && appState === "active") {
biometricUnlockAwaitingUserInput.current = true;
onUnlockAppRequested();
}
}, [appState, onUnlockAppRequested, appLocked]);
return (
appLocked && (
<View
style={{
backgroundColor: colors.primary.background,
width: "100%",
height: "100%",
position: "absolute",
zIndex: 999,
justifyContent: "center"
}}
>
<View
style={{
flex: 1,
justifyContent: "center",
width:
deviceMode !== "mobile"
? "50%"
: Platform.OS == "ios"
? "95%"
: "100%",
paddingHorizontal: 12,
marginBottom: 30,
marginTop: 15,
alignSelf: "center"
}}
>
<IconButton
name="fingerprint"
size={100}
customStyle={{
width: 100,
height: 100,
marginBottom: 20,
marginTop: user ? 0 : 50
}}
onPress={onUnlockAppRequested}
color={colors.primary.border}
/>
<Heading
color={colors.primary.heading}
style={{
alignSelf: "center",
textAlign: "center"
}}
>
Unlock your notes
</Heading>
<Paragraph
style={{
alignSelf: "center",
textAlign: "center",
maxWidth: "90%"
}}
>
{"Please verify it's you"}
</Paragraph>
<Seperator />
<View
style={{
width: "100%",
padding: 12,
backgroundColor: colors.primary.background
}}
>
{user ? (
<>
<Input
fwdRef={passwordInputRef}
secureTextEntry
placeholder="Enter account password"
onChangeText={(v) => (password.current = v)}
onSubmit={onSubmit}
/>
</>
) : null}
<View
style={{
marginTop: user ? 25 : 25
}}
>
{user ? (
<>
<Button
title="Continue"
type="accent"
onPress={onSubmit}
width={250}
height={45}
style={{
borderRadius: 150,
marginBottom: 10
}}
fontSize={SIZE.md}
/>
</>
) : null}
<Button
title="Unlock with Biometrics"
width={250}
onPress={onUnlockAppRequested}
icon={"fingerprint"}
type="transparent"
/>
</View>
</View>
</View>
</View>
)
);
};
export default AppLockedOverlay;

Some files were not shown because too many files have changed in this diff Show More