# Generate UI lib
+nx g @nx/angular:lib ui
+
+# Add a component
+nx g @nx/angular:component ui/src/lib/button
+
+
+
+
+ View interactive project graph
+
+
nx graph
+
+
+
+
+ Run affected commands
+
+
# see what's been affected by changes
+nx affected:graph
+
+# run tests for current changes
+nx affected:test
+
+# run e2e tests for current changes
+nx affected:e2e
+
+
+
+
+ Carefully crafted with
+
+
+
+
+ `;
+ }
+}
+customElements.define('triliumnext-root', AppElement);
diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/AI/AI Provider Information/OpenAI.html b/apps/client/src-example/assets/.gitkeep
similarity index 100%
rename from src/public/app/doc_notes/en/User Guide/User Guide/AI/AI Provider Information/OpenAI.html
rename to apps/client/src-example/assets/.gitkeep
diff --git a/apps/client/src-example/favicon.ico b/apps/client/src-example/favicon.ico
new file mode 100644
index 0000000000..317ebcb233
Binary files /dev/null and b/apps/client/src-example/favicon.ico differ
diff --git a/apps/client/src-example/index.html b/apps/client/src-example/index.html
new file mode 100644
index 0000000000..e206d48372
--- /dev/null
+++ b/apps/client/src-example/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+ Client
+
+
+
+
+
+
+
+
+
diff --git a/apps/client/src-example/main.ts b/apps/client/src-example/main.ts
new file mode 100644
index 0000000000..fdb879ded5
--- /dev/null
+++ b/apps/client/src-example/main.ts
@@ -0,0 +1 @@
+import './app/app.element';
diff --git a/apps/client/src-example/styles.css b/apps/client/src-example/styles.css
new file mode 100644
index 0000000000..90d4ee0072
--- /dev/null
+++ b/apps/client/src-example/styles.css
@@ -0,0 +1 @@
+/* You can add global styles to this file, and also import other style files */
diff --git a/apps/client/src/asset_path.ts b/apps/client/src/asset_path.ts
new file mode 100644
index 0000000000..b876e828f4
--- /dev/null
+++ b/apps/client/src/asset_path.ts
@@ -0,0 +1,3 @@
+import packageJson from "../package.json" with { type: "json" };
+
+export default `assets/v${packageJson.version}`;
diff --git a/src/public/icon.png b/apps/client/src/assets/icon.png
similarity index 100%
rename from src/public/icon.png
rename to apps/client/src/assets/icon.png
diff --git a/src/public/manifest.webmanifest b/apps/client/src/assets/manifest.webmanifest
similarity index 100%
rename from src/public/manifest.webmanifest
rename to apps/client/src/assets/manifest.webmanifest
diff --git a/src/public/robots.txt b/apps/client/src/assets/robots.txt
similarity index 100%
rename from src/public/robots.txt
rename to apps/client/src/assets/robots.txt
diff --git a/src/public/app/components/app_context.ts b/apps/client/src/components/app_context.ts
similarity index 100%
rename from src/public/app/components/app_context.ts
rename to apps/client/src/components/app_context.ts
diff --git a/src/public/app/components/component.ts b/apps/client/src/components/component.ts
similarity index 100%
rename from src/public/app/components/component.ts
rename to apps/client/src/components/component.ts
diff --git a/src/public/app/components/entrypoints.ts b/apps/client/src/components/entrypoints.ts
similarity index 100%
rename from src/public/app/components/entrypoints.ts
rename to apps/client/src/components/entrypoints.ts
diff --git a/src/public/app/components/events.ts b/apps/client/src/components/events.ts
similarity index 100%
rename from src/public/app/components/events.ts
rename to apps/client/src/components/events.ts
diff --git a/src/public/app/components/main_tree_executors.ts b/apps/client/src/components/main_tree_executors.ts
similarity index 100%
rename from src/public/app/components/main_tree_executors.ts
rename to apps/client/src/components/main_tree_executors.ts
diff --git a/src/public/app/components/mobile_screen_switcher.ts b/apps/client/src/components/mobile_screen_switcher.ts
similarity index 100%
rename from src/public/app/components/mobile_screen_switcher.ts
rename to apps/client/src/components/mobile_screen_switcher.ts
diff --git a/src/public/app/components/note_context.ts b/apps/client/src/components/note_context.ts
similarity index 100%
rename from src/public/app/components/note_context.ts
rename to apps/client/src/components/note_context.ts
diff --git a/src/public/app/components/root_command_executor.ts b/apps/client/src/components/root_command_executor.ts
similarity index 100%
rename from src/public/app/components/root_command_executor.ts
rename to apps/client/src/components/root_command_executor.ts
diff --git a/src/public/app/components/shortcut_component.ts b/apps/client/src/components/shortcut_component.ts
similarity index 100%
rename from src/public/app/components/shortcut_component.ts
rename to apps/client/src/components/shortcut_component.ts
diff --git a/src/public/app/components/tab_manager.ts b/apps/client/src/components/tab_manager.ts
similarity index 100%
rename from src/public/app/components/tab_manager.ts
rename to apps/client/src/components/tab_manager.ts
diff --git a/src/public/app/components/touch_bar.ts b/apps/client/src/components/touch_bar.ts
similarity index 100%
rename from src/public/app/components/touch_bar.ts
rename to apps/client/src/components/touch_bar.ts
diff --git a/src/public/app/components/zoom.ts b/apps/client/src/components/zoom.ts
similarity index 100%
rename from src/public/app/components/zoom.ts
rename to apps/client/src/components/zoom.ts
diff --git a/src/public/app/desktop.ts b/apps/client/src/desktop.ts
similarity index 99%
rename from src/public/app/desktop.ts
rename to apps/client/src/desktop.ts
index 0251324950..51c69aa704 100644
--- a/src/public/app/desktop.ts
+++ b/apps/client/src/desktop.ts
@@ -10,7 +10,7 @@ import { t } from "./services/i18n.js";
import options from "./services/options.js";
import type ElectronRemote from "@electron/remote";
import type Electron from "electron";
-import "../stylesheets/bootstrap.scss";
+import "./stylesheets/bootstrap.scss";
await appContext.earlyInit();
diff --git a/src/public/app/entities/fattachment.ts b/apps/client/src/entities/fattachment.ts
similarity index 100%
rename from src/public/app/entities/fattachment.ts
rename to apps/client/src/entities/fattachment.ts
diff --git a/src/public/app/entities/fattribute.ts b/apps/client/src/entities/fattribute.ts
similarity index 100%
rename from src/public/app/entities/fattribute.ts
rename to apps/client/src/entities/fattribute.ts
diff --git a/src/public/app/entities/fblob.ts b/apps/client/src/entities/fblob.ts
similarity index 100%
rename from src/public/app/entities/fblob.ts
rename to apps/client/src/entities/fblob.ts
diff --git a/src/public/app/entities/fbranch.ts b/apps/client/src/entities/fbranch.ts
similarity index 100%
rename from src/public/app/entities/fbranch.ts
rename to apps/client/src/entities/fbranch.ts
diff --git a/src/public/app/entities/fnote.ts b/apps/client/src/entities/fnote.ts
similarity index 100%
rename from src/public/app/entities/fnote.ts
rename to apps/client/src/entities/fnote.ts
diff --git a/src/public/fonts/Inter/Inter-Italic-VariableFont_opsz,wght.ttf b/apps/client/src/fonts/Inter/Inter-Italic-VariableFont_opsz,wght.ttf
similarity index 100%
rename from src/public/fonts/Inter/Inter-Italic-VariableFont_opsz,wght.ttf
rename to apps/client/src/fonts/Inter/Inter-Italic-VariableFont_opsz,wght.ttf
diff --git a/src/public/fonts/Inter/Inter-VariableFont_opsz,wght.ttf b/apps/client/src/fonts/Inter/Inter-VariableFont_opsz,wght.ttf
similarity index 100%
rename from src/public/fonts/Inter/Inter-VariableFont_opsz,wght.ttf
rename to apps/client/src/fonts/Inter/Inter-VariableFont_opsz,wght.ttf
diff --git a/src/public/fonts/Inter/OFL.txt b/apps/client/src/fonts/Inter/OFL.txt
similarity index 97%
rename from src/public/fonts/Inter/OFL.txt
rename to apps/client/src/fonts/Inter/OFL.txt
index d05ec4b38c..63db4fa70c 100644
--- a/src/public/fonts/Inter/OFL.txt
+++ b/apps/client/src/fonts/Inter/OFL.txt
@@ -1,93 +1,93 @@
-Copyright 2020 The Inter Project Authors (https://github.com/rsms/inter)
-
-This Font Software is licensed under the SIL Open Font License, Version 1.1.
-This license is copied below, and is also available with a FAQ at:
-https://openfontlicense.org
-
-
------------------------------------------------------------
-SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
------------------------------------------------------------
-
-PREAMBLE
-The goals of the Open Font License (OFL) are to stimulate worldwide
-development of collaborative font projects, to support the font creation
-efforts of academic and linguistic communities, and to provide a free and
-open framework in which fonts may be shared and improved in partnership
-with others.
-
-The OFL allows the licensed fonts to be used, studied, modified and
-redistributed freely as long as they are not sold by themselves. The
-fonts, including any derivative works, can be bundled, embedded,
-redistributed and/or sold with any software provided that any reserved
-names are not used by derivative works. The fonts and derivatives,
-however, cannot be released under any other type of license. The
-requirement for fonts to remain under this license does not apply
-to any document created using the fonts or their derivatives.
-
-DEFINITIONS
-"Font Software" refers to the set of files released by the Copyright
-Holder(s) under this license and clearly marked as such. This may
-include source files, build scripts and documentation.
-
-"Reserved Font Name" refers to any names specified as such after the
-copyright statement(s).
-
-"Original Version" refers to the collection of Font Software components as
-distributed by the Copyright Holder(s).
-
-"Modified Version" refers to any derivative made by adding to, deleting,
-or substituting -- in part or in whole -- any of the components of the
-Original Version, by changing formats or by porting the Font Software to a
-new environment.
-
-"Author" refers to any designer, engineer, programmer, technical
-writer or other person who contributed to the Font Software.
-
-PERMISSION & CONDITIONS
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of the Font Software, to use, study, copy, merge, embed, modify,
-redistribute, and sell modified and unmodified copies of the Font
-Software, subject to the following conditions:
-
-1) Neither the Font Software nor any of its individual components,
-in Original or Modified Versions, may be sold by itself.
-
-2) Original or Modified Versions of the Font Software may be bundled,
-redistributed and/or sold with any software, provided that each copy
-contains the above copyright notice and this license. These can be
-included either as stand-alone text files, human-readable headers or
-in the appropriate machine-readable metadata fields within text or
-binary files as long as those fields can be easily viewed by the user.
-
-3) No Modified Version of the Font Software may use the Reserved Font
-Name(s) unless explicit written permission is granted by the corresponding
-Copyright Holder. This restriction only applies to the primary font name as
-presented to the users.
-
-4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
-Software shall not be used to promote, endorse or advertise any
-Modified Version, except to acknowledge the contribution(s) of the
-Copyright Holder(s) and the Author(s) or with their explicit written
-permission.
-
-5) The Font Software, modified or unmodified, in part or in whole,
-must be distributed entirely under this license, and must not be
-distributed under any other license. The requirement for fonts to
-remain under this license does not apply to any document created
-using the Font Software.
-
-TERMINATION
-This license becomes null and void if any of the above conditions are
-not met.
-
-DISCLAIMER
-THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
-OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
-COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
-DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
-OTHER DEALINGS IN THE FONT SOFTWARE.
+Copyright 2020 The Inter Project Authors (https://github.com/rsms/inter)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+https://openfontlicense.org
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/src/public/fonts/Inter/README.txt b/apps/client/src/fonts/Inter/README.txt
similarity index 100%
rename from src/public/fonts/Inter/README.txt
rename to apps/client/src/fonts/Inter/README.txt
diff --git a/src/public/fonts/JetBrainsMono-Light.woff2 b/apps/client/src/fonts/JetBrainsMono-Light.woff2
similarity index 100%
rename from src/public/fonts/JetBrainsMono-Light.woff2
rename to apps/client/src/fonts/JetBrainsMono-Light.woff2
diff --git a/src/public/fonts/Montserrat-Light.ttf b/apps/client/src/fonts/Montserrat-Light.ttf
similarity index 100%
rename from src/public/fonts/Montserrat-Light.ttf
rename to apps/client/src/fonts/Montserrat-Light.ttf
diff --git a/src/public/fonts/Montserrat-SemiBold.ttf b/apps/client/src/fonts/Montserrat-SemiBold.ttf
similarity index 100%
rename from src/public/fonts/Montserrat-SemiBold.ttf
rename to apps/client/src/fonts/Montserrat-SemiBold.ttf
diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Advanced Usage/ETAPI (REST API)/API Reference.dat b/apps/client/src/index.ts
similarity index 100%
rename from src/public/app/doc_notes/en/User Guide/User Guide/Advanced Usage/ETAPI (REST API)/API Reference.dat
rename to apps/client/src/index.ts
diff --git a/src/public/app/layouts/desktop_layout.ts b/apps/client/src/layouts/desktop_layout.ts
similarity index 99%
rename from src/public/app/layouts/desktop_layout.ts
rename to apps/client/src/layouts/desktop_layout.ts
index 4ca86197a6..d47b112f66 100644
--- a/src/public/app/layouts/desktop_layout.ts
+++ b/apps/client/src/layouts/desktop_layout.ts
@@ -87,7 +87,7 @@ import utils, { hasTouchBar } from "../services/utils.js";
import GeoMapButtons from "../widgets/floating_buttons/geo_map_button.js";
import ContextualHelpButton from "../widgets/floating_buttons/help_button.js";
import CloseZenButton from "../widgets/close_zen_button.js";
-import type { AppContext } from "./../components/app_context.js";
+import type { AppContext } from "../components/app_context.js";
import type { WidgetsByParent } from "../services/bundle.js";
import SwitchSplitOrientationButton from "../widgets/floating_buttons/switch_layout_button.js";
import ToggleReadOnlyButton from "../widgets/floating_buttons/toggle_read_only_button.js";
diff --git a/src/public/app/layouts/layout_commons.ts b/apps/client/src/layouts/layout_commons.ts
similarity index 100%
rename from src/public/app/layouts/layout_commons.ts
rename to apps/client/src/layouts/layout_commons.ts
diff --git a/src/public/app/layouts/mobile_layout.ts b/apps/client/src/layouts/mobile_layout.ts
similarity index 100%
rename from src/public/app/layouts/mobile_layout.ts
rename to apps/client/src/layouts/mobile_layout.ts
diff --git a/libraries/ckeditor/ckeditor-content.css b/apps/client/src/libraries/ckeditor/ckeditor-content.css
similarity index 100%
rename from libraries/ckeditor/ckeditor-content.css
rename to apps/client/src/libraries/ckeditor/ckeditor-content.css
diff --git a/libraries/ckeditor/ckeditor.d.ts b/apps/client/src/libraries/ckeditor/ckeditor.d.ts
similarity index 100%
rename from libraries/ckeditor/ckeditor.d.ts
rename to apps/client/src/libraries/ckeditor/ckeditor.d.ts
diff --git a/libraries/ckeditor/ckeditor.js b/apps/client/src/libraries/ckeditor/ckeditor.js
similarity index 100%
rename from libraries/ckeditor/ckeditor.js
rename to apps/client/src/libraries/ckeditor/ckeditor.js
diff --git a/libraries/ckeditor/ckeditor.js.map b/apps/client/src/libraries/ckeditor/ckeditor.js.map
similarity index 100%
rename from libraries/ckeditor/ckeditor.js.map
rename to apps/client/src/libraries/ckeditor/ckeditor.js.map
diff --git a/libraries/ckeditor/inspector.js b/apps/client/src/libraries/ckeditor/inspector.js
similarity index 100%
rename from libraries/ckeditor/inspector.js
rename to apps/client/src/libraries/ckeditor/inspector.js
diff --git a/libraries/codemirror/batch.js b/apps/client/src/libraries/codemirror/batch.js
similarity index 100%
rename from libraries/codemirror/batch.js
rename to apps/client/src/libraries/codemirror/batch.js
diff --git a/libraries/codemirror/eslint.js b/apps/client/src/libraries/codemirror/eslint.js
similarity index 100%
rename from libraries/codemirror/eslint.js
rename to apps/client/src/libraries/codemirror/eslint.js
diff --git a/libraries/codemirror/hcl.js b/apps/client/src/libraries/codemirror/hcl.js
similarity index 100%
rename from libraries/codemirror/hcl.js
rename to apps/client/src/libraries/codemirror/hcl.js
diff --git a/libraries/highlightjs/terraform.js b/apps/client/src/libraries/highlightjs/terraform.js
similarity index 100%
rename from libraries/highlightjs/terraform.js
rename to apps/client/src/libraries/highlightjs/terraform.js
diff --git a/src/public/app/login.ts b/apps/client/src/login.ts
similarity index 80%
rename from src/public/app/login.ts
rename to apps/client/src/login.ts
index 5db5cfd4e8..2ba27be023 100644
--- a/src/public/app/login.ts
+++ b/apps/client/src/login.ts
@@ -1,4 +1,4 @@
-import "../stylesheets/bootstrap.scss";
+import "./stylesheets/bootstrap.scss";
// @ts-ignore - module = undefined
// Required for correct loading of scripts in Electron
diff --git a/src/public/app/menus/context_menu.ts b/apps/client/src/menus/context_menu.ts
similarity index 100%
rename from src/public/app/menus/context_menu.ts
rename to apps/client/src/menus/context_menu.ts
diff --git a/src/public/app/menus/electron_context_menu.ts b/apps/client/src/menus/electron_context_menu.ts
similarity index 100%
rename from src/public/app/menus/electron_context_menu.ts
rename to apps/client/src/menus/electron_context_menu.ts
diff --git a/src/public/app/menus/image_context_menu.ts b/apps/client/src/menus/image_context_menu.ts
similarity index 100%
rename from src/public/app/menus/image_context_menu.ts
rename to apps/client/src/menus/image_context_menu.ts
diff --git a/src/public/app/menus/launcher_context_menu.ts b/apps/client/src/menus/launcher_context_menu.ts
similarity index 100%
rename from src/public/app/menus/launcher_context_menu.ts
rename to apps/client/src/menus/launcher_context_menu.ts
diff --git a/src/public/app/menus/link_context_menu.ts b/apps/client/src/menus/link_context_menu.ts
similarity index 100%
rename from src/public/app/menus/link_context_menu.ts
rename to apps/client/src/menus/link_context_menu.ts
diff --git a/src/public/app/menus/tree_context_menu.ts b/apps/client/src/menus/tree_context_menu.ts
similarity index 100%
rename from src/public/app/menus/tree_context_menu.ts
rename to apps/client/src/menus/tree_context_menu.ts
diff --git a/src/public/app/mobile.ts b/apps/client/src/mobile.ts
similarity index 92%
rename from src/public/app/mobile.ts
rename to apps/client/src/mobile.ts
index 925b6bb159..5d88ec1c41 100644
--- a/src/public/app/mobile.ts
+++ b/apps/client/src/mobile.ts
@@ -1,7 +1,7 @@
import appContext from "./components/app_context.js";
import noteAutocompleteService from "./services/note_autocomplete.js";
import glob from "./services/glob.js";
-import "../stylesheets/bootstrap.scss";
+import "./stylesheets/bootstrap.scss";
glob.setupGlobs();
diff --git a/src/public/app/server_types.ts b/apps/client/src/server_types.ts
similarity index 100%
rename from src/public/app/server_types.ts
rename to apps/client/src/server_types.ts
diff --git a/src/public/app/services/attribute_autocomplete.ts b/apps/client/src/services/attribute_autocomplete.ts
similarity index 100%
rename from src/public/app/services/attribute_autocomplete.ts
rename to apps/client/src/services/attribute_autocomplete.ts
diff --git a/src/public/app/services/attribute_parser.spec.ts b/apps/client/src/services/attribute_parser.spec.ts
similarity index 100%
rename from src/public/app/services/attribute_parser.spec.ts
rename to apps/client/src/services/attribute_parser.spec.ts
diff --git a/src/public/app/services/attribute_parser.ts b/apps/client/src/services/attribute_parser.ts
similarity index 100%
rename from src/public/app/services/attribute_parser.ts
rename to apps/client/src/services/attribute_parser.ts
diff --git a/src/public/app/services/attribute_renderer.ts b/apps/client/src/services/attribute_renderer.ts
similarity index 100%
rename from src/public/app/services/attribute_renderer.ts
rename to apps/client/src/services/attribute_renderer.ts
diff --git a/src/public/app/services/attributes.ts b/apps/client/src/services/attributes.ts
similarity index 100%
rename from src/public/app/services/attributes.ts
rename to apps/client/src/services/attributes.ts
diff --git a/src/public/app/services/branches.ts b/apps/client/src/services/branches.ts
similarity index 100%
rename from src/public/app/services/branches.ts
rename to apps/client/src/services/branches.ts
diff --git a/src/public/app/services/bulk_action.ts b/apps/client/src/services/bulk_action.ts
similarity index 100%
rename from src/public/app/services/bulk_action.ts
rename to apps/client/src/services/bulk_action.ts
diff --git a/src/public/app/services/bundle.ts b/apps/client/src/services/bundle.ts
similarity index 100%
rename from src/public/app/services/bundle.ts
rename to apps/client/src/services/bundle.ts
diff --git a/src/public/app/services/clipboard.ts b/apps/client/src/services/clipboard.ts
similarity index 100%
rename from src/public/app/services/clipboard.ts
rename to apps/client/src/services/clipboard.ts
diff --git a/src/public/app/services/content_renderer.ts b/apps/client/src/services/content_renderer.ts
similarity index 100%
rename from src/public/app/services/content_renderer.ts
rename to apps/client/src/services/content_renderer.ts
diff --git a/src/public/app/services/css_class_manager.ts b/apps/client/src/services/css_class_manager.ts
similarity index 100%
rename from src/public/app/services/css_class_manager.ts
rename to apps/client/src/services/css_class_manager.ts
diff --git a/src/public/app/services/date_notes.ts b/apps/client/src/services/date_notes.ts
similarity index 100%
rename from src/public/app/services/date_notes.ts
rename to apps/client/src/services/date_notes.ts
diff --git a/src/public/app/services/debounce.ts b/apps/client/src/services/debounce.ts
similarity index 100%
rename from src/public/app/services/debounce.ts
rename to apps/client/src/services/debounce.ts
diff --git a/src/public/app/services/dialog.ts b/apps/client/src/services/dialog.ts
similarity index 100%
rename from src/public/app/services/dialog.ts
rename to apps/client/src/services/dialog.ts
diff --git a/src/public/app/services/doc_renderer.ts b/apps/client/src/services/doc_renderer.ts
similarity index 100%
rename from src/public/app/services/doc_renderer.ts
rename to apps/client/src/services/doc_renderer.ts
diff --git a/src/public/app/services/eslint.spec.ts b/apps/client/src/services/eslint.spec.ts
similarity index 96%
rename from src/public/app/services/eslint.spec.ts
rename to apps/client/src/services/eslint.spec.ts
index 42eac213c7..3b3d08b5f7 100644
--- a/src/public/app/services/eslint.spec.ts
+++ b/apps/client/src/services/eslint.spec.ts
@@ -1,5 +1,5 @@
import { lint } from "./eslint.js";
-import { trimIndentation } from "../../../../spec/support/utils.js";
+import { trimIndentation } from "@triliumnext/commons";
import { describe, expect, it } from "vitest";
describe("Linter", () => {
diff --git a/src/public/app/services/eslint.ts b/apps/client/src/services/eslint.ts
similarity index 100%
rename from src/public/app/services/eslint.ts
rename to apps/client/src/services/eslint.ts
diff --git a/src/public/app/services/file_watcher.ts b/apps/client/src/services/file_watcher.ts
similarity index 100%
rename from src/public/app/services/file_watcher.ts
rename to apps/client/src/services/file_watcher.ts
diff --git a/src/public/app/services/froca-interface.ts b/apps/client/src/services/froca-interface.ts
similarity index 92%
rename from src/public/app/services/froca-interface.ts
rename to apps/client/src/services/froca-interface.ts
index 8d00779896..cfb3d076a8 100644
--- a/src/public/app/services/froca-interface.ts
+++ b/apps/client/src/services/froca-interface.ts
@@ -11,7 +11,7 @@ export interface Froca {
attachments: Record;
blobPromises: Record | null>;
- getBlob(entityType: string, entityId: string): Promise;
+ getBlob(entityType: string, entityId: string): Promise;
getNote(noteId: string, silentNotFoundError?: boolean): Promise;
getNoteFromCache(noteId: string): FNote;
getNotesFromCache(noteIds: string[], silentNotFoundError?: boolean): FNote[];
diff --git a/src/public/app/services/froca.ts b/apps/client/src/services/froca.ts
similarity index 97%
rename from src/public/app/services/froca.ts
rename to apps/client/src/services/froca.ts
index 8849d63319..c6ad3dc65b 100644
--- a/src/public/app/services/froca.ts
+++ b/apps/client/src/services/froca.ts
@@ -36,7 +36,7 @@ class FrocaImpl implements Froca {
branches!: Record;
attributes!: Record;
attachments!: Record;
- blobPromises!: Record | null>;
+ blobPromises!: Record | null>;
constructor() {
this.initializedPromise = this.loadInitialTree();
@@ -368,7 +368,7 @@ class FrocaImpl implements Froca {
});
}
- async getBlob(entityType: string, entityId: string) {
+ async getBlob(entityType: string, entityId: string): Promise {
// I'm not sure why we're not using blobIds directly, it would save us this composite key ...
// perhaps one benefit is that we're always requesting the latest blob, not relying on perhaps faulty/slow
// websocket update?
@@ -378,7 +378,10 @@ class FrocaImpl implements Froca {
this.blobPromises[key] = server
.get(`${entityType}/${entityId}/blob`)
.then((row) => new FBlob(row))
- .catch((e) => console.error(`Cannot get blob for ${entityType} '${entityId}'`, e));
+ .catch((e) => {
+ console.error(`Cannot get blob for ${entityType} '${entityId}'`, e);
+ return null;
+ });
// we don't want to keep large payloads forever in memory, so we clean that up quite quickly
// this cache is more meant to share the data between different components within one business transaction (e.g. loading of the note into the tab context and all the components)
diff --git a/src/public/app/services/froca_updater.ts b/apps/client/src/services/froca_updater.ts
similarity index 100%
rename from src/public/app/services/froca_updater.ts
rename to apps/client/src/services/froca_updater.ts
diff --git a/src/public/app/services/frontend_script_api.ts b/apps/client/src/services/frontend_script_api.ts
similarity index 100%
rename from src/public/app/services/frontend_script_api.ts
rename to apps/client/src/services/frontend_script_api.ts
diff --git a/src/public/app/services/frontend_script_entrypoint.ts b/apps/client/src/services/frontend_script_entrypoint.ts
similarity index 100%
rename from src/public/app/services/frontend_script_entrypoint.ts
rename to apps/client/src/services/frontend_script_entrypoint.ts
diff --git a/src/public/app/services/glob.ts b/apps/client/src/services/glob.ts
similarity index 100%
rename from src/public/app/services/glob.ts
rename to apps/client/src/services/glob.ts
diff --git a/src/public/app/services/hoisted_note.ts b/apps/client/src/services/hoisted_note.ts
similarity index 100%
rename from src/public/app/services/hoisted_note.ts
rename to apps/client/src/services/hoisted_note.ts
diff --git a/src/public/app/services/i18n.ts b/apps/client/src/services/i18n.ts
similarity index 95%
rename from src/public/app/services/i18n.ts
rename to apps/client/src/services/i18n.ts
index 80a9d64585..25c98fe396 100644
--- a/src/public/app/services/i18n.ts
+++ b/apps/client/src/services/i18n.ts
@@ -2,7 +2,7 @@ import options from "./options.js";
import i18next from "i18next";
import i18nextHttpBackend from "i18next-http-backend";
import server from "./server.js";
-import type { Locale } from "../../../services/i18n.js";
+import type { Locale } from "@triliumnext/commons";
let locales: Locale[] | null;
diff --git a/src/public/app/services/image.ts b/apps/client/src/services/image.ts
similarity index 100%
rename from src/public/app/services/image.ts
rename to apps/client/src/services/image.ts
diff --git a/src/public/app/services/import.ts b/apps/client/src/services/import.ts
similarity index 100%
rename from src/public/app/services/import.ts
rename to apps/client/src/services/import.ts
diff --git a/src/public/app/services/keyboard_actions.ts b/apps/client/src/services/keyboard_actions.ts
similarity index 100%
rename from src/public/app/services/keyboard_actions.ts
rename to apps/client/src/services/keyboard_actions.ts
diff --git a/src/public/app/services/library_loader.ts b/apps/client/src/services/library_loader.ts
similarity index 98%
rename from src/public/app/services/library_loader.ts
rename to apps/client/src/services/library_loader.ts
index cbc8771cbe..f880a5de0d 100644
--- a/src/public/app/services/library_loader.ts
+++ b/apps/client/src/services/library_loader.ts
@@ -85,7 +85,7 @@ async function requireLibrary(library: Library) {
}
}
-async function unwrapValue(value: T | (() => T) | Promise<(() => T)>) {
+async function unwrapValue(value: T | (() => T) | Promise) {
if (value && typeof value === "object" && "then" in value) {
return (await (value as Promise<() => T>))();
}
diff --git a/src/public/app/services/link.spec.ts b/apps/client/src/services/link.spec.ts
similarity index 100%
rename from src/public/app/services/link.spec.ts
rename to apps/client/src/services/link.spec.ts
diff --git a/src/public/app/services/link.ts b/apps/client/src/services/link.ts
similarity index 100%
rename from src/public/app/services/link.ts
rename to apps/client/src/services/link.ts
diff --git a/src/public/app/services/load_results.ts b/apps/client/src/services/load_results.ts
similarity index 98%
rename from src/public/app/services/load_results.ts
rename to apps/client/src/services/load_results.ts
index 9ff0531858..11f9a1a11a 100644
--- a/src/public/app/services/load_results.ts
+++ b/apps/client/src/services/load_results.ts
@@ -1,4 +1,4 @@
-import type { AttachmentRow } from "../../../becca/entities/rows.js";
+import type { AttachmentRow } from "@triliumnext/commons";
import type { AttributeType } from "../entities/fattribute.js";
import type { EntityChange } from "../server_types.js";
diff --git a/src/public/app/services/mermaid.spec.ts b/apps/client/src/services/mermaid.spec.ts
similarity index 95%
rename from src/public/app/services/mermaid.spec.ts
rename to apps/client/src/services/mermaid.spec.ts
index 3da396eecf..423c8de5b2 100644
--- a/src/public/app/services/mermaid.spec.ts
+++ b/apps/client/src/services/mermaid.spec.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import { postprocessMermaidSvg } from "./mermaid.js";
-import { trimIndentation } from "../../../../spec/support/utils.js";
+import { trimIndentation } from "@triliumnext/commons";
describe("Mermaid", () => {
it("converts properly", () => {
diff --git a/src/public/app/services/mermaid.ts b/apps/client/src/services/mermaid.ts
similarity index 100%
rename from src/public/app/services/mermaid.ts
rename to apps/client/src/services/mermaid.ts
diff --git a/src/public/app/services/mime_type_definitions.ts b/apps/client/src/services/mime_type_definitions.ts
similarity index 100%
rename from src/public/app/services/mime_type_definitions.ts
rename to apps/client/src/services/mime_type_definitions.ts
diff --git a/src/public/app/services/mime_types.ts b/apps/client/src/services/mime_types.ts
similarity index 100%
rename from src/public/app/services/mime_types.ts
rename to apps/client/src/services/mime_types.ts
diff --git a/src/public/app/services/note_attribute_cache.ts b/apps/client/src/services/note_attribute_cache.ts
similarity index 100%
rename from src/public/app/services/note_attribute_cache.ts
rename to apps/client/src/services/note_attribute_cache.ts
diff --git a/src/public/app/services/note_autocomplete.ts b/apps/client/src/services/note_autocomplete.ts
similarity index 100%
rename from src/public/app/services/note_autocomplete.ts
rename to apps/client/src/services/note_autocomplete.ts
diff --git a/src/public/app/services/note_create.ts b/apps/client/src/services/note_create.ts
similarity index 100%
rename from src/public/app/services/note_create.ts
rename to apps/client/src/services/note_create.ts
diff --git a/src/public/app/services/note_list_renderer.ts b/apps/client/src/services/note_list_renderer.ts
similarity index 100%
rename from src/public/app/services/note_list_renderer.ts
rename to apps/client/src/services/note_list_renderer.ts
diff --git a/src/public/app/services/note_tooltip.ts b/apps/client/src/services/note_tooltip.ts
similarity index 100%
rename from src/public/app/services/note_tooltip.ts
rename to apps/client/src/services/note_tooltip.ts
diff --git a/src/public/app/services/note_types.ts b/apps/client/src/services/note_types.ts
similarity index 100%
rename from src/public/app/services/note_types.ts
rename to apps/client/src/services/note_types.ts
diff --git a/src/public/app/services/open.ts b/apps/client/src/services/open.ts
similarity index 100%
rename from src/public/app/services/open.ts
rename to apps/client/src/services/open.ts
diff --git a/src/public/app/services/options.ts b/apps/client/src/services/options.ts
similarity index 100%
rename from src/public/app/services/options.ts
rename to apps/client/src/services/options.ts
diff --git a/src/public/app/services/promoted_attribute_definition_parser.ts b/apps/client/src/services/promoted_attribute_definition_parser.ts
similarity index 100%
rename from src/public/app/services/promoted_attribute_definition_parser.ts
rename to apps/client/src/services/promoted_attribute_definition_parser.ts
diff --git a/src/public/app/services/protected_session.ts b/apps/client/src/services/protected_session.ts
similarity index 100%
rename from src/public/app/services/protected_session.ts
rename to apps/client/src/services/protected_session.ts
diff --git a/src/public/app/services/protected_session_holder.ts b/apps/client/src/services/protected_session_holder.ts
similarity index 100%
rename from src/public/app/services/protected_session_holder.ts
rename to apps/client/src/services/protected_session_holder.ts
diff --git a/src/public/app/services/render.ts b/apps/client/src/services/render.ts
similarity index 100%
rename from src/public/app/services/render.ts
rename to apps/client/src/services/render.ts
diff --git a/src/public/app/services/resizer.ts b/apps/client/src/services/resizer.ts
similarity index 100%
rename from src/public/app/services/resizer.ts
rename to apps/client/src/services/resizer.ts
diff --git a/src/public/app/services/script_context.ts b/apps/client/src/services/script_context.ts
similarity index 100%
rename from src/public/app/services/script_context.ts
rename to apps/client/src/services/script_context.ts
diff --git a/src/public/app/services/search.ts b/apps/client/src/services/search.ts
similarity index 100%
rename from src/public/app/services/search.ts
rename to apps/client/src/services/search.ts
diff --git a/src/public/app/services/server.ts b/apps/client/src/services/server.ts
similarity index 100%
rename from src/public/app/services/server.ts
rename to apps/client/src/services/server.ts
diff --git a/src/public/app/services/shortcuts.ts b/apps/client/src/services/shortcuts.ts
similarity index 100%
rename from src/public/app/services/shortcuts.ts
rename to apps/client/src/services/shortcuts.ts
diff --git a/src/public/app/services/spaced_update.ts b/apps/client/src/services/spaced_update.ts
similarity index 100%
rename from src/public/app/services/spaced_update.ts
rename to apps/client/src/services/spaced_update.ts
diff --git a/src/public/app/services/sync.ts b/apps/client/src/services/sync.ts
similarity index 100%
rename from src/public/app/services/sync.ts
rename to apps/client/src/services/sync.ts
diff --git a/src/public/app/services/syntax_highlight.ts b/apps/client/src/services/syntax_highlight.ts
similarity index 100%
rename from src/public/app/services/syntax_highlight.ts
rename to apps/client/src/services/syntax_highlight.ts
diff --git a/src/public/app/services/toast.ts b/apps/client/src/services/toast.ts
similarity index 100%
rename from src/public/app/services/toast.ts
rename to apps/client/src/services/toast.ts
diff --git a/src/public/app/services/tree.ts b/apps/client/src/services/tree.ts
similarity index 99%
rename from src/public/app/services/tree.ts
rename to apps/client/src/services/tree.ts
index ff4c342100..4854472147 100644
--- a/src/public/app/services/tree.ts
+++ b/apps/client/src/services/tree.ts
@@ -1,7 +1,7 @@
import ws from "./ws.js";
import utils from "./utils.js";
import froca from "./froca.js";
-import hoistedNoteService from "../services/hoisted_note.js";
+import hoistedNoteService from "./hoisted_note.js";
import appContext from "../components/app_context.js";
/**
diff --git a/src/public/app/services/utils.spec.ts b/apps/client/src/services/utils.spec.ts
similarity index 100%
rename from src/public/app/services/utils.spec.ts
rename to apps/client/src/services/utils.spec.ts
diff --git a/src/public/app/services/utils.ts b/apps/client/src/services/utils.ts
similarity index 100%
rename from src/public/app/services/utils.ts
rename to apps/client/src/services/utils.ts
diff --git a/src/public/app/services/validation_error.ts b/apps/client/src/services/validation_error.ts
similarity index 100%
rename from src/public/app/services/validation_error.ts
rename to apps/client/src/services/validation_error.ts
diff --git a/src/public/app/services/ws.ts b/apps/client/src/services/ws.ts
similarity index 98%
rename from src/public/app/services/ws.ts
rename to apps/client/src/services/ws.ts
index db79b1a5e5..ccfd19592d 100644
--- a/src/public/app/services/ws.ts
+++ b/apps/client/src/services/ws.ts
@@ -131,21 +131,21 @@ async function handleMessage(event: MessageEvent) {
// ENHANCED LOGGING FOR DEBUGGING
console.log(`[WS-CLIENT] >>> RECEIVED LLM STREAM MESSAGE <<<`);
console.log(`[WS-CLIENT] Message details: sessionId=${message.sessionId}, hasContent=${!!message.content}, contentLength=${message.content ? message.content.length : 0}, hasThinking=${!!message.thinking}, hasToolExecution=${!!message.toolExecution}, isDone=${!!message.done}`);
-
+
if (message.content) {
console.log(`[WS-CLIENT] CONTENT PREVIEW: "${message.content.substring(0, 50)}..."`);
}
-
+
// Create the event with detailed logging
console.log(`[WS-CLIENT] Creating CustomEvent 'llm-stream-message'`);
const llmStreamEvent = new CustomEvent('llm-stream-message', { detail: message });
-
+
// Dispatch to multiple targets to ensure delivery
try {
console.log(`[WS-CLIENT] Dispatching event to window`);
window.dispatchEvent(llmStreamEvent);
console.log(`[WS-CLIENT] Event dispatched to window`);
-
+
// Also try document for completeness
console.log(`[WS-CLIENT] Dispatching event to document`);
document.dispatchEvent(new CustomEvent('llm-stream-message', { detail: message }));
@@ -153,10 +153,10 @@ async function handleMessage(event: MessageEvent) {
} catch (err) {
console.error(`[WS-CLIENT] Error dispatching event:`, err);
}
-
+
// Debug current listeners (though we can't directly check for specific event listeners)
console.log(`[WS-CLIENT] Active event listeners should receive this message now`);
-
+
// Detailed logging based on message type
if (message.content) {
console.log(`[WS-CLIENT] Content message: ${message.content.length} chars`);
@@ -173,10 +173,10 @@ async function handleMessage(event: MessageEvent) {
} else if (message.type === "execute-script") {
// TODO: Remove after porting the file
// @ts-ignore
- const bundleService = (await import("../services/bundle.js")).default as any;
+ const bundleService = (await import("./bundle.js")).default as any;
// TODO: Remove after porting the file
// @ts-ignore
- const froca = (await import("../services/froca.js")).default as any;
+ const froca = (await import("./froca.js")).default as any;
const originEntity = message.originEntityId ? await froca.getNote(message.originEntityId) : null;
bundleService.getAndExecuteBundle(message.currentNoteId, originEntity, message.script, message.params);
diff --git a/src/public/app/set_password.ts b/apps/client/src/set_password.ts
similarity index 74%
rename from src/public/app/set_password.ts
rename to apps/client/src/set_password.ts
index 95e6cc2dad..67dfee1878 100644
--- a/src/public/app/set_password.ts
+++ b/apps/client/src/set_password.ts
@@ -1,5 +1,5 @@
-import "../stylesheets/bootstrap.scss";
-import "../stylesheets/auth.css";
+import "./stylesheets/bootstrap.scss";
+import "./stylesheets/auth.css";
// @TriliumNextTODO: is this even needed anymore?
// @ts-ignore - module = undefined
diff --git a/src/public/app/setup.ts b/apps/client/src/setup.ts
similarity index 98%
rename from src/public/app/setup.ts
rename to apps/client/src/setup.ts
index 0d4647093e..2e0dae151c 100644
--- a/src/public/app/setup.ts
+++ b/apps/client/src/setup.ts
@@ -1,6 +1,6 @@
import utils from "./services/utils.js";
import ko from "knockout";
-import "../stylesheets/bootstrap.scss";
+import "./stylesheets/bootstrap.scss";
// TriliumNextTODO: properly make use of below types
// type SetupModelSetupType = "new-document" | "sync-from-desktop" | "sync-from-server" | "";
diff --git a/src/public/app/share.ts b/apps/client/src/share.ts
similarity index 95%
rename from src/public/app/share.ts
rename to apps/client/src/share.ts
index 8f5ebebad6..0281e6ed4e 100644
--- a/src/public/app/share.ts
+++ b/apps/client/src/share.ts
@@ -1,4 +1,4 @@
-import "../stylesheets/bootstrap.scss";
+import "./stylesheets/bootstrap.scss";
/**
* Fetch note with given ID from backend
diff --git a/src/public/stylesheets/auth.css b/apps/client/src/stylesheets/auth.css
similarity index 100%
rename from src/public/stylesheets/auth.css
rename to apps/client/src/stylesheets/auth.css
diff --git a/apps/client/src/stylesheets/bootstrap.scss b/apps/client/src/stylesheets/bootstrap.scss
new file mode 100644
index 0000000000..b30b929fed
--- /dev/null
+++ b/apps/client/src/stylesheets/bootstrap.scss
@@ -0,0 +1,2 @@
+/* Import all of Bootstrap's CSS */
+@use "bootstrap/scss/bootstrap";
diff --git a/src/public/stylesheets/calendar.css b/apps/client/src/stylesheets/calendar.css
similarity index 100%
rename from src/public/stylesheets/calendar.css
rename to apps/client/src/stylesheets/calendar.css
diff --git a/src/public/stylesheets/ckeditor-theme.css b/apps/client/src/stylesheets/ckeditor-theme.css
similarity index 100%
rename from src/public/stylesheets/ckeditor-theme.css
rename to apps/client/src/stylesheets/ckeditor-theme.css
diff --git a/src/public/stylesheets/llm_chat.css b/apps/client/src/stylesheets/llm_chat.css
similarity index 100%
rename from src/public/stylesheets/llm_chat.css
rename to apps/client/src/stylesheets/llm_chat.css
diff --git a/src/public/stylesheets/print.css b/apps/client/src/stylesheets/print.css
similarity index 100%
rename from src/public/stylesheets/print.css
rename to apps/client/src/stylesheets/print.css
diff --git a/src/public/stylesheets/relation_map.css b/apps/client/src/stylesheets/relation_map.css
similarity index 100%
rename from src/public/stylesheets/relation_map.css
rename to apps/client/src/stylesheets/relation_map.css
diff --git a/src/public/stylesheets/share.css b/apps/client/src/stylesheets/share.css
similarity index 100%
rename from src/public/stylesheets/share.css
rename to apps/client/src/stylesheets/share.css
diff --git a/src/public/stylesheets/style.css b/apps/client/src/stylesheets/style.css
similarity index 100%
rename from src/public/stylesheets/style.css
rename to apps/client/src/stylesheets/style.css
diff --git a/src/public/stylesheets/theme-dark.css b/apps/client/src/stylesheets/theme-dark.css
similarity index 100%
rename from src/public/stylesheets/theme-dark.css
rename to apps/client/src/stylesheets/theme-dark.css
diff --git a/src/public/stylesheets/theme-light.css b/apps/client/src/stylesheets/theme-light.css
similarity index 100%
rename from src/public/stylesheets/theme-light.css
rename to apps/client/src/stylesheets/theme-light.css
diff --git a/src/public/stylesheets/theme-next-dark.css b/apps/client/src/stylesheets/theme-next-dark.css
similarity index 100%
rename from src/public/stylesheets/theme-next-dark.css
rename to apps/client/src/stylesheets/theme-next-dark.css
diff --git a/src/public/stylesheets/theme-next-light.css b/apps/client/src/stylesheets/theme-next-light.css
similarity index 100%
rename from src/public/stylesheets/theme-next-light.css
rename to apps/client/src/stylesheets/theme-next-light.css
diff --git a/src/public/stylesheets/theme-next.css b/apps/client/src/stylesheets/theme-next.css
similarity index 100%
rename from src/public/stylesheets/theme-next.css
rename to apps/client/src/stylesheets/theme-next.css
diff --git a/src/public/stylesheets/theme-next/base.css b/apps/client/src/stylesheets/theme-next/base.css
similarity index 99%
rename from src/public/stylesheets/theme-next/base.css
rename to apps/client/src/stylesheets/theme-next/base.css
index aced7ab5d7..e9917b142f 100644
--- a/src/public/stylesheets/theme-next/base.css
+++ b/apps/client/src/stylesheets/theme-next/base.css
@@ -7,7 +7,7 @@
@font-face {
font-family: "Inter";
- src: url(../../fonts/Inter/Inter-VariableFont_opsz\,wght.ttf);
+ src: url(../../fonts/Inter/Inter-VariableFont_opsz,wght.ttf);
}
/*
diff --git a/src/public/stylesheets/theme-next/dialogs.css b/apps/client/src/stylesheets/theme-next/dialogs.css
similarity index 100%
rename from src/public/stylesheets/theme-next/dialogs.css
rename to apps/client/src/stylesheets/theme-next/dialogs.css
diff --git a/src/public/stylesheets/theme-next/forms.css b/apps/client/src/stylesheets/theme-next/forms.css
similarity index 100%
rename from src/public/stylesheets/theme-next/forms.css
rename to apps/client/src/stylesheets/theme-next/forms.css
diff --git a/src/public/stylesheets/theme-next/llm-chat.css b/apps/client/src/stylesheets/theme-next/llm-chat.css
similarity index 100%
rename from src/public/stylesheets/theme-next/llm-chat.css
rename to apps/client/src/stylesheets/theme-next/llm-chat.css
diff --git a/src/public/stylesheets/theme-next/notes/text.css b/apps/client/src/stylesheets/theme-next/notes/text.css
similarity index 100%
rename from src/public/stylesheets/theme-next/notes/text.css
rename to apps/client/src/stylesheets/theme-next/notes/text.css
diff --git a/src/public/stylesheets/theme-next/pages.css b/apps/client/src/stylesheets/theme-next/pages.css
similarity index 100%
rename from src/public/stylesheets/theme-next/pages.css
rename to apps/client/src/stylesheets/theme-next/pages.css
diff --git a/src/public/stylesheets/theme-next/ribbon.css b/apps/client/src/stylesheets/theme-next/ribbon.css
similarity index 100%
rename from src/public/stylesheets/theme-next/ribbon.css
rename to apps/client/src/stylesheets/theme-next/ribbon.css
diff --git a/src/public/stylesheets/theme-next/shell.css b/apps/client/src/stylesheets/theme-next/shell.css
similarity index 100%
rename from src/public/stylesheets/theme-next/shell.css
rename to apps/client/src/stylesheets/theme-next/shell.css
diff --git a/src/public/stylesheets/theme.css b/apps/client/src/stylesheets/theme.css
similarity index 100%
rename from src/public/stylesheets/theme.css
rename to apps/client/src/stylesheets/theme.css
diff --git a/src/public/stylesheets/tree.css b/apps/client/src/stylesheets/tree.css
similarity index 100%
rename from src/public/stylesheets/tree.css
rename to apps/client/src/stylesheets/tree.css
diff --git a/src/public/app/test/easy-froca.ts b/apps/client/src/test/easy-froca.ts
similarity index 100%
rename from src/public/app/test/easy-froca.ts
rename to apps/client/src/test/easy-froca.ts
diff --git a/src/public/app/test/setup.ts b/apps/client/src/test/setup.ts
similarity index 100%
rename from src/public/app/test/setup.ts
rename to apps/client/src/test/setup.ts
diff --git a/src/public/translations/cn/translation.json b/apps/client/src/translations/cn/translation.json
similarity index 100%
rename from src/public/translations/cn/translation.json
rename to apps/client/src/translations/cn/translation.json
diff --git a/src/public/translations/de/translation.json b/apps/client/src/translations/de/translation.json
similarity index 100%
rename from src/public/translations/de/translation.json
rename to apps/client/src/translations/de/translation.json
diff --git a/src/public/translations/en/translation.json b/apps/client/src/translations/en/translation.json
similarity index 100%
rename from src/public/translations/en/translation.json
rename to apps/client/src/translations/en/translation.json
diff --git a/src/public/translations/es/translation.json b/apps/client/src/translations/es/translation.json
similarity index 100%
rename from src/public/translations/es/translation.json
rename to apps/client/src/translations/es/translation.json
diff --git a/src/public/translations/fr/translation.json b/apps/client/src/translations/fr/translation.json
similarity index 100%
rename from src/public/translations/fr/translation.json
rename to apps/client/src/translations/fr/translation.json
diff --git a/src/public/translations/pt_br/translation.json b/apps/client/src/translations/pt_br/translation.json
similarity index 100%
rename from src/public/translations/pt_br/translation.json
rename to apps/client/src/translations/pt_br/translation.json
diff --git a/src/public/translations/ro/translation.json b/apps/client/src/translations/ro/translation.json
similarity index 100%
rename from src/public/translations/ro/translation.json
rename to apps/client/src/translations/ro/translation.json
diff --git a/src/public/translations/tw/translation.json b/apps/client/src/translations/tw/translation.json
similarity index 100%
rename from src/public/translations/tw/translation.json
rename to apps/client/src/translations/tw/translation.json
diff --git a/src/public/app/types-assets.d.ts b/apps/client/src/types-assets.d.ts
similarity index 53%
rename from src/public/app/types-assets.d.ts
rename to apps/client/src/types-assets.d.ts
index 157ee60b9f..ba739632ce 100644
--- a/src/public/app/types-assets.d.ts
+++ b/apps/client/src/types-assets.d.ts
@@ -2,3 +2,5 @@ declare module "*.png" {
var path: string;
export default path;
}
+
+declare module "script-loader!mark.js/dist/jquery.mark.min.js";
\ No newline at end of file
diff --git a/src/public/app/types-fancytree.d.ts b/apps/client/src/types-fancytree.d.ts
similarity index 100%
rename from src/public/app/types-fancytree.d.ts
rename to apps/client/src/types-fancytree.d.ts
diff --git a/src/public/app/types-lib.d.ts b/apps/client/src/types-lib.d.ts
similarity index 100%
rename from src/public/app/types-lib.d.ts
rename to apps/client/src/types-lib.d.ts
diff --git a/src/public/app/types.d.ts b/apps/client/src/types.d.ts
similarity index 92%
rename from src/public/app/types.d.ts
rename to apps/client/src/types.d.ts
index 504ae89077..b67be8f42a 100644
--- a/src/public/app/types.d.ts
+++ b/apps/client/src/types.d.ts
@@ -1,14 +1,12 @@
import type FNote from "./entities/fnote";
import type { Froca } from "./services/froca-interface";
-import { Suggestion } from "./services/note_autocomplete.ts";
-import utils from "./services/utils.ts";
-import appContext from "./components/app_context.ts";
-import server from "./services/server.ts";
-import library_loader, { Library } from "./services/library_loader.ts";
-import type { init } from "i18next";
-import type { lint } from "./services/eslint.ts";
-import type { RelationType } from "./widgets/type_widgets/relation_map.ts";
-import type { Mermaid } from "mermaid";
+import { Suggestion } from "./services/note_autocomplete";
+import utils from "./services/utils";
+import appContext, { AppContext } from "./components/app_context";
+import server from "./services/server";
+import library_loader, { Library } from "./services/library_loader";
+import type { lint } from "./services/eslint";
+import type { Mermaid, MermaidConfig } from "mermaid";
interface ElectronProcess {
type: string;
@@ -23,7 +21,7 @@ interface CustomGlobals {
getHeaders: typeof server.getHeaders;
getReferenceLinkTitle: (href: string) => Promise;
getReferenceLinkTitleSync: (href: string) => string;
- getActiveContextNote: FNote;
+ getActiveContextNote: () => FNote;
requireLibrary: typeof library_loader.requireLibrary;
ESLINT: Library;
appContext: AppContext;
@@ -73,19 +71,19 @@ declare global {
debug?: boolean;
}
- type AutoCompleteCallback = (values: AutoCompleteCallbackArg[]) => void;
+ type AutoCompleteCallback = (values: AutoCompleteArg[]) => void;
interface AutoCompleteArg {
- displayKey: "name" | "value" | "notePathTitle";
+ displayKey?: "name" | "value" | "notePathTitle";
cache?: boolean;
- source: (term: string, cb: AutoCompleteCallback) => void,
+ source?: (term: string, cb: AutoCompleteCallback) => void,
templates?: {
suggestion: (suggestion: Suggestion) => string | undefined
}
- };
+ }
interface JQuery {
- autocomplete: (action?: "close" | "open" | "destroy" | "val" | AutoCompleteConfig, args?: AutoCompleteArg[] | string) => JQuery>;
+ autocomplete: (action?: "close" | "open" | "destroy" | "val" | AutoCompleteConfig, args?: object[] | string) => JQuery;
getSelectedNotePath(): string | undefined;
getSelectedNoteId(): string | null;
@@ -118,6 +116,7 @@ declare global {
var logError: (message: string, e?: Error | string) => void;
var logInfo: (message: string) => void;
var glob: CustomGlobals;
+ //@ts-ignore
var require: RequireMethod;
var __non_webpack_require__: RequireMethod | undefined;
@@ -137,7 +136,11 @@ declare global {
label: string;
}
- interface CKWatchdog {
+ interface CKEditorInstance {
+ create(elementOrData: any, finalConfig: any): TextEditor;
+ }
+
+ class CKWatchdog {
constructor(editorClass: CKEditorInstance, opts: {
minimumNonErrorTimePeriod: number;
crashNumberLimit: number,
@@ -260,7 +263,7 @@ declare global {
interface Writer {
setAttribute(name: string, value: string, el: CKNode);
createPositionAt(el: CKNode, opt?: "end" | number);
- setSelection(pos: number, pos?: number);
+ setSelection(pos: number, pos2?: number);
insertText(text: string, opts: Record | undefined | TextPosition, position?: TextPosition);
addMarker(name: string, opts: {
range: Range;
@@ -342,6 +345,7 @@ declare global {
commands: {
get(name: string): {
value: unknown;
+ on(event: string, callback: () => void): void;
};
}
model: {
@@ -404,6 +408,14 @@ declare global {
};
toModel(viewFeragment: any);
},
+ ui: {
+ view: {
+ toolbar: {
+ items: any[];
+ element: HTMLElement;
+ }
+ }
+ }
conversion: {
for(filter: string): {
markerToHighlight(data: {
diff --git a/src/public/app/utils/formatters.ts b/apps/client/src/utils/formatters.ts
similarity index 100%
rename from src/public/app/utils/formatters.ts
rename to apps/client/src/utils/formatters.ts
diff --git a/src/public/app/utils/mutex.ts b/apps/client/src/utils/mutex.ts
similarity index 100%
rename from src/public/app/utils/mutex.ts
rename to apps/client/src/utils/mutex.ts
diff --git a/src/public/app/widgets/api_log.ts b/apps/client/src/widgets/api_log.ts
similarity index 100%
rename from src/public/app/widgets/api_log.ts
rename to apps/client/src/widgets/api_log.ts
diff --git a/src/public/app/widgets/attachment_detail.ts b/apps/client/src/widgets/attachment_detail.ts
similarity index 100%
rename from src/public/app/widgets/attachment_detail.ts
rename to apps/client/src/widgets/attachment_detail.ts
diff --git a/src/public/app/widgets/attribute_widgets/attribute_detail.ts b/apps/client/src/widgets/attribute_widgets/attribute_detail.ts
similarity index 100%
rename from src/public/app/widgets/attribute_widgets/attribute_detail.ts
rename to apps/client/src/widgets/attribute_widgets/attribute_detail.ts
diff --git a/src/public/app/widgets/attribute_widgets/attribute_editor.ts b/apps/client/src/widgets/attribute_widgets/attribute_editor.ts
similarity index 100%
rename from src/public/app/widgets/attribute_widgets/attribute_editor.ts
rename to apps/client/src/widgets/attribute_widgets/attribute_editor.ts
diff --git a/src/public/app/widgets/basic_widget.ts b/apps/client/src/widgets/basic_widget.ts
similarity index 100%
rename from src/public/app/widgets/basic_widget.ts
rename to apps/client/src/widgets/basic_widget.ts
diff --git a/src/public/app/widgets/bookmark_buttons.ts b/apps/client/src/widgets/bookmark_buttons.ts
similarity index 100%
rename from src/public/app/widgets/bookmark_buttons.ts
rename to apps/client/src/widgets/bookmark_buttons.ts
diff --git a/src/public/app/widgets/bookmark_switch.ts b/apps/client/src/widgets/bookmark_switch.ts
similarity index 97%
rename from src/public/app/widgets/bookmark_switch.ts
rename to apps/client/src/widgets/bookmark_switch.ts
index 8ec8b88b57..93d4789aa2 100644
--- a/src/public/app/widgets/bookmark_switch.ts
+++ b/apps/client/src/widgets/bookmark_switch.ts
@@ -35,7 +35,7 @@ export default class BookmarkSwitchWidget extends SwitchWidget {
async toggle(state: boolean | null | undefined) {
const resp = await server.put(`notes/${this.noteId}/toggle-in-parent/_lbBookmarks/${!!state}`);
- if (!resp.success) {
+ if (!resp.success && "message" in resp) {
toastService.showError(resp.message);
}
}
diff --git a/src/public/app/widgets/bulk_actions/abstract_bulk_action.ts b/apps/client/src/widgets/bulk_actions/abstract_bulk_action.ts
similarity index 100%
rename from src/public/app/widgets/bulk_actions/abstract_bulk_action.ts
rename to apps/client/src/widgets/bulk_actions/abstract_bulk_action.ts
diff --git a/src/public/app/widgets/bulk_actions/execute_script.ts b/apps/client/src/widgets/bulk_actions/execute_script.ts
similarity index 100%
rename from src/public/app/widgets/bulk_actions/execute_script.ts
rename to apps/client/src/widgets/bulk_actions/execute_script.ts
diff --git a/src/public/app/widgets/bulk_actions/label/add_label.ts b/apps/client/src/widgets/bulk_actions/label/add_label.ts
similarity index 100%
rename from src/public/app/widgets/bulk_actions/label/add_label.ts
rename to apps/client/src/widgets/bulk_actions/label/add_label.ts
diff --git a/src/public/app/widgets/bulk_actions/label/delete_label.ts b/apps/client/src/widgets/bulk_actions/label/delete_label.ts
similarity index 100%
rename from src/public/app/widgets/bulk_actions/label/delete_label.ts
rename to apps/client/src/widgets/bulk_actions/label/delete_label.ts
diff --git a/src/public/app/widgets/bulk_actions/label/rename_label.ts b/apps/client/src/widgets/bulk_actions/label/rename_label.ts
similarity index 100%
rename from src/public/app/widgets/bulk_actions/label/rename_label.ts
rename to apps/client/src/widgets/bulk_actions/label/rename_label.ts
diff --git a/src/public/app/widgets/bulk_actions/label/update_label_value.ts b/apps/client/src/widgets/bulk_actions/label/update_label_value.ts
similarity index 100%
rename from src/public/app/widgets/bulk_actions/label/update_label_value.ts
rename to apps/client/src/widgets/bulk_actions/label/update_label_value.ts
diff --git a/src/public/app/widgets/bulk_actions/note/delete_note.ts b/apps/client/src/widgets/bulk_actions/note/delete_note.ts
similarity index 100%
rename from src/public/app/widgets/bulk_actions/note/delete_note.ts
rename to apps/client/src/widgets/bulk_actions/note/delete_note.ts
diff --git a/src/public/app/widgets/bulk_actions/note/delete_revisions.ts b/apps/client/src/widgets/bulk_actions/note/delete_revisions.ts
similarity index 100%
rename from src/public/app/widgets/bulk_actions/note/delete_revisions.ts
rename to apps/client/src/widgets/bulk_actions/note/delete_revisions.ts
diff --git a/src/public/app/widgets/bulk_actions/note/move_note.ts b/apps/client/src/widgets/bulk_actions/note/move_note.ts
similarity index 100%
rename from src/public/app/widgets/bulk_actions/note/move_note.ts
rename to apps/client/src/widgets/bulk_actions/note/move_note.ts
diff --git a/src/public/app/widgets/bulk_actions/note/rename_note.ts b/apps/client/src/widgets/bulk_actions/note/rename_note.ts
similarity index 100%
rename from src/public/app/widgets/bulk_actions/note/rename_note.ts
rename to apps/client/src/widgets/bulk_actions/note/rename_note.ts
diff --git a/src/public/app/widgets/bulk_actions/relation/add_relation.ts b/apps/client/src/widgets/bulk_actions/relation/add_relation.ts
similarity index 100%
rename from src/public/app/widgets/bulk_actions/relation/add_relation.ts
rename to apps/client/src/widgets/bulk_actions/relation/add_relation.ts
diff --git a/src/public/app/widgets/bulk_actions/relation/delete_relation.ts b/apps/client/src/widgets/bulk_actions/relation/delete_relation.ts
similarity index 100%
rename from src/public/app/widgets/bulk_actions/relation/delete_relation.ts
rename to apps/client/src/widgets/bulk_actions/relation/delete_relation.ts
diff --git a/src/public/app/widgets/bulk_actions/relation/rename_relation.ts b/apps/client/src/widgets/bulk_actions/relation/rename_relation.ts
similarity index 100%
rename from src/public/app/widgets/bulk_actions/relation/rename_relation.ts
rename to apps/client/src/widgets/bulk_actions/relation/rename_relation.ts
diff --git a/src/public/app/widgets/bulk_actions/relation/update_relation_target.ts b/apps/client/src/widgets/bulk_actions/relation/update_relation_target.ts
similarity index 100%
rename from src/public/app/widgets/bulk_actions/relation/update_relation_target.ts
rename to apps/client/src/widgets/bulk_actions/relation/update_relation_target.ts
diff --git a/src/public/app/widgets/buttons/abstract_button.ts b/apps/client/src/widgets/buttons/abstract_button.ts
similarity index 100%
rename from src/public/app/widgets/buttons/abstract_button.ts
rename to apps/client/src/widgets/buttons/abstract_button.ts
diff --git a/src/public/app/widgets/buttons/ai_chat_button.ts b/apps/client/src/widgets/buttons/ai_chat_button.ts
similarity index 100%
rename from src/public/app/widgets/buttons/ai_chat_button.ts
rename to apps/client/src/widgets/buttons/ai_chat_button.ts
diff --git a/src/public/app/widgets/buttons/attachments_actions.ts b/apps/client/src/widgets/buttons/attachments_actions.ts
similarity index 96%
rename from src/public/app/widgets/buttons/attachments_actions.ts
rename to apps/client/src/widgets/buttons/attachments_actions.ts
index b8bbbe572f..8b904d6588 100644
--- a/src/public/app/widgets/buttons/attachments_actions.ts
+++ b/apps/client/src/widgets/buttons/attachments_actions.ts
@@ -8,9 +8,9 @@ import appContext from "../../components/app_context.js";
import openService from "../../services/open.js";
import utils from "../../services/utils.js";
import { Dropdown } from "bootstrap";
-import type attachmentsApiRoute from "../../../../routes/api/attachments.js";
import type FAttachment from "../../entities/fattachment.js";
import type AttachmentDetailWidget from "../attachment_detail.js";
+import { NoteRow } from "@triliumnext/commons";
const TPL = /*html*/`
@@ -81,6 +81,11 @@ const TPL = /*html*/`
`;
+// TODO: Deduplicate
+interface AttachmentResponse {
+ note: NoteRow;
+}
+
export default class AttachmentActionsWidget extends BasicWidget {
$uploadNewRevisionInput!: JQuery;
attachment: FAttachment;
@@ -168,7 +173,7 @@ export default class AttachmentActionsWidget extends BasicWidget {
return;
}
- const { note: newNote } = await server.post>(`attachments/${this.attachmentId}/convert-to-note`);
+ const { note: newNote } = await server.post(`attachments/${this.attachmentId}/convert-to-note`);
toastService.showMessage(t("attachments_actions.convert_success", { title: this.attachment.title }));
await ws.waitForMaxKnownEntityChangeId();
await appContext.tabManager.getActiveContext()?.setNote(newNote.noteId);
diff --git a/src/public/app/widgets/buttons/bookmark_folder.ts b/apps/client/src/widgets/buttons/bookmark_folder.ts
similarity index 100%
rename from src/public/app/widgets/buttons/bookmark_folder.ts
rename to apps/client/src/widgets/buttons/bookmark_folder.ts
diff --git a/src/public/app/widgets/buttons/button_from_note.ts b/apps/client/src/widgets/buttons/button_from_note.ts
similarity index 100%
rename from src/public/app/widgets/buttons/button_from_note.ts
rename to apps/client/src/widgets/buttons/button_from_note.ts
diff --git a/src/public/app/widgets/buttons/calendar.ts b/apps/client/src/widgets/buttons/calendar.ts
similarity index 98%
rename from src/public/app/widgets/buttons/calendar.ts
rename to apps/client/src/widgets/buttons/calendar.ts
index a8b2d45422..3bcba2558a 100644
--- a/src/public/app/widgets/buttons/calendar.ts
+++ b/apps/client/src/widgets/buttons/calendar.ts
@@ -10,8 +10,8 @@ import type { EventData } from "../../components/app_context.js";
import dayjs, { Dayjs } from "dayjs";
import utc from "dayjs/plugin/utc.js";
import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js";
-import type BAttribute from "../../../../becca/entities/battribute.js";
-import "../../../stylesheets/calendar.css";
+import "../../stylesheets/calendar.css";
+import { AttributeRow } from "@triliumnext/commons";
dayjs.extend(utc);
dayjs.extend(isSameOrAfter);
@@ -217,7 +217,7 @@ export default class CalendarWidget extends RightDropdownButtonWidget {
this.weekNoteEnable = false;
return;
}
- const noteAttributes = await server.get(`notes/${noteId}/attributes`);
+ const noteAttributes = await server.get(`notes/${noteId}/attributes`);
for (const attribute of noteAttributes) {
if (attribute.name === 'enableWeekNote') {
diff --git a/src/public/app/widgets/buttons/close_pane_button.ts b/apps/client/src/widgets/buttons/close_pane_button.ts
similarity index 100%
rename from src/public/app/widgets/buttons/close_pane_button.ts
rename to apps/client/src/widgets/buttons/close_pane_button.ts
diff --git a/src/public/app/widgets/buttons/command_button.ts b/apps/client/src/widgets/buttons/command_button.ts
similarity index 100%
rename from src/public/app/widgets/buttons/command_button.ts
rename to apps/client/src/widgets/buttons/command_button.ts
diff --git a/src/public/app/widgets/buttons/create_ai_chat_button.ts b/apps/client/src/widgets/buttons/create_ai_chat_button.ts
similarity index 100%
rename from src/public/app/widgets/buttons/create_ai_chat_button.ts
rename to apps/client/src/widgets/buttons/create_ai_chat_button.ts
diff --git a/src/public/app/widgets/buttons/create_pane_button.ts b/apps/client/src/widgets/buttons/create_pane_button.ts
similarity index 100%
rename from src/public/app/widgets/buttons/create_pane_button.ts
rename to apps/client/src/widgets/buttons/create_pane_button.ts
diff --git a/src/public/app/widgets/buttons/global_menu.ts b/apps/client/src/widgets/buttons/global_menu.ts
similarity index 100%
rename from src/public/app/widgets/buttons/global_menu.ts
rename to apps/client/src/widgets/buttons/global_menu.ts
diff --git a/src/public/app/widgets/buttons/history_navigation.ts b/apps/client/src/widgets/buttons/history_navigation.ts
similarity index 100%
rename from src/public/app/widgets/buttons/history_navigation.ts
rename to apps/client/src/widgets/buttons/history_navigation.ts
diff --git a/src/public/app/widgets/buttons/launcher/abstract_launcher.ts b/apps/client/src/widgets/buttons/launcher/abstract_launcher.ts
similarity index 100%
rename from src/public/app/widgets/buttons/launcher/abstract_launcher.ts
rename to apps/client/src/widgets/buttons/launcher/abstract_launcher.ts
diff --git a/src/public/app/widgets/buttons/launcher/note_launcher.ts b/apps/client/src/widgets/buttons/launcher/note_launcher.ts
similarity index 100%
rename from src/public/app/widgets/buttons/launcher/note_launcher.ts
rename to apps/client/src/widgets/buttons/launcher/note_launcher.ts
diff --git a/src/public/app/widgets/buttons/launcher/script_launcher.ts b/apps/client/src/widgets/buttons/launcher/script_launcher.ts
similarity index 100%
rename from src/public/app/widgets/buttons/launcher/script_launcher.ts
rename to apps/client/src/widgets/buttons/launcher/script_launcher.ts
diff --git a/src/public/app/widgets/buttons/launcher/today_launcher.ts b/apps/client/src/widgets/buttons/launcher/today_launcher.ts
similarity index 100%
rename from src/public/app/widgets/buttons/launcher/today_launcher.ts
rename to apps/client/src/widgets/buttons/launcher/today_launcher.ts
diff --git a/src/public/app/widgets/buttons/left_pane_toggle.ts b/apps/client/src/widgets/buttons/left_pane_toggle.ts
similarity index 100%
rename from src/public/app/widgets/buttons/left_pane_toggle.ts
rename to apps/client/src/widgets/buttons/left_pane_toggle.ts
diff --git a/src/public/app/widgets/buttons/move_pane_button.ts b/apps/client/src/widgets/buttons/move_pane_button.ts
similarity index 100%
rename from src/public/app/widgets/buttons/move_pane_button.ts
rename to apps/client/src/widgets/buttons/move_pane_button.ts
diff --git a/src/public/app/widgets/buttons/note_actions.ts b/apps/client/src/widgets/buttons/note_actions.ts
similarity index 100%
rename from src/public/app/widgets/buttons/note_actions.ts
rename to apps/client/src/widgets/buttons/note_actions.ts
diff --git a/src/public/app/widgets/buttons/onclick_button.ts b/apps/client/src/widgets/buttons/onclick_button.ts
similarity index 100%
rename from src/public/app/widgets/buttons/onclick_button.ts
rename to apps/client/src/widgets/buttons/onclick_button.ts
diff --git a/src/public/app/widgets/buttons/open_note_button_widget.ts b/apps/client/src/widgets/buttons/open_note_button_widget.ts
similarity index 100%
rename from src/public/app/widgets/buttons/open_note_button_widget.ts
rename to apps/client/src/widgets/buttons/open_note_button_widget.ts
diff --git a/src/public/app/widgets/buttons/protected_session_status.ts b/apps/client/src/widgets/buttons/protected_session_status.ts
similarity index 100%
rename from src/public/app/widgets/buttons/protected_session_status.ts
rename to apps/client/src/widgets/buttons/protected_session_status.ts
diff --git a/src/public/app/widgets/buttons/revisions_button.ts b/apps/client/src/widgets/buttons/revisions_button.ts
similarity index 100%
rename from src/public/app/widgets/buttons/revisions_button.ts
rename to apps/client/src/widgets/buttons/revisions_button.ts
diff --git a/src/public/app/widgets/buttons/right_dropdown_button.ts b/apps/client/src/widgets/buttons/right_dropdown_button.ts
similarity index 100%
rename from src/public/app/widgets/buttons/right_dropdown_button.ts
rename to apps/client/src/widgets/buttons/right_dropdown_button.ts
diff --git a/src/public/app/widgets/buttons/show_highlights_list_widget_button.ts b/apps/client/src/widgets/buttons/show_highlights_list_widget_button.ts
similarity index 100%
rename from src/public/app/widgets/buttons/show_highlights_list_widget_button.ts
rename to apps/client/src/widgets/buttons/show_highlights_list_widget_button.ts
diff --git a/src/public/app/widgets/buttons/show_toc_widget_button.ts b/apps/client/src/widgets/buttons/show_toc_widget_button.ts
similarity index 100%
rename from src/public/app/widgets/buttons/show_toc_widget_button.ts
rename to apps/client/src/widgets/buttons/show_toc_widget_button.ts
diff --git a/src/public/app/widgets/buttons/update_available.ts b/apps/client/src/widgets/buttons/update_available.ts
similarity index 100%
rename from src/public/app/widgets/buttons/update_available.ts
rename to apps/client/src/widgets/buttons/update_available.ts
diff --git a/src/public/app/widgets/close_zen_button.ts b/apps/client/src/widgets/close_zen_button.ts
similarity index 100%
rename from src/public/app/widgets/close_zen_button.ts
rename to apps/client/src/widgets/close_zen_button.ts
diff --git a/src/public/app/widgets/containers/container.ts b/apps/client/src/widgets/containers/container.ts
similarity index 100%
rename from src/public/app/widgets/containers/container.ts
rename to apps/client/src/widgets/containers/container.ts
diff --git a/src/public/app/widgets/containers/flex_container.ts b/apps/client/src/widgets/containers/flex_container.ts
similarity index 100%
rename from src/public/app/widgets/containers/flex_container.ts
rename to apps/client/src/widgets/containers/flex_container.ts
diff --git a/src/public/app/widgets/containers/launcher.ts b/apps/client/src/widgets/containers/launcher.ts
similarity index 100%
rename from src/public/app/widgets/containers/launcher.ts
rename to apps/client/src/widgets/containers/launcher.ts
diff --git a/src/public/app/widgets/containers/launcher_container.ts b/apps/client/src/widgets/containers/launcher_container.ts
similarity index 100%
rename from src/public/app/widgets/containers/launcher_container.ts
rename to apps/client/src/widgets/containers/launcher_container.ts
diff --git a/src/public/app/widgets/containers/left_pane_container.ts b/apps/client/src/widgets/containers/left_pane_container.ts
similarity index 100%
rename from src/public/app/widgets/containers/left_pane_container.ts
rename to apps/client/src/widgets/containers/left_pane_container.ts
diff --git a/src/public/app/widgets/containers/ribbon_container.ts b/apps/client/src/widgets/containers/ribbon_container.ts
similarity index 100%
rename from src/public/app/widgets/containers/ribbon_container.ts
rename to apps/client/src/widgets/containers/ribbon_container.ts
diff --git a/src/public/app/widgets/containers/right_pane_container.ts b/apps/client/src/widgets/containers/right_pane_container.ts
similarity index 100%
rename from src/public/app/widgets/containers/right_pane_container.ts
rename to apps/client/src/widgets/containers/right_pane_container.ts
diff --git a/src/public/app/widgets/containers/root_container.ts b/apps/client/src/widgets/containers/root_container.ts
similarity index 100%
rename from src/public/app/widgets/containers/root_container.ts
rename to apps/client/src/widgets/containers/root_container.ts
diff --git a/src/public/app/widgets/containers/scrolling_container.ts b/apps/client/src/widgets/containers/scrolling_container.ts
similarity index 100%
rename from src/public/app/widgets/containers/scrolling_container.ts
rename to apps/client/src/widgets/containers/scrolling_container.ts
diff --git a/src/public/app/widgets/containers/split_note_container.ts b/apps/client/src/widgets/containers/split_note_container.ts
similarity index 100%
rename from src/public/app/widgets/containers/split_note_container.ts
rename to apps/client/src/widgets/containers/split_note_container.ts
diff --git a/src/public/app/widgets/dialogs/about.ts b/apps/client/src/widgets/dialogs/about.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/about.ts
rename to apps/client/src/widgets/dialogs/about.ts
diff --git a/src/public/app/widgets/dialogs/add_link.ts b/apps/client/src/widgets/dialogs/add_link.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/add_link.ts
rename to apps/client/src/widgets/dialogs/add_link.ts
diff --git a/src/public/app/widgets/dialogs/branch_prefix.ts b/apps/client/src/widgets/dialogs/branch_prefix.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/branch_prefix.ts
rename to apps/client/src/widgets/dialogs/branch_prefix.ts
diff --git a/src/public/app/widgets/dialogs/bulk_actions.ts b/apps/client/src/widgets/dialogs/bulk_actions.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/bulk_actions.ts
rename to apps/client/src/widgets/dialogs/bulk_actions.ts
diff --git a/src/public/app/widgets/dialogs/clone_to.ts b/apps/client/src/widgets/dialogs/clone_to.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/clone_to.ts
rename to apps/client/src/widgets/dialogs/clone_to.ts
diff --git a/src/public/app/widgets/dialogs/confirm.ts b/apps/client/src/widgets/dialogs/confirm.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/confirm.ts
rename to apps/client/src/widgets/dialogs/confirm.ts
diff --git a/src/public/app/widgets/dialogs/delete_notes.ts b/apps/client/src/widgets/dialogs/delete_notes.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/delete_notes.ts
rename to apps/client/src/widgets/dialogs/delete_notes.ts
diff --git a/src/public/app/widgets/dialogs/export.ts b/apps/client/src/widgets/dialogs/export.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/export.ts
rename to apps/client/src/widgets/dialogs/export.ts
diff --git a/src/public/app/widgets/dialogs/help.ts b/apps/client/src/widgets/dialogs/help.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/help.ts
rename to apps/client/src/widgets/dialogs/help.ts
diff --git a/src/public/app/widgets/dialogs/import.ts b/apps/client/src/widgets/dialogs/import.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/import.ts
rename to apps/client/src/widgets/dialogs/import.ts
diff --git a/src/public/app/widgets/dialogs/include_note.ts b/apps/client/src/widgets/dialogs/include_note.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/include_note.ts
rename to apps/client/src/widgets/dialogs/include_note.ts
diff --git a/src/public/app/widgets/dialogs/info.ts b/apps/client/src/widgets/dialogs/info.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/info.ts
rename to apps/client/src/widgets/dialogs/info.ts
diff --git a/src/public/app/widgets/dialogs/jump_to_note.ts b/apps/client/src/widgets/dialogs/jump_to_note.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/jump_to_note.ts
rename to apps/client/src/widgets/dialogs/jump_to_note.ts
diff --git a/src/public/app/widgets/dialogs/markdown_import.ts b/apps/client/src/widgets/dialogs/markdown_import.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/markdown_import.ts
rename to apps/client/src/widgets/dialogs/markdown_import.ts
diff --git a/src/public/app/widgets/dialogs/move_to.ts b/apps/client/src/widgets/dialogs/move_to.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/move_to.ts
rename to apps/client/src/widgets/dialogs/move_to.ts
diff --git a/src/public/app/widgets/dialogs/note_type_chooser.ts b/apps/client/src/widgets/dialogs/note_type_chooser.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/note_type_chooser.ts
rename to apps/client/src/widgets/dialogs/note_type_chooser.ts
diff --git a/src/public/app/widgets/dialogs/password_not_set.ts b/apps/client/src/widgets/dialogs/password_not_set.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/password_not_set.ts
rename to apps/client/src/widgets/dialogs/password_not_set.ts
diff --git a/src/public/app/widgets/dialogs/prompt.ts b/apps/client/src/widgets/dialogs/prompt.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/prompt.ts
rename to apps/client/src/widgets/dialogs/prompt.ts
diff --git a/src/public/app/widgets/dialogs/protected_session_password.ts b/apps/client/src/widgets/dialogs/protected_session_password.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/protected_session_password.ts
rename to apps/client/src/widgets/dialogs/protected_session_password.ts
diff --git a/src/public/app/widgets/dialogs/recent_changes.ts b/apps/client/src/widgets/dialogs/recent_changes.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/recent_changes.ts
rename to apps/client/src/widgets/dialogs/recent_changes.ts
diff --git a/src/public/app/widgets/dialogs/revisions.ts b/apps/client/src/widgets/dialogs/revisions.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/revisions.ts
rename to apps/client/src/widgets/dialogs/revisions.ts
diff --git a/src/public/app/widgets/dialogs/sort_child_notes.ts b/apps/client/src/widgets/dialogs/sort_child_notes.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/sort_child_notes.ts
rename to apps/client/src/widgets/dialogs/sort_child_notes.ts
diff --git a/src/public/app/widgets/dialogs/upload_attachments.ts b/apps/client/src/widgets/dialogs/upload_attachments.ts
similarity index 100%
rename from src/public/app/widgets/dialogs/upload_attachments.ts
rename to apps/client/src/widgets/dialogs/upload_attachments.ts
diff --git a/src/public/app/widgets/editability_select.ts b/apps/client/src/widgets/editability_select.ts
similarity index 100%
rename from src/public/app/widgets/editability_select.ts
rename to apps/client/src/widgets/editability_select.ts
diff --git a/src/public/app/widgets/find.ts b/apps/client/src/widgets/find.ts
similarity index 100%
rename from src/public/app/widgets/find.ts
rename to apps/client/src/widgets/find.ts
diff --git a/src/public/app/widgets/find_in_code.ts b/apps/client/src/widgets/find_in_code.ts
similarity index 100%
rename from src/public/app/widgets/find_in_code.ts
rename to apps/client/src/widgets/find_in_code.ts
diff --git a/src/public/app/widgets/find_in_html.ts b/apps/client/src/widgets/find_in_html.ts
similarity index 100%
rename from src/public/app/widgets/find_in_html.ts
rename to apps/client/src/widgets/find_in_html.ts
diff --git a/src/public/app/widgets/find_in_text.ts b/apps/client/src/widgets/find_in_text.ts
similarity index 100%
rename from src/public/app/widgets/find_in_text.ts
rename to apps/client/src/widgets/find_in_text.ts
diff --git a/src/public/app/widgets/floating_buttons/code_buttons.ts b/apps/client/src/widgets/floating_buttons/code_buttons.ts
similarity index 100%
rename from src/public/app/widgets/floating_buttons/code_buttons.ts
rename to apps/client/src/widgets/floating_buttons/code_buttons.ts
diff --git a/src/public/app/widgets/floating_buttons/copy_image_reference_button.ts b/apps/client/src/widgets/floating_buttons/copy_image_reference_button.ts
similarity index 100%
rename from src/public/app/widgets/floating_buttons/copy_image_reference_button.ts
rename to apps/client/src/widgets/floating_buttons/copy_image_reference_button.ts
diff --git a/src/public/app/widgets/floating_buttons/edit_button.ts b/apps/client/src/widgets/floating_buttons/edit_button.ts
similarity index 100%
rename from src/public/app/widgets/floating_buttons/edit_button.ts
rename to apps/client/src/widgets/floating_buttons/edit_button.ts
diff --git a/src/public/app/widgets/floating_buttons/floating_buttons.ts b/apps/client/src/widgets/floating_buttons/floating_buttons.ts
similarity index 100%
rename from src/public/app/widgets/floating_buttons/floating_buttons.ts
rename to apps/client/src/widgets/floating_buttons/floating_buttons.ts
diff --git a/src/public/app/widgets/floating_buttons/geo_map_button.ts b/apps/client/src/widgets/floating_buttons/geo_map_button.ts
similarity index 100%
rename from src/public/app/widgets/floating_buttons/geo_map_button.ts
rename to apps/client/src/widgets/floating_buttons/geo_map_button.ts
diff --git a/src/public/app/widgets/floating_buttons/help_button.spec.ts b/apps/client/src/widgets/floating_buttons/help_button.spec.ts
similarity index 94%
rename from src/public/app/widgets/floating_buttons/help_button.spec.ts
rename to apps/client/src/widgets/floating_buttons/help_button.spec.ts
index bc954f27d9..9015d7d751 100644
--- a/src/public/app/widgets/floating_buttons/help_button.spec.ts
+++ b/apps/client/src/widgets/floating_buttons/help_button.spec.ts
@@ -1,7 +1,7 @@
import { describe, expect, it } from "vitest";
import { byBookType, byNoteType } from "./help_button.js";
import fs from "fs";
-import type { HiddenSubtreeItem } from "../../../../services/hidden_subtree.js";
+import type { HiddenSubtreeItem } from "@triliumnext/commons";
describe("Help button", () => {
it("All help notes are accessible", () => {
diff --git a/src/public/app/widgets/floating_buttons/help_button.ts b/apps/client/src/widgets/floating_buttons/help_button.ts
similarity index 100%
rename from src/public/app/widgets/floating_buttons/help_button.ts
rename to apps/client/src/widgets/floating_buttons/help_button.ts
diff --git a/src/public/app/widgets/floating_buttons/hide_floating_buttons_button.ts b/apps/client/src/widgets/floating_buttons/hide_floating_buttons_button.ts
similarity index 100%
rename from src/public/app/widgets/floating_buttons/hide_floating_buttons_button.ts
rename to apps/client/src/widgets/floating_buttons/hide_floating_buttons_button.ts
diff --git a/src/public/app/widgets/floating_buttons/png_export_button.ts b/apps/client/src/widgets/floating_buttons/png_export_button.ts
similarity index 100%
rename from src/public/app/widgets/floating_buttons/png_export_button.ts
rename to apps/client/src/widgets/floating_buttons/png_export_button.ts
diff --git a/src/public/app/widgets/floating_buttons/refresh_button.ts b/apps/client/src/widgets/floating_buttons/refresh_button.ts
similarity index 100%
rename from src/public/app/widgets/floating_buttons/refresh_button.ts
rename to apps/client/src/widgets/floating_buttons/refresh_button.ts
diff --git a/src/public/app/widgets/floating_buttons/relation_map_buttons.ts b/apps/client/src/widgets/floating_buttons/relation_map_buttons.ts
similarity index 100%
rename from src/public/app/widgets/floating_buttons/relation_map_buttons.ts
rename to apps/client/src/widgets/floating_buttons/relation_map_buttons.ts
diff --git a/src/public/app/widgets/floating_buttons/svg_export_button.ts b/apps/client/src/widgets/floating_buttons/svg_export_button.ts
similarity index 100%
rename from src/public/app/widgets/floating_buttons/svg_export_button.ts
rename to apps/client/src/widgets/floating_buttons/svg_export_button.ts
diff --git a/src/public/app/widgets/floating_buttons/switch_layout_button.ts b/apps/client/src/widgets/floating_buttons/switch_layout_button.ts
similarity index 100%
rename from src/public/app/widgets/floating_buttons/switch_layout_button.ts
rename to apps/client/src/widgets/floating_buttons/switch_layout_button.ts
diff --git a/src/public/app/widgets/floating_buttons/toggle_read_only_button.ts b/apps/client/src/widgets/floating_buttons/toggle_read_only_button.ts
similarity index 100%
rename from src/public/app/widgets/floating_buttons/toggle_read_only_button.ts
rename to apps/client/src/widgets/floating_buttons/toggle_read_only_button.ts
diff --git a/src/public/app/widgets/floating_buttons/zpetne_odkazy.ts b/apps/client/src/widgets/floating_buttons/zpetne_odkazy.ts
similarity index 100%
rename from src/public/app/widgets/floating_buttons/zpetne_odkazy.ts
rename to apps/client/src/widgets/floating_buttons/zpetne_odkazy.ts
diff --git a/src/public/app/widgets/geo_map.ts b/apps/client/src/widgets/geo_map.ts
similarity index 100%
rename from src/public/app/widgets/geo_map.ts
rename to apps/client/src/widgets/geo_map.ts
diff --git a/src/public/app/widgets/highlights_list.spec.ts b/apps/client/src/widgets/highlights_list.spec.ts
similarity index 100%
rename from src/public/app/widgets/highlights_list.spec.ts
rename to apps/client/src/widgets/highlights_list.spec.ts
diff --git a/src/public/app/widgets/highlights_list.ts b/apps/client/src/widgets/highlights_list.ts
similarity index 100%
rename from src/public/app/widgets/highlights_list.ts
rename to apps/client/src/widgets/highlights_list.ts
diff --git a/src/public/app/widgets/icon_list.ts b/apps/client/src/widgets/icon_list.ts
similarity index 100%
rename from src/public/app/widgets/icon_list.ts
rename to apps/client/src/widgets/icon_list.ts
diff --git a/src/public/app/widgets/llm_chat/communication.ts b/apps/client/src/widgets/llm_chat/communication.ts
similarity index 100%
rename from src/public/app/widgets/llm_chat/communication.ts
rename to apps/client/src/widgets/llm_chat/communication.ts
diff --git a/src/public/app/widgets/llm_chat/index.ts b/apps/client/src/widgets/llm_chat/index.ts
similarity index 100%
rename from src/public/app/widgets/llm_chat/index.ts
rename to apps/client/src/widgets/llm_chat/index.ts
diff --git a/src/public/app/widgets/llm_chat/llm_chat_panel.ts b/apps/client/src/widgets/llm_chat/llm_chat_panel.ts
similarity index 99%
rename from src/public/app/widgets/llm_chat/llm_chat_panel.ts
rename to apps/client/src/widgets/llm_chat/llm_chat_panel.ts
index 3554773d7b..7cbd6a802e 100644
--- a/src/public/app/widgets/llm_chat/llm_chat_panel.ts
+++ b/apps/client/src/widgets/llm_chat/llm_chat_panel.ts
@@ -14,7 +14,7 @@ import { validateEmbeddingProviders } from "./validation.js";
import type { MessageData, ToolExecutionStep, ChatData } from "./types.js";
import { applySyntaxHighlight } from "../../services/syntax_highlight.js";
-import "../../../stylesheets/llm_chat.css";
+import "../../stylesheets/llm_chat.css";
export default class LlmChatPanel extends BasicWidget {
private noteContextChatMessages!: HTMLElement;
diff --git a/src/public/app/widgets/llm_chat/message_processor.ts b/apps/client/src/widgets/llm_chat/message_processor.ts
similarity index 100%
rename from src/public/app/widgets/llm_chat/message_processor.ts
rename to apps/client/src/widgets/llm_chat/message_processor.ts
diff --git a/src/public/app/widgets/llm_chat/types.ts b/apps/client/src/widgets/llm_chat/types.ts
similarity index 100%
rename from src/public/app/widgets/llm_chat/types.ts
rename to apps/client/src/widgets/llm_chat/types.ts
diff --git a/src/public/app/widgets/llm_chat/ui.ts b/apps/client/src/widgets/llm_chat/ui.ts
similarity index 100%
rename from src/public/app/widgets/llm_chat/ui.ts
rename to apps/client/src/widgets/llm_chat/ui.ts
diff --git a/src/public/app/widgets/llm_chat/utils.ts b/apps/client/src/widgets/llm_chat/utils.ts
similarity index 100%
rename from src/public/app/widgets/llm_chat/utils.ts
rename to apps/client/src/widgets/llm_chat/utils.ts
diff --git a/src/public/app/widgets/llm_chat/validation.ts b/apps/client/src/widgets/llm_chat/validation.ts
similarity index 100%
rename from src/public/app/widgets/llm_chat/validation.ts
rename to apps/client/src/widgets/llm_chat/validation.ts
diff --git a/src/public/app/widgets/llm_chat_panel.ts b/apps/client/src/widgets/llm_chat_panel.ts
similarity index 100%
rename from src/public/app/widgets/llm_chat_panel.ts
rename to apps/client/src/widgets/llm_chat_panel.ts
diff --git a/src/public/app/widgets/mobile_widgets/mobile_detail_menu.ts b/apps/client/src/widgets/mobile_widgets/mobile_detail_menu.ts
similarity index 100%
rename from src/public/app/widgets/mobile_widgets/mobile_detail_menu.ts
rename to apps/client/src/widgets/mobile_widgets/mobile_detail_menu.ts
diff --git a/src/public/app/widgets/mobile_widgets/screen_container.ts b/apps/client/src/widgets/mobile_widgets/screen_container.ts
similarity index 100%
rename from src/public/app/widgets/mobile_widgets/screen_container.ts
rename to apps/client/src/widgets/mobile_widgets/screen_container.ts
diff --git a/src/public/app/widgets/mobile_widgets/sidebar_container.ts b/apps/client/src/widgets/mobile_widgets/sidebar_container.ts
similarity index 100%
rename from src/public/app/widgets/mobile_widgets/sidebar_container.ts
rename to apps/client/src/widgets/mobile_widgets/sidebar_container.ts
diff --git a/src/public/app/widgets/mobile_widgets/toggle_sidebar_button.ts b/apps/client/src/widgets/mobile_widgets/toggle_sidebar_button.ts
similarity index 100%
rename from src/public/app/widgets/mobile_widgets/toggle_sidebar_button.ts
rename to apps/client/src/widgets/mobile_widgets/toggle_sidebar_button.ts
diff --git a/src/public/app/widgets/note_context_aware_widget.ts b/apps/client/src/widgets/note_context_aware_widget.ts
similarity index 100%
rename from src/public/app/widgets/note_context_aware_widget.ts
rename to apps/client/src/widgets/note_context_aware_widget.ts
diff --git a/src/public/app/widgets/note_detail.ts b/apps/client/src/widgets/note_detail.ts
similarity index 100%
rename from src/public/app/widgets/note_detail.ts
rename to apps/client/src/widgets/note_detail.ts
diff --git a/src/public/app/widgets/note_icon.ts b/apps/client/src/widgets/note_icon.ts
similarity index 98%
rename from src/public/app/widgets/note_icon.ts
rename to apps/client/src/widgets/note_icon.ts
index 6dd1fdebf6..b5623db878 100644
--- a/src/public/app/widgets/note_icon.ts
+++ b/apps/client/src/widgets/note_icon.ts
@@ -207,7 +207,7 @@ export default class NoteIconWidget extends NoteContextAwareWidget {
async getIconToCountMap() {
if (!this.iconToCountCache) {
- this.iconToCountCache = server.get("other/icon-usage");
+ this.iconToCountCache = server.get("other/icon-usage");
setTimeout(() => (this.iconToCountCache = null), 20000); // invalidate cache after 20 seconds
}
diff --git a/src/public/app/widgets/note_language.ts b/apps/client/src/widgets/note_language.ts
similarity index 99%
rename from src/public/app/widgets/note_language.ts
rename to apps/client/src/widgets/note_language.ts
index 4f5d2dc63b..45fcf02c9e 100644
--- a/src/public/app/widgets/note_language.ts
+++ b/apps/client/src/widgets/note_language.ts
@@ -5,7 +5,7 @@ import { t } from "i18next";
import type { EventData } from "../components/app_context.js";
import type FNote from "../entities/fnote.js";
import attributes from "../services/attributes.js";
-import type { Locale } from "../../../services/i18n.js";
+import type { Locale } from "@triliumnext/commons";
import options from "../services/options.js";
import appContext from "../components/app_context.js";
diff --git a/src/public/app/widgets/note_list.ts b/apps/client/src/widgets/note_list.ts
similarity index 100%
rename from src/public/app/widgets/note_list.ts
rename to apps/client/src/widgets/note_list.ts
diff --git a/src/public/app/widgets/note_map.ts b/apps/client/src/widgets/note_map.ts
similarity index 100%
rename from src/public/app/widgets/note_map.ts
rename to apps/client/src/widgets/note_map.ts
diff --git a/src/public/app/widgets/note_title.ts b/apps/client/src/widgets/note_title.ts
similarity index 100%
rename from src/public/app/widgets/note_title.ts
rename to apps/client/src/widgets/note_title.ts
diff --git a/src/public/app/widgets/note_tree.ts b/apps/client/src/widgets/note_tree.ts
similarity index 100%
rename from src/public/app/widgets/note_tree.ts
rename to apps/client/src/widgets/note_tree.ts
diff --git a/src/public/app/widgets/note_type.ts b/apps/client/src/widgets/note_type.ts
similarity index 100%
rename from src/public/app/widgets/note_type.ts
rename to apps/client/src/widgets/note_type.ts
diff --git a/src/public/app/widgets/note_wrapper.ts b/apps/client/src/widgets/note_wrapper.ts
similarity index 100%
rename from src/public/app/widgets/note_wrapper.ts
rename to apps/client/src/widgets/note_wrapper.ts
diff --git a/src/public/app/widgets/protected_note_switch.ts b/apps/client/src/widgets/protected_note_switch.ts
similarity index 100%
rename from src/public/app/widgets/protected_note_switch.ts
rename to apps/client/src/widgets/protected_note_switch.ts
diff --git a/src/public/app/widgets/quick_search.ts b/apps/client/src/widgets/quick_search.ts
similarity index 100%
rename from src/public/app/widgets/quick_search.ts
rename to apps/client/src/widgets/quick_search.ts
diff --git a/src/public/app/widgets/quick_search_launcher.ts b/apps/client/src/widgets/quick_search_launcher.ts
similarity index 100%
rename from src/public/app/widgets/quick_search_launcher.ts
rename to apps/client/src/widgets/quick_search_launcher.ts
diff --git a/src/public/app/widgets/ribbon_widgets/basic_properties.ts b/apps/client/src/widgets/ribbon_widgets/basic_properties.ts
similarity index 100%
rename from src/public/app/widgets/ribbon_widgets/basic_properties.ts
rename to apps/client/src/widgets/ribbon_widgets/basic_properties.ts
diff --git a/src/public/app/widgets/ribbon_widgets/book_properties.ts b/apps/client/src/widgets/ribbon_widgets/book_properties.ts
similarity index 100%
rename from src/public/app/widgets/ribbon_widgets/book_properties.ts
rename to apps/client/src/widgets/ribbon_widgets/book_properties.ts
diff --git a/src/public/app/widgets/ribbon_widgets/classic_editor_toolbar.ts b/apps/client/src/widgets/ribbon_widgets/classic_editor_toolbar.ts
similarity index 100%
rename from src/public/app/widgets/ribbon_widgets/classic_editor_toolbar.ts
rename to apps/client/src/widgets/ribbon_widgets/classic_editor_toolbar.ts
diff --git a/src/public/app/widgets/ribbon_widgets/edited_notes.ts b/apps/client/src/widgets/ribbon_widgets/edited_notes.ts
similarity index 100%
rename from src/public/app/widgets/ribbon_widgets/edited_notes.ts
rename to apps/client/src/widgets/ribbon_widgets/edited_notes.ts
diff --git a/src/public/app/widgets/ribbon_widgets/file_properties.ts b/apps/client/src/widgets/ribbon_widgets/file_properties.ts
similarity index 100%
rename from src/public/app/widgets/ribbon_widgets/file_properties.ts
rename to apps/client/src/widgets/ribbon_widgets/file_properties.ts
diff --git a/src/public/app/widgets/ribbon_widgets/image_properties.ts b/apps/client/src/widgets/ribbon_widgets/image_properties.ts
similarity index 100%
rename from src/public/app/widgets/ribbon_widgets/image_properties.ts
rename to apps/client/src/widgets/ribbon_widgets/image_properties.ts
diff --git a/src/public/app/widgets/ribbon_widgets/inherited_attribute_list.ts b/apps/client/src/widgets/ribbon_widgets/inherited_attribute_list.ts
similarity index 100%
rename from src/public/app/widgets/ribbon_widgets/inherited_attribute_list.ts
rename to apps/client/src/widgets/ribbon_widgets/inherited_attribute_list.ts
diff --git a/src/public/app/widgets/ribbon_widgets/mobile_editor_toolbar.ts b/apps/client/src/widgets/ribbon_widgets/mobile_editor_toolbar.ts
similarity index 100%
rename from src/public/app/widgets/ribbon_widgets/mobile_editor_toolbar.ts
rename to apps/client/src/widgets/ribbon_widgets/mobile_editor_toolbar.ts
diff --git a/src/public/app/widgets/ribbon_widgets/note_info_widget.ts b/apps/client/src/widgets/ribbon_widgets/note_info_widget.ts
similarity index 100%
rename from src/public/app/widgets/ribbon_widgets/note_info_widget.ts
rename to apps/client/src/widgets/ribbon_widgets/note_info_widget.ts
diff --git a/src/public/app/widgets/ribbon_widgets/note_map.ts b/apps/client/src/widgets/ribbon_widgets/note_map.ts
similarity index 100%
rename from src/public/app/widgets/ribbon_widgets/note_map.ts
rename to apps/client/src/widgets/ribbon_widgets/note_map.ts
diff --git a/src/public/app/widgets/ribbon_widgets/note_paths.ts b/apps/client/src/widgets/ribbon_widgets/note_paths.ts
similarity index 100%
rename from src/public/app/widgets/ribbon_widgets/note_paths.ts
rename to apps/client/src/widgets/ribbon_widgets/note_paths.ts
diff --git a/src/public/app/widgets/ribbon_widgets/note_properties.ts b/apps/client/src/widgets/ribbon_widgets/note_properties.ts
similarity index 100%
rename from src/public/app/widgets/ribbon_widgets/note_properties.ts
rename to apps/client/src/widgets/ribbon_widgets/note_properties.ts
diff --git a/src/public/app/widgets/ribbon_widgets/owned_attribute_list.ts b/apps/client/src/widgets/ribbon_widgets/owned_attribute_list.ts
similarity index 100%
rename from src/public/app/widgets/ribbon_widgets/owned_attribute_list.ts
rename to apps/client/src/widgets/ribbon_widgets/owned_attribute_list.ts
diff --git a/src/public/app/widgets/ribbon_widgets/promoted_attributes.ts b/apps/client/src/widgets/ribbon_widgets/promoted_attributes.ts
similarity index 100%
rename from src/public/app/widgets/ribbon_widgets/promoted_attributes.ts
rename to apps/client/src/widgets/ribbon_widgets/promoted_attributes.ts
diff --git a/src/public/app/widgets/ribbon_widgets/script_executor.ts b/apps/client/src/widgets/ribbon_widgets/script_executor.ts
similarity index 100%
rename from src/public/app/widgets/ribbon_widgets/script_executor.ts
rename to apps/client/src/widgets/ribbon_widgets/script_executor.ts
diff --git a/src/public/app/widgets/ribbon_widgets/search_definition.ts b/apps/client/src/widgets/ribbon_widgets/search_definition.ts
similarity index 100%
rename from src/public/app/widgets/ribbon_widgets/search_definition.ts
rename to apps/client/src/widgets/ribbon_widgets/search_definition.ts
diff --git a/src/public/app/widgets/ribbon_widgets/similar_notes.ts b/apps/client/src/widgets/ribbon_widgets/similar_notes.ts
similarity index 100%
rename from src/public/app/widgets/ribbon_widgets/similar_notes.ts
rename to apps/client/src/widgets/ribbon_widgets/similar_notes.ts
diff --git a/src/public/app/widgets/right_panel_widget.ts b/apps/client/src/widgets/right_panel_widget.ts
similarity index 100%
rename from src/public/app/widgets/right_panel_widget.ts
rename to apps/client/src/widgets/right_panel_widget.ts
diff --git a/src/public/app/widgets/scroll_padding.ts b/apps/client/src/widgets/scroll_padding.ts
similarity index 100%
rename from src/public/app/widgets/scroll_padding.ts
rename to apps/client/src/widgets/scroll_padding.ts
diff --git a/src/public/app/widgets/search_options/abstract_search_option.ts b/apps/client/src/widgets/search_options/abstract_search_option.ts
similarity index 100%
rename from src/public/app/widgets/search_options/abstract_search_option.ts
rename to apps/client/src/widgets/search_options/abstract_search_option.ts
diff --git a/src/public/app/widgets/search_options/ancestor.ts b/apps/client/src/widgets/search_options/ancestor.ts
similarity index 100%
rename from src/public/app/widgets/search_options/ancestor.ts
rename to apps/client/src/widgets/search_options/ancestor.ts
diff --git a/src/public/app/widgets/search_options/debug.ts b/apps/client/src/widgets/search_options/debug.ts
similarity index 100%
rename from src/public/app/widgets/search_options/debug.ts
rename to apps/client/src/widgets/search_options/debug.ts
diff --git a/src/public/app/widgets/search_options/fast_search.ts b/apps/client/src/widgets/search_options/fast_search.ts
similarity index 100%
rename from src/public/app/widgets/search_options/fast_search.ts
rename to apps/client/src/widgets/search_options/fast_search.ts
diff --git a/src/public/app/widgets/search_options/include_archived_notes.ts b/apps/client/src/widgets/search_options/include_archived_notes.ts
similarity index 100%
rename from src/public/app/widgets/search_options/include_archived_notes.ts
rename to apps/client/src/widgets/search_options/include_archived_notes.ts
diff --git a/src/public/app/widgets/search_options/limit.ts b/apps/client/src/widgets/search_options/limit.ts
similarity index 100%
rename from src/public/app/widgets/search_options/limit.ts
rename to apps/client/src/widgets/search_options/limit.ts
diff --git a/src/public/app/widgets/search_options/order_by.ts b/apps/client/src/widgets/search_options/order_by.ts
similarity index 100%
rename from src/public/app/widgets/search_options/order_by.ts
rename to apps/client/src/widgets/search_options/order_by.ts
diff --git a/src/public/app/widgets/search_options/search_script.ts b/apps/client/src/widgets/search_options/search_script.ts
similarity index 100%
rename from src/public/app/widgets/search_options/search_script.ts
rename to apps/client/src/widgets/search_options/search_script.ts
diff --git a/src/public/app/widgets/search_options/search_string.ts b/apps/client/src/widgets/search_options/search_string.ts
similarity index 100%
rename from src/public/app/widgets/search_options/search_string.ts
rename to apps/client/src/widgets/search_options/search_string.ts
diff --git a/src/public/app/widgets/search_result.ts b/apps/client/src/widgets/search_result.ts
similarity index 100%
rename from src/public/app/widgets/search_result.ts
rename to apps/client/src/widgets/search_result.ts
diff --git a/src/public/app/widgets/shared_info.ts b/apps/client/src/widgets/shared_info.ts
similarity index 100%
rename from src/public/app/widgets/shared_info.ts
rename to apps/client/src/widgets/shared_info.ts
diff --git a/src/public/app/widgets/shared_switch.ts b/apps/client/src/widgets/shared_switch.ts
similarity index 100%
rename from src/public/app/widgets/shared_switch.ts
rename to apps/client/src/widgets/shared_switch.ts
diff --git a/src/public/app/widgets/spacer.ts b/apps/client/src/widgets/spacer.ts
similarity index 100%
rename from src/public/app/widgets/spacer.ts
rename to apps/client/src/widgets/spacer.ts
diff --git a/src/public/app/widgets/sql_result.ts b/apps/client/src/widgets/sql_result.ts
similarity index 100%
rename from src/public/app/widgets/sql_result.ts
rename to apps/client/src/widgets/sql_result.ts
diff --git a/src/public/app/widgets/sql_table_schemas.ts b/apps/client/src/widgets/sql_table_schemas.ts
similarity index 100%
rename from src/public/app/widgets/sql_table_schemas.ts
rename to apps/client/src/widgets/sql_table_schemas.ts
diff --git a/src/public/app/widgets/switch.ts b/apps/client/src/widgets/switch.ts
similarity index 100%
rename from src/public/app/widgets/switch.ts
rename to apps/client/src/widgets/switch.ts
diff --git a/src/public/app/widgets/sync_status.ts b/apps/client/src/widgets/sync_status.ts
similarity index 100%
rename from src/public/app/widgets/sync_status.ts
rename to apps/client/src/widgets/sync_status.ts
diff --git a/src/public/app/widgets/tab_aware_widget.js b/apps/client/src/widgets/tab_aware_widget.js
similarity index 100%
rename from src/public/app/widgets/tab_aware_widget.js
rename to apps/client/src/widgets/tab_aware_widget.js
diff --git a/src/public/app/widgets/tab_row.ts b/apps/client/src/widgets/tab_row.ts
similarity index 100%
rename from src/public/app/widgets/tab_row.ts
rename to apps/client/src/widgets/tab_row.ts
diff --git a/src/public/app/widgets/template_switch.ts b/apps/client/src/widgets/template_switch.ts
similarity index 100%
rename from src/public/app/widgets/template_switch.ts
rename to apps/client/src/widgets/template_switch.ts
diff --git a/src/public/app/widgets/title_bar_buttons.ts b/apps/client/src/widgets/title_bar_buttons.ts
similarity index 100%
rename from src/public/app/widgets/title_bar_buttons.ts
rename to apps/client/src/widgets/title_bar_buttons.ts
diff --git a/src/public/app/widgets/toc.ts b/apps/client/src/widgets/toc.ts
similarity index 100%
rename from src/public/app/widgets/toc.ts
rename to apps/client/src/widgets/toc.ts
diff --git a/src/public/app/widgets/type_widgets/abstract_code_type_widget.ts b/apps/client/src/widgets/type_widgets/abstract_code_type_widget.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/abstract_code_type_widget.ts
rename to apps/client/src/widgets/type_widgets/abstract_code_type_widget.ts
diff --git a/src/public/app/widgets/type_widgets/abstract_split_type_widget.ts b/apps/client/src/widgets/type_widgets/abstract_split_type_widget.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/abstract_split_type_widget.ts
rename to apps/client/src/widgets/type_widgets/abstract_split_type_widget.ts
diff --git a/src/public/app/widgets/type_widgets/abstract_svg_split_type_widget.ts b/apps/client/src/widgets/type_widgets/abstract_svg_split_type_widget.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/abstract_svg_split_type_widget.ts
rename to apps/client/src/widgets/type_widgets/abstract_svg_split_type_widget.ts
diff --git a/src/public/app/widgets/type_widgets/abstract_text_type_widget.ts b/apps/client/src/widgets/type_widgets/abstract_text_type_widget.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/abstract_text_type_widget.ts
rename to apps/client/src/widgets/type_widgets/abstract_text_type_widget.ts
diff --git a/src/public/app/widgets/type_widgets/ai_chat.ts b/apps/client/src/widgets/type_widgets/ai_chat.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/ai_chat.ts
rename to apps/client/src/widgets/type_widgets/ai_chat.ts
diff --git a/src/public/app/widgets/type_widgets/attachment_detail.ts b/apps/client/src/widgets/type_widgets/attachment_detail.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/attachment_detail.ts
rename to apps/client/src/widgets/type_widgets/attachment_detail.ts
diff --git a/src/public/app/widgets/type_widgets/attachment_list.ts b/apps/client/src/widgets/type_widgets/attachment_list.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/attachment_list.ts
rename to apps/client/src/widgets/type_widgets/attachment_list.ts
diff --git a/src/public/app/widgets/type_widgets/book.ts b/apps/client/src/widgets/type_widgets/book.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/book.ts
rename to apps/client/src/widgets/type_widgets/book.ts
diff --git a/src/public/app/widgets/type_widgets/canvas.ts b/apps/client/src/widgets/type_widgets/canvas.ts
similarity index 99%
rename from src/public/app/widgets/type_widgets/canvas.ts
rename to apps/client/src/widgets/type_widgets/canvas.ts
index abaebd6922..3695859367 100644
--- a/src/public/app/widgets/type_widgets/canvas.ts
+++ b/apps/client/src/widgets/type_widgets/canvas.ts
@@ -2,7 +2,6 @@ import TypeWidget from "./type_widget.js";
import utils from "../../services/utils.js";
import linkService from "../../services/link.js";
import server from "../../services/server.js";
-import asset_path from "../../../../services/asset_path.js";
import type FNote from "../../entities/fnote.js";
import type { ExcalidrawElement, Theme } from "@excalidraw/excalidraw/element/types";
import type { AppState, BinaryFileData, ExcalidrawImperativeAPI, ExcalidrawProps, LibraryItem, SceneData } from "@excalidraw/excalidraw/types";
@@ -10,6 +9,7 @@ import type { JSX } from "react";
import type React from "react";
import type { Root } from "react-dom/client";
import "@excalidraw/excalidraw/index.css";
+import asset_path from "../../asset_path.js";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/ckeditor/config.spec.ts b/apps/client/src/widgets/type_widgets/ckeditor/config.spec.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/ckeditor/config.spec.ts
rename to apps/client/src/widgets/type_widgets/ckeditor/config.spec.ts
diff --git a/src/public/app/widgets/type_widgets/ckeditor/config.ts b/apps/client/src/widgets/type_widgets/ckeditor/config.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/ckeditor/config.ts
rename to apps/client/src/widgets/type_widgets/ckeditor/config.ts
diff --git a/src/public/app/widgets/type_widgets/ckeditor/syntax_highlight.ts b/apps/client/src/widgets/type_widgets/ckeditor/syntax_highlight.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/ckeditor/syntax_highlight.ts
rename to apps/client/src/widgets/type_widgets/ckeditor/syntax_highlight.ts
diff --git a/src/public/app/widgets/type_widgets/content/backend_log.ts b/apps/client/src/widgets/type_widgets/content/backend_log.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/content/backend_log.ts
rename to apps/client/src/widgets/type_widgets/content/backend_log.ts
diff --git a/src/public/app/widgets/type_widgets/content_widget.ts b/apps/client/src/widgets/type_widgets/content_widget.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/content_widget.ts
rename to apps/client/src/widgets/type_widgets/content_widget.ts
diff --git a/src/public/app/widgets/type_widgets/doc.ts b/apps/client/src/widgets/type_widgets/doc.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/doc.ts
rename to apps/client/src/widgets/type_widgets/doc.ts
diff --git a/src/public/app/widgets/type_widgets/editable_code.ts b/apps/client/src/widgets/type_widgets/editable_code.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/editable_code.ts
rename to apps/client/src/widgets/type_widgets/editable_code.ts
diff --git a/src/public/app/widgets/type_widgets/editable_text.ts b/apps/client/src/widgets/type_widgets/editable_text.ts
similarity index 99%
rename from src/public/app/widgets/type_widgets/editable_text.ts
rename to apps/client/src/widgets/type_widgets/editable_text.ts
index edefbcdcda..f8c85d1732 100644
--- a/src/public/app/widgets/type_widgets/editable_text.ts
+++ b/apps/client/src/widgets/type_widgets/editable_text.ts
@@ -276,7 +276,7 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
editor.model.document.on("change:data", () => this.spacedUpdate.scheduleUpdate());
if (glob.isDev && ENABLE_INSPECTOR) {
- //@ts-expect-error TODO: Check if this still works.
+ // TODO: Check if this still works.
await import(/* webpackIgnore: true */ "../../../libraries/ckeditor/inspector.js");
CKEditorInspector.attach(editor);
}
diff --git a/src/public/app/widgets/type_widgets/empty.ts b/apps/client/src/widgets/type_widgets/empty.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/empty.ts
rename to apps/client/src/widgets/type_widgets/empty.ts
diff --git a/src/public/app/widgets/type_widgets/file.ts b/apps/client/src/widgets/type_widgets/file.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/file.ts
rename to apps/client/src/widgets/type_widgets/file.ts
diff --git a/src/public/app/widgets/type_widgets/geo_map.ts b/apps/client/src/widgets/type_widgets/geo_map.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/geo_map.ts
rename to apps/client/src/widgets/type_widgets/geo_map.ts
diff --git a/src/public/app/widgets/type_widgets/geo_map_context_menu.ts b/apps/client/src/widgets/type_widgets/geo_map_context_menu.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/geo_map_context_menu.ts
rename to apps/client/src/widgets/type_widgets/geo_map_context_menu.ts
diff --git a/src/public/app/widgets/type_widgets/image.ts b/apps/client/src/widgets/type_widgets/image.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/image.ts
rename to apps/client/src/widgets/type_widgets/image.ts
diff --git a/src/public/app/widgets/type_widgets/linters/mermaid.spec.ts b/apps/client/src/widgets/type_widgets/linters/mermaid.spec.ts
similarity index 90%
rename from src/public/app/widgets/type_widgets/linters/mermaid.spec.ts
rename to apps/client/src/widgets/type_widgets/linters/mermaid.spec.ts
index 8567932982..638892d711 100644
--- a/src/public/app/widgets/type_widgets/linters/mermaid.spec.ts
+++ b/apps/client/src/widgets/type_widgets/linters/mermaid.spec.ts
@@ -1,5 +1,5 @@
-import { describe, expect, it, vi } from "vitest";
-import { trimIndentation } from "../../../../../../spec/support/utils.js";
+import { describe, expect, it } from "vitest";
+import { trimIndentation } from "@triliumnext/commons";
import { validateMermaid } from "./mermaid.js";
describe("Mermaid linter", () => {
diff --git a/src/public/app/widgets/type_widgets/linters/mermaid.ts b/apps/client/src/widgets/type_widgets/linters/mermaid.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/linters/mermaid.ts
rename to apps/client/src/widgets/type_widgets/linters/mermaid.ts
diff --git a/src/public/app/widgets/type_widgets/mermaid.ts b/apps/client/src/widgets/type_widgets/mermaid.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/mermaid.ts
rename to apps/client/src/widgets/type_widgets/mermaid.ts
diff --git a/src/public/app/widgets/type_widgets/mind_map.ts b/apps/client/src/widgets/type_widgets/mind_map.ts
similarity index 98%
rename from src/public/app/widgets/type_widgets/mind_map.ts
rename to apps/client/src/widgets/type_widgets/mind_map.ts
index 83af55f4ee..83d2e0e960 100644
--- a/src/public/app/widgets/type_widgets/mind_map.ts
+++ b/apps/client/src/widgets/type_widgets/mind_map.ts
@@ -1,6 +1,6 @@
import TypeWidget from "./type_widget.js";
import utils from "../../services/utils.js";
-import type { MindElixirCtor } from "mind-elixir";
+import type { MindElixirCtor, MindElixirInstance } from "mind-elixir";
import nodeMenu from "@mind-elixir/node-menu";
import type FNote from "../../entities/fnote.js";
import type { EventData } from "../../components/app_context.js";
@@ -152,7 +152,7 @@ export default class MindMapWidget extends TypeWidget {
private $content!: JQuery;
private triggeredByUserOperation?: boolean;
- private mind?: ReturnType;
+ private mind?: MindElixirInstance;
private MindElixir: any; // TODO: Fix type
static getType() {
diff --git a/src/public/app/widgets/type_widgets/none.ts b/apps/client/src/widgets/type_widgets/none.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/none.ts
rename to apps/client/src/widgets/type_widgets/none.ts
diff --git a/src/public/app/widgets/type_widgets/note_map.ts b/apps/client/src/widgets/type_widgets/note_map.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/note_map.ts
rename to apps/client/src/widgets/type_widgets/note_map.ts
diff --git a/src/public/app/widgets/type_widgets/options/advanced/database_anonymization.ts b/apps/client/src/widgets/type_widgets/options/advanced/database_anonymization.ts
similarity index 98%
rename from src/public/app/widgets/type_widgets/options/advanced/database_anonymization.ts
rename to apps/client/src/widgets/type_widgets/options/advanced/database_anonymization.ts
index 2726a489b8..edef0e4d40 100644
--- a/src/public/app/widgets/type_widgets/options/advanced/database_anonymization.ts
+++ b/apps/client/src/widgets/type_widgets/options/advanced/database_anonymization.ts
@@ -2,7 +2,7 @@ import OptionsWidget from "../options_widget.js";
import toastService from "../../../../services/toast.js";
import server from "../../../../services/server.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/advanced/database_integrity_check.ts b/apps/client/src/widgets/type_widgets/options/advanced/database_integrity_check.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/options/advanced/database_integrity_check.ts
rename to apps/client/src/widgets/type_widgets/options/advanced/database_integrity_check.ts
diff --git a/src/public/app/widgets/type_widgets/options/advanced/sync.ts b/apps/client/src/widgets/type_widgets/options/advanced/sync.ts
similarity index 94%
rename from src/public/app/widgets/type_widgets/options/advanced/sync.ts
rename to apps/client/src/widgets/type_widgets/options/advanced/sync.ts
index 39eee0f978..503ad1b3ab 100644
--- a/src/public/app/widgets/type_widgets/options/advanced/sync.ts
+++ b/apps/client/src/widgets/type_widgets/options/advanced/sync.ts
@@ -2,7 +2,7 @@ import OptionsWidget from "../options_widget.js";
import server from "../../../../services/server.js";
import toastService from "../../../../services/toast.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/advanced/vacuum_database.ts b/apps/client/src/widgets/type_widgets/options/advanced/vacuum_database.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/options/advanced/vacuum_database.ts
rename to apps/client/src/widgets/type_widgets/options/advanced/vacuum_database.ts
diff --git a/src/public/app/widgets/type_widgets/options/ai_settings.ts b/apps/client/src/widgets/type_widgets/options/ai_settings.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/options/ai_settings.ts
rename to apps/client/src/widgets/type_widgets/options/ai_settings.ts
diff --git a/src/public/app/widgets/type_widgets/options/ai_settings/ai_settings_widget.ts b/apps/client/src/widgets/type_widgets/options/ai_settings/ai_settings_widget.ts
similarity index 99%
rename from src/public/app/widgets/type_widgets/options/ai_settings/ai_settings_widget.ts
rename to apps/client/src/widgets/type_widgets/options/ai_settings/ai_settings_widget.ts
index 269b958ba1..8f76eac4b9 100644
--- a/src/public/app/widgets/type_widgets/options/ai_settings/ai_settings_widget.ts
+++ b/apps/client/src/widgets/type_widgets/options/ai_settings/ai_settings_widget.ts
@@ -1,7 +1,7 @@
import OptionsWidget from "../options_widget.js";
import { TPL } from "./template.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionDefinitions, OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionDefinitions, OptionMap } from "@triliumnext/commons";
import server from "../../../../services/server.js";
import toastService from "../../../../services/toast.js";
import type { EmbeddingStats, FailedEmbeddingNotes } from "./interfaces.js";
diff --git a/src/public/app/widgets/type_widgets/options/ai_settings/index.ts b/apps/client/src/widgets/type_widgets/options/ai_settings/index.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/options/ai_settings/index.ts
rename to apps/client/src/widgets/type_widgets/options/ai_settings/index.ts
diff --git a/src/public/app/widgets/type_widgets/options/ai_settings/interfaces.ts b/apps/client/src/widgets/type_widgets/options/ai_settings/interfaces.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/options/ai_settings/interfaces.ts
rename to apps/client/src/widgets/type_widgets/options/ai_settings/interfaces.ts
diff --git a/src/public/app/widgets/type_widgets/options/ai_settings/providers.ts b/apps/client/src/widgets/type_widgets/options/ai_settings/providers.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/options/ai_settings/providers.ts
rename to apps/client/src/widgets/type_widgets/options/ai_settings/providers.ts
diff --git a/src/public/app/widgets/type_widgets/options/ai_settings/template.ts b/apps/client/src/widgets/type_widgets/options/ai_settings/template.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/options/ai_settings/template.ts
rename to apps/client/src/widgets/type_widgets/options/ai_settings/template.ts
diff --git a/src/public/app/widgets/type_widgets/options/appearance/code_block.ts b/apps/client/src/widgets/type_widgets/options/appearance/code_block.ts
similarity index 98%
rename from src/public/app/widgets/type_widgets/options/appearance/code_block.ts
rename to apps/client/src/widgets/type_widgets/options/appearance/code_block.ts
index 2ed2210885..44182fdaef 100644
--- a/src/public/app/widgets/type_widgets/options/appearance/code_block.ts
+++ b/apps/client/src/widgets/type_widgets/options/appearance/code_block.ts
@@ -1,4 +1,4 @@
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
import { t } from "../../../../services/i18n.js";
import library_loader from "../../../../services/library_loader.js";
import server from "../../../../services/server.js";
diff --git a/src/public/app/widgets/type_widgets/options/appearance/electron_integration.ts b/apps/client/src/widgets/type_widgets/options/appearance/electron_integration.ts
similarity index 97%
rename from src/public/app/widgets/type_widgets/options/appearance/electron_integration.ts
rename to apps/client/src/widgets/type_widgets/options/appearance/electron_integration.ts
index 2a0181dd4e..b49a7503ba 100644
--- a/src/public/app/widgets/type_widgets/options/appearance/electron_integration.ts
+++ b/apps/client/src/widgets/type_widgets/options/appearance/electron_integration.ts
@@ -1,7 +1,7 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
import utils from "../../../../services/utils.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/appearance/fonts.ts b/apps/client/src/widgets/type_widgets/options/appearance/fonts.ts
similarity index 98%
rename from src/public/app/widgets/type_widgets/options/appearance/fonts.ts
rename to apps/client/src/widgets/type_widgets/options/appearance/fonts.ts
index d9f68f5b76..7d4fa3ce0d 100644
--- a/src/public/app/widgets/type_widgets/options/appearance/fonts.ts
+++ b/apps/client/src/widgets/type_widgets/options/appearance/fonts.ts
@@ -1,7 +1,7 @@
import OptionsWidget from "../options_widget.js";
import utils from "../../../../services/utils.js";
import { t } from "../../../../services/i18n.js";
-import type { FontFamily, OptionMap, OptionNames } from "../../../../../../services/options_interface.js";
+import type { FontFamily, OptionMap, OptionNames } from "@triliumnext/commons";
interface FontFamilyEntry {
value: FontFamily;
diff --git a/src/public/app/widgets/type_widgets/options/appearance/max_content_width.ts b/apps/client/src/widgets/type_widgets/options/appearance/max_content_width.ts
similarity index 95%
rename from src/public/app/widgets/type_widgets/options/appearance/max_content_width.ts
rename to apps/client/src/widgets/type_widgets/options/appearance/max_content_width.ts
index 7b6bccff15..1cf576034b 100644
--- a/src/public/app/widgets/type_widgets/options/appearance/max_content_width.ts
+++ b/apps/client/src/widgets/type_widgets/options/appearance/max_content_width.ts
@@ -1,7 +1,7 @@
import OptionsWidget from "../options_widget.js";
import utils from "../../../../services/utils.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const MIN_VALUE = 640;
diff --git a/src/public/app/widgets/type_widgets/options/appearance/ribbon.ts b/apps/client/src/widgets/type_widgets/options/appearance/ribbon.ts
similarity index 95%
rename from src/public/app/widgets/type_widgets/options/appearance/ribbon.ts
rename to apps/client/src/widgets/type_widgets/options/appearance/ribbon.ts
index 257dac0ee1..861410790c 100644
--- a/src/public/app/widgets/type_widgets/options/appearance/ribbon.ts
+++ b/apps/client/src/widgets/type_widgets/options/appearance/ribbon.ts
@@ -1,4 +1,4 @@
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
import { t } from "../../../../services/i18n.js";
import OptionsWidget from "../options_widget.js";
diff --git a/src/public/app/widgets/type_widgets/options/appearance/theme.ts b/apps/client/src/widgets/type_widgets/options/appearance/theme.ts
similarity index 98%
rename from src/public/app/widgets/type_widgets/options/appearance/theme.ts
rename to apps/client/src/widgets/type_widgets/options/appearance/theme.ts
index 17a88c3b64..a46408d780 100644
--- a/src/public/app/widgets/type_widgets/options/appearance/theme.ts
+++ b/apps/client/src/widgets/type_widgets/options/appearance/theme.ts
@@ -2,7 +2,7 @@ import OptionsWidget from "../options_widget.js";
import server from "../../../../services/server.js";
import utils from "../../../../services/utils.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/backup.ts b/apps/client/src/widgets/type_widgets/options/backup.ts
similarity index 98%
rename from src/public/app/widgets/type_widgets/options/backup.ts
rename to apps/client/src/widgets/type_widgets/options/backup.ts
index 808f91e92f..9fd79803fb 100644
--- a/src/public/app/widgets/type_widgets/options/backup.ts
+++ b/apps/client/src/widgets/type_widgets/options/backup.ts
@@ -3,7 +3,7 @@ import { t } from "../../../services/i18n.js";
import OptionsWidget from "./options_widget.js";
import server from "../../../services/server.js";
import toastService from "../../../services/toast.js";
-import type { OptionMap } from "../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/code_notes/code_auto_read_only_size.ts b/apps/client/src/widgets/type_widgets/options/code_notes/code_auto_read_only_size.ts
similarity index 93%
rename from src/public/app/widgets/type_widgets/options/code_notes/code_auto_read_only_size.ts
rename to apps/client/src/widgets/type_widgets/options/code_notes/code_auto_read_only_size.ts
index 17cd0bb350..b3b7bad0fb 100644
--- a/src/public/app/widgets/type_widgets/options/code_notes/code_auto_read_only_size.ts
+++ b/apps/client/src/widgets/type_widgets/options/code_notes/code_auto_read_only_size.ts
@@ -1,4 +1,4 @@
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
import { t } from "../../../../services/i18n.js";
import OptionsWidget from "../options_widget.js";
diff --git a/src/public/app/widgets/type_widgets/options/code_notes/code_editor.ts b/apps/client/src/widgets/type_widgets/options/code_notes/code_editor.ts
similarity index 95%
rename from src/public/app/widgets/type_widgets/options/code_notes/code_editor.ts
rename to apps/client/src/widgets/type_widgets/options/code_notes/code_editor.ts
index 728a58f81f..f99b12b503 100644
--- a/src/public/app/widgets/type_widgets/options/code_notes/code_editor.ts
+++ b/apps/client/src/widgets/type_widgets/options/code_notes/code_editor.ts
@@ -1,6 +1,6 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/code_notes/code_mime_types.ts b/apps/client/src/widgets/type_widgets/options/code_notes/code_mime_types.ts
similarity index 97%
rename from src/public/app/widgets/type_widgets/options/code_notes/code_mime_types.ts
rename to apps/client/src/widgets/type_widgets/options/code_notes/code_mime_types.ts
index b8250f67d1..7bb4ecac8e 100644
--- a/src/public/app/widgets/type_widgets/options/code_notes/code_mime_types.ts
+++ b/apps/client/src/widgets/type_widgets/options/code_notes/code_mime_types.ts
@@ -1,7 +1,7 @@
import { t } from "../../../../services/i18n.js";
import OptionsWidget from "../options_widget.js";
import mimeTypesService from "../../../../services/mime_types.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/etapi.ts b/apps/client/src/widgets/type_widgets/options/etapi.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/options/etapi.ts
rename to apps/client/src/widgets/type_widgets/options/etapi.ts
diff --git a/src/public/app/widgets/type_widgets/options/i18n/i18n.ts b/apps/client/src/widgets/type_widgets/options/i18n/i18n.ts
similarity index 98%
rename from src/public/app/widgets/type_widgets/options/i18n/i18n.ts
rename to apps/client/src/widgets/type_widgets/options/i18n/i18n.ts
index b75c99fc20..48fb295462 100644
--- a/src/public/app/widgets/type_widgets/options/i18n/i18n.ts
+++ b/apps/client/src/widgets/type_widgets/options/i18n/i18n.ts
@@ -2,8 +2,7 @@ import OptionsWidget from "../options_widget.js";
import server from "../../../../services/server.js";
import utils from "../../../../services/utils.js";
import { getAvailableLocales, t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
-import type { Locale } from "../../../../../../services/i18n.js";
+import type { OptionMap, Locale } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/i18n/language.ts b/apps/client/src/widgets/type_widgets/options/i18n/language.ts
similarity index 95%
rename from src/public/app/widgets/type_widgets/options/i18n/language.ts
rename to apps/client/src/widgets/type_widgets/options/i18n/language.ts
index 4ccf185503..7a10e0a153 100644
--- a/src/public/app/widgets/type_widgets/options/i18n/language.ts
+++ b/apps/client/src/widgets/type_widgets/options/i18n/language.ts
@@ -1,5 +1,5 @@
import OptionsWidget from "../options_widget.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
import { getAvailableLocales } from "../../../../services/i18n.js";
import { t } from "i18next";
diff --git a/src/public/app/widgets/type_widgets/options/images/images.ts b/apps/client/src/widgets/type_widgets/options/images/images.ts
similarity index 97%
rename from src/public/app/widgets/type_widgets/options/images/images.ts
rename to apps/client/src/widgets/type_widgets/options/images/images.ts
index da2005fefa..d74cd4b709 100644
--- a/src/public/app/widgets/type_widgets/options/images/images.ts
+++ b/apps/client/src/widgets/type_widgets/options/images/images.ts
@@ -1,6 +1,6 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/multi_factor_authentication.ts b/apps/client/src/widgets/type_widgets/options/multi_factor_authentication.ts
similarity index 99%
rename from src/public/app/widgets/type_widgets/options/multi_factor_authentication.ts
rename to apps/client/src/widgets/type_widgets/options/multi_factor_authentication.ts
index d75a6a7bcc..211a4941d9 100644
--- a/src/public/app/widgets/type_widgets/options/multi_factor_authentication.ts
+++ b/apps/client/src/widgets/type_widgets/options/multi_factor_authentication.ts
@@ -1,7 +1,7 @@
import server from "../../../services/server.js";
import toastService from "../../../services/toast.js";
import OptionsWidget from "./options_widget.js";
-import type { OptionMap } from "../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
import { t } from "../../../services/i18n.js";
import utils from "../../../services/utils.js";
import dialogService from "../../../services/dialog.js";
diff --git a/src/public/app/widgets/type_widgets/options/options_widget.ts b/apps/client/src/widgets/type_widgets/options/options_widget.ts
similarity index 98%
rename from src/public/app/widgets/type_widgets/options/options_widget.ts
rename to apps/client/src/widgets/type_widgets/options/options_widget.ts
index 5d614a42ec..331358995c 100644
--- a/src/public/app/widgets/type_widgets/options/options_widget.ts
+++ b/apps/client/src/widgets/type_widgets/options/options_widget.ts
@@ -1,4 +1,4 @@
-import type { FilterOptionsByType, OptionMap, OptionNames } from "../../../../../services/options_interface.js";
+import type { FilterOptionsByType, OptionMap, OptionNames } from "@triliumnext/commons";
import type { EventData, EventListener } from "../../../components/app_context.js";
import type FNote from "../../../entities/fnote.js";
import { t } from "../../../services/i18n.js";
diff --git a/src/public/app/widgets/type_widgets/options/other/attachment_erasure_timeout.ts b/apps/client/src/widgets/type_widgets/options/other/attachment_erasure_timeout.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/options/other/attachment_erasure_timeout.ts
rename to apps/client/src/widgets/type_widgets/options/other/attachment_erasure_timeout.ts
diff --git a/src/public/app/widgets/type_widgets/options/other/html_import_tags.ts b/apps/client/src/widgets/type_widgets/options/other/html_import_tags.ts
similarity index 97%
rename from src/public/app/widgets/type_widgets/options/other/html_import_tags.ts
rename to apps/client/src/widgets/type_widgets/options/other/html_import_tags.ts
index 61542ea621..5bb6269657 100644
--- a/src/public/app/widgets/type_widgets/options/other/html_import_tags.ts
+++ b/apps/client/src/widgets/type_widgets/options/other/html_import_tags.ts
@@ -1,6 +1,6 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
// TODO: Deduplicate with src/services/html_sanitizer once there is a commons project between client and server.
export const DEFAULT_ALLOWED_TAGS = [
diff --git a/src/public/app/widgets/type_widgets/options/other/network_connections.ts b/apps/client/src/widgets/type_widgets/options/other/network_connections.ts
similarity index 91%
rename from src/public/app/widgets/type_widgets/options/other/network_connections.ts
rename to apps/client/src/widgets/type_widgets/options/other/network_connections.ts
index 90f0bbb783..529b9959e9 100644
--- a/src/public/app/widgets/type_widgets/options/other/network_connections.ts
+++ b/apps/client/src/widgets/type_widgets/options/other/network_connections.ts
@@ -1,6 +1,6 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/other/note_erasure_timeout.ts b/apps/client/src/widgets/type_widgets/options/other/note_erasure_timeout.ts
similarity index 95%
rename from src/public/app/widgets/type_widgets/options/other/note_erasure_timeout.ts
rename to apps/client/src/widgets/type_widgets/options/other/note_erasure_timeout.ts
index 3438340062..96292ab37e 100644
--- a/src/public/app/widgets/type_widgets/options/other/note_erasure_timeout.ts
+++ b/apps/client/src/widgets/type_widgets/options/other/note_erasure_timeout.ts
@@ -2,7 +2,7 @@ import OptionsWidget from "../options_widget.js";
import server from "../../../../services/server.js";
import toastService from "../../../../services/toast.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
import TimeSelector from "../time_selector.js";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/other/revision_snapshots_limit.ts b/apps/client/src/widgets/type_widgets/options/other/revision_snapshots_limit.ts
similarity index 96%
rename from src/public/app/widgets/type_widgets/options/other/revision_snapshots_limit.ts
rename to apps/client/src/widgets/type_widgets/options/other/revision_snapshots_limit.ts
index 62781de9fe..55f7348186 100644
--- a/src/public/app/widgets/type_widgets/options/other/revision_snapshots_limit.ts
+++ b/apps/client/src/widgets/type_widgets/options/other/revision_snapshots_limit.ts
@@ -2,7 +2,7 @@ import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
import server from "../../../../services/server.js";
import toastService from "../../../../services/toast.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/other/revisions_snapshot_interval.ts b/apps/client/src/widgets/type_widgets/options/other/revisions_snapshot_interval.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/options/other/revisions_snapshot_interval.ts
rename to apps/client/src/widgets/type_widgets/options/other/revisions_snapshot_interval.ts
diff --git a/src/public/app/widgets/type_widgets/options/other/search_engine.ts b/apps/client/src/widgets/type_widgets/options/other/search_engine.ts
similarity index 97%
rename from src/public/app/widgets/type_widgets/options/other/search_engine.ts
rename to apps/client/src/widgets/type_widgets/options/other/search_engine.ts
index 345d3dc471..b512a3caeb 100644
--- a/src/public/app/widgets/type_widgets/options/other/search_engine.ts
+++ b/apps/client/src/widgets/type_widgets/options/other/search_engine.ts
@@ -1,7 +1,7 @@
import OptionsWidget from "../options_widget.js";
import utils from "../../../../services/utils.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/other/share_settings.ts b/apps/client/src/widgets/type_widgets/options/other/share_settings.ts
similarity index 97%
rename from src/public/app/widgets/type_widgets/options/other/share_settings.ts
rename to apps/client/src/widgets/type_widgets/options/other/share_settings.ts
index 1b1eba047a..7d51bb499f 100644
--- a/src/public/app/widgets/type_widgets/options/other/share_settings.ts
+++ b/apps/client/src/widgets/type_widgets/options/other/share_settings.ts
@@ -1,7 +1,7 @@
import OptionsWidget from "../options_widget.js";
import options from "../../../../services/options.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap, OptionNames } from "../../../../../../services/options_interface.js";
+import type { OptionMap, OptionNames } from "@triliumnext/commons";
import searchService from "../../../../services/search.js";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/other/tray.ts b/apps/client/src/widgets/type_widgets/options/other/tray.ts
similarity index 91%
rename from src/public/app/widgets/type_widgets/options/other/tray.ts
rename to apps/client/src/widgets/type_widgets/options/other/tray.ts
index e314dd777a..3760fe6d6c 100644
--- a/src/public/app/widgets/type_widgets/options/other/tray.ts
+++ b/apps/client/src/widgets/type_widgets/options/other/tray.ts
@@ -1,7 +1,7 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
import utils from "../../../../services/utils.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/password/password.ts b/apps/client/src/widgets/type_widgets/options/password/password.ts
similarity index 98%
rename from src/public/app/widgets/type_widgets/options/password/password.ts
rename to apps/client/src/widgets/type_widgets/options/password/password.ts
index e61f5e92a1..c23b3a7a03 100644
--- a/src/public/app/widgets/type_widgets/options/password/password.ts
+++ b/apps/client/src/widgets/type_widgets/options/password/password.ts
@@ -3,7 +3,7 @@ import server from "../../../../services/server.js";
import protectedSessionHolder from "../../../../services/protected_session_holder.js";
import toastService from "../../../../services/toast.js";
import OptionsWidget from "../options_widget.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/password/protected_session_timeout.ts b/apps/client/src/widgets/type_widgets/options/password/protected_session_timeout.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/options/password/protected_session_timeout.ts
rename to apps/client/src/widgets/type_widgets/options/password/protected_session_timeout.ts
diff --git a/src/public/app/widgets/type_widgets/options/shortcuts.ts b/apps/client/src/widgets/type_widgets/options/shortcuts.ts
similarity index 97%
rename from src/public/app/widgets/type_widgets/options/shortcuts.ts
rename to apps/client/src/widgets/type_widgets/options/shortcuts.ts
index c25cbebf4e..04d75262dc 100644
--- a/src/public/app/widgets/type_widgets/options/shortcuts.ts
+++ b/apps/client/src/widgets/type_widgets/options/shortcuts.ts
@@ -3,8 +3,7 @@ import utils from "../../../services/utils.js";
import dialogService from "../../../services/dialog.js";
import OptionsWidget from "./options_widget.js";
import { t } from "../../../services/i18n.js";
-import type { KeyboardShortcut } from "../../../../../services/keyboard_actions_interface.js";
-import type { OptionNames } from "../../../../../services/options_interface.js";
+import type { OptionNames, KeyboardShortcut } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/spellcheck.ts b/apps/client/src/widgets/type_widgets/options/spellcheck.ts
similarity index 96%
rename from src/public/app/widgets/type_widgets/options/spellcheck.ts
rename to apps/client/src/widgets/type_widgets/options/spellcheck.ts
index 87994909d3..43aca1c69a 100644
--- a/src/public/app/widgets/type_widgets/options/spellcheck.ts
+++ b/apps/client/src/widgets/type_widgets/options/spellcheck.ts
@@ -1,7 +1,7 @@
import utils from "../../../services/utils.js";
import OptionsWidget from "./options_widget.js";
import { t } from "../../../services/i18n.js";
-import type { OptionMap } from "../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL_WEB = `
diff --git a/src/public/app/widgets/type_widgets/options/sync.ts b/apps/client/src/widgets/type_widgets/options/sync.ts
similarity index 97%
rename from src/public/app/widgets/type_widgets/options/sync.ts
rename to apps/client/src/widgets/type_widgets/options/sync.ts
index f2be3f40db..0fd94a4f90 100644
--- a/src/public/app/widgets/type_widgets/options/sync.ts
+++ b/apps/client/src/widgets/type_widgets/options/sync.ts
@@ -2,7 +2,7 @@ import server from "../../../services/server.js";
import toastService from "../../../services/toast.js";
import OptionsWidget from "./options_widget.js";
import { t } from "../../../services/i18n.js";
-import type { OptionMap } from "../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/text_notes/editor.ts b/apps/client/src/widgets/type_widgets/options/text_notes/editor.ts
similarity index 96%
rename from src/public/app/widgets/type_widgets/options/text_notes/editor.ts
rename to apps/client/src/widgets/type_widgets/options/text_notes/editor.ts
index dc5ef53da0..d55a704a56 100644
--- a/src/public/app/widgets/type_widgets/options/text_notes/editor.ts
+++ b/apps/client/src/widgets/type_widgets/options/text_notes/editor.ts
@@ -1,4 +1,4 @@
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
import { t } from "../../../../services/i18n.js";
import utils from "../../../../services/utils.js";
import OptionsWidget from "../options_widget.js";
diff --git a/src/public/app/widgets/type_widgets/options/text_notes/heading_style.ts b/apps/client/src/widgets/type_widgets/options/text_notes/heading_style.ts
similarity index 95%
rename from src/public/app/widgets/type_widgets/options/text_notes/heading_style.ts
rename to apps/client/src/widgets/type_widgets/options/text_notes/heading_style.ts
index c45ce08cab..a82a57c509 100644
--- a/src/public/app/widgets/type_widgets/options/text_notes/heading_style.ts
+++ b/apps/client/src/widgets/type_widgets/options/text_notes/heading_style.ts
@@ -1,6 +1,6 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/text_notes/highlights_list.ts b/apps/client/src/widgets/type_widgets/options/text_notes/highlights_list.ts
similarity index 96%
rename from src/public/app/widgets/type_widgets/options/text_notes/highlights_list.ts
rename to apps/client/src/widgets/type_widgets/options/text_notes/highlights_list.ts
index 555cdf6eb6..b54bd635a7 100644
--- a/src/public/app/widgets/type_widgets/options/text_notes/highlights_list.ts
+++ b/apps/client/src/widgets/type_widgets/options/text_notes/highlights_list.ts
@@ -1,6 +1,6 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/text_notes/table_of_contents.ts b/apps/client/src/widgets/type_widgets/options/text_notes/table_of_contents.ts
similarity index 93%
rename from src/public/app/widgets/type_widgets/options/text_notes/table_of_contents.ts
rename to apps/client/src/widgets/type_widgets/options/text_notes/table_of_contents.ts
index 3ca0094260..aa20e6998b 100644
--- a/src/public/app/widgets/type_widgets/options/text_notes/table_of_contents.ts
+++ b/apps/client/src/widgets/type_widgets/options/text_notes/table_of_contents.ts
@@ -1,6 +1,6 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/text_notes/text_auto_read_only_size.ts b/apps/client/src/widgets/type_widgets/options/text_notes/text_auto_read_only_size.ts
similarity index 93%
rename from src/public/app/widgets/type_widgets/options/text_notes/text_auto_read_only_size.ts
rename to apps/client/src/widgets/type_widgets/options/text_notes/text_auto_read_only_size.ts
index f69db7a9e5..ef48abaaa8 100644
--- a/src/public/app/widgets/type_widgets/options/text_notes/text_auto_read_only_size.ts
+++ b/apps/client/src/widgets/type_widgets/options/text_notes/text_auto_read_only_size.ts
@@ -1,6 +1,6 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
diff --git a/src/public/app/widgets/type_widgets/options/time_selector.ts b/apps/client/src/widgets/type_widgets/options/time_selector.ts
similarity index 98%
rename from src/public/app/widgets/type_widgets/options/time_selector.ts
rename to apps/client/src/widgets/type_widgets/options/time_selector.ts
index 71115a45c9..b9de250142 100644
--- a/src/public/app/widgets/type_widgets/options/time_selector.ts
+++ b/apps/client/src/widgets/type_widgets/options/time_selector.ts
@@ -1,7 +1,7 @@
import OptionsWidget from "./options_widget.js";
import toastService from "../../../services/toast.js";
import { t } from "../../../services/i18n.js";
-import type { OptionDefinitions, OptionMap } from "../../../../../services/options_interface.js";
+import type { OptionDefinitions, OptionMap } from "@triliumnext/commons";
import optionsService from "../../../services/options.js";
type TimeSelectorConstructor = {
diff --git a/src/public/app/widgets/type_widgets/protected_session.ts b/apps/client/src/widgets/type_widgets/protected_session.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/protected_session.ts
rename to apps/client/src/widgets/type_widgets/protected_session.ts
diff --git a/src/public/app/widgets/type_widgets/read_only_code.ts b/apps/client/src/widgets/type_widgets/read_only_code.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/read_only_code.ts
rename to apps/client/src/widgets/type_widgets/read_only_code.ts
diff --git a/src/public/app/widgets/type_widgets/read_only_text.ts b/apps/client/src/widgets/type_widgets/read_only_text.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/read_only_text.ts
rename to apps/client/src/widgets/type_widgets/read_only_text.ts
diff --git a/src/public/app/widgets/type_widgets/relation_map.ts b/apps/client/src/widgets/type_widgets/relation_map.ts
similarity index 99%
rename from src/public/app/widgets/type_widgets/relation_map.ts
rename to apps/client/src/widgets/type_widgets/relation_map.ts
index 29a9b45244..b69c7a94e1 100644
--- a/src/public/app/widgets/type_widgets/relation_map.ts
+++ b/apps/client/src/widgets/type_widgets/relation_map.ts
@@ -11,7 +11,7 @@ import dialogService from "../../services/dialog.js";
import { t } from "../../services/i18n.js";
import type FNote from "../../entities/fnote.js";
import type { ConnectionMadeEventInfo, jsPlumbInstance, OverlaySpec } from "jsplumb";
-import "../../../stylesheets/relation_map.css";
+import "../../stylesheets/relation_map.css";
declare module "jsplumb" {
diff --git a/src/public/app/widgets/type_widgets/render.ts b/apps/client/src/widgets/type_widgets/render.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/render.ts
rename to apps/client/src/widgets/type_widgets/render.ts
diff --git a/src/public/app/widgets/type_widgets/type_widget.ts b/apps/client/src/widgets/type_widgets/type_widget.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/type_widget.ts
rename to apps/client/src/widgets/type_widgets/type_widget.ts
diff --git a/src/public/app/widgets/type_widgets/web_view.ts b/apps/client/src/widgets/type_widgets/web_view.ts
similarity index 100%
rename from src/public/app/widgets/type_widgets/web_view.ts
rename to apps/client/src/widgets/type_widgets/web_view.ts
diff --git a/src/public/app/widgets/view_widgets/calendar_view.spec.ts b/apps/client/src/widgets/view_widgets/calendar_view.spec.ts
similarity index 100%
rename from src/public/app/widgets/view_widgets/calendar_view.spec.ts
rename to apps/client/src/widgets/view_widgets/calendar_view.spec.ts
diff --git a/src/public/app/widgets/view_widgets/calendar_view.ts b/apps/client/src/widgets/view_widgets/calendar_view.ts
similarity index 100%
rename from src/public/app/widgets/view_widgets/calendar_view.ts
rename to apps/client/src/widgets/view_widgets/calendar_view.ts
diff --git a/src/public/app/widgets/view_widgets/list_or_grid_view.ts b/apps/client/src/widgets/view_widgets/list_or_grid_view.ts
similarity index 100%
rename from src/public/app/widgets/view_widgets/list_or_grid_view.ts
rename to apps/client/src/widgets/view_widgets/list_or_grid_view.ts
diff --git a/src/public/app/widgets/view_widgets/view_mode.ts b/apps/client/src/widgets/view_widgets/view_mode.ts
similarity index 100%
rename from src/public/app/widgets/view_widgets/view_mode.ts
rename to apps/client/src/widgets/view_widgets/view_mode.ts
diff --git a/src/public/app/widgets/watched_file_update_status.ts b/apps/client/src/widgets/watched_file_update_status.ts
similarity index 100%
rename from src/public/app/widgets/watched_file_update_status.ts
rename to apps/client/src/widgets/watched_file_update_status.ts
diff --git a/apps/client/tsconfig.app.json b/apps/client/tsconfig.app.json
new file mode 100644
index 0000000000..9e8846a132
--- /dev/null
+++ b/apps/client/tsconfig.app.json
@@ -0,0 +1,41 @@
+{
+ "extends": "../../tsconfig.base.json",
+ "compilerOptions": {
+ "outDir": "dist",
+ "types": [
+ "node"
+ ],
+ "rootDir": "src",
+ "module": "esnext",
+ "moduleResolution": "bundler",
+ "tsBuildInfoFile": "dist/tsconfig.app.tsbuildinfo"
+ },
+ "exclude": [
+ "out-tsc",
+ "dist",
+ "jest.config.ts",
+ "src/**/*.spec.ts",
+ "src/**/*.test.ts",
+ "vite.config.ts",
+ "vite.config.mts",
+ "vitest.config.ts",
+ "vitest.config.mts",
+ "src/**/*.test.tsx",
+ "src/**/*.spec.tsx",
+ "src/**/*.test.js",
+ "src/**/*.spec.js",
+ "src/**/*.test.jsx",
+ "src/**/*.spec.jsx",
+ "eslint.config.js",
+ "eslint.config.cjs",
+ "eslint.config.mjs"
+ ],
+ "include": [
+ "src/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../../packages/commons/tsconfig.lib.json"
+ }
+ ]
+}
diff --git a/apps/client/tsconfig.json b/apps/client/tsconfig.json
new file mode 100644
index 0000000000..49b4056c20
--- /dev/null
+++ b/apps/client/tsconfig.json
@@ -0,0 +1,16 @@
+{
+ "extends": "../../tsconfig.base.json",
+ "files": [],
+ "include": [],
+ "references": [
+ {
+ "path": "../../packages/commons"
+ },
+ {
+ "path": "./tsconfig.app.json"
+ },
+ {
+ "path": "./tsconfig.spec.json"
+ }
+ ]
+}
diff --git a/apps/client/tsconfig.spec.json b/apps/client/tsconfig.spec.json
new file mode 100644
index 0000000000..1647759691
--- /dev/null
+++ b/apps/client/tsconfig.spec.json
@@ -0,0 +1,35 @@
+{
+ "extends": "../../tsconfig.base.json",
+ "compilerOptions": {
+ "outDir": "./out-tsc/vitest",
+ "types": [
+ "vitest/globals",
+ "vitest/importMeta",
+ "vite/client",
+ "node",
+ "vitest"
+ ],
+ "module": "esnext",
+ "moduleResolution": "bundler"
+ },
+ "include": [
+ "vite.config.ts",
+ "vite.config.mts",
+ "vitest.config.ts",
+ "vitest.config.mts",
+ "src/**/*.test.ts",
+ "src/**/*.spec.ts",
+ "src/**/*.test.tsx",
+ "src/**/*.spec.tsx",
+ "src/**/*.test.js",
+ "src/**/*.spec.js",
+ "src/**/*.test.jsx",
+ "src/**/*.spec.jsx",
+ "src/**/*.d.ts"
+ ],
+ "references": [
+ {
+ "path": "./tsconfig.app.json"
+ }
+ ]
+}
diff --git a/apps/client/vite.config.ts b/apps/client/vite.config.ts
new file mode 100644
index 0000000000..de26df7e9a
--- /dev/null
+++ b/apps/client/vite.config.ts
@@ -0,0 +1,20 @@
+
+import { defineConfig } from 'vite';
+
+export default defineConfig(() => ({
+ root: __dirname,
+ cacheDir: '../../node_modules/.vite/apps/client',
+ plugins: [],
+ test: {
+ watch: false,
+ globals: true,
+ setupFiles: ["./src/test/setup.ts"],
+ environment: "happy-dom",
+ include: ["src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
+ reporters: ["default"],
+ coverage: {
+ reportsDirectory: './test-output/vitest/coverage',
+ provider: 'v8' as const,
+ }
+ },
+}));
diff --git a/apps/client/webpack.config.js b/apps/client/webpack.config.js
new file mode 100644
index 0000000000..53d143f138
--- /dev/null
+++ b/apps/client/webpack.config.js
@@ -0,0 +1,80 @@
+
+const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
+const { join } = require('path');
+
+module.exports = {
+ output: {
+ path: join(__dirname, 'dist'),
+ },
+ devServer: {
+ port: 4200,
+ client: {
+ overlay: {
+ errors: true,
+ warnings: false,
+ runtimeErrors: true
+ }
+ }
+ },
+ plugins: [
+ new NxAppWebpackPlugin({
+ tsConfig: './tsconfig.app.json',
+ compiler: 'swc',
+ main: "./src/index.ts",
+ additionalEntryPoints: [
+ {
+ entryName: "desktop",
+ entryPath: "./src/desktop.ts"
+ },
+ {
+ entryName: "mobile",
+ entryPath: "./src/mobile.ts"
+ },
+ {
+ entryName: "login",
+ entryPath: "./src/login.ts"
+ },
+ {
+ entryName: "setup",
+ entryPath: "./src/setup.ts"
+ },
+ {
+ entryName: "share",
+ entryPath: "./src/share.ts"
+ },
+ {
+ // TriliumNextTODO: integrate set_password into setup entry point/view
+ entryName: "set_password",
+ entryPath: "./src/set_password.ts"
+ }
+ ],
+ externalDependencies: [
+ "electron"
+ ],
+ baseHref: '/',
+ assets: [
+ "./src/assets",
+ "./src/stylesheets",
+ "./src/libraries",
+ "./src/fonts",
+ "./src/translations"
+ ],
+ styles: [],
+ stylePreprocessorOptions: {
+ sassOptions: {
+ quietDeps: true
+ }
+ },
+ outputHashing: false,
+ optimization: process.env['NODE_ENV'] === 'production',
+ })
+ ],
+ resolve: {
+ fallback: {
+ path: false,
+ fs: false,
+ util: false
+ }
+ }
+};
+
diff --git a/apps/desktop-e2e/.spec.swcrc b/apps/desktop-e2e/.spec.swcrc
new file mode 100644
index 0000000000..3b52a5376b
--- /dev/null
+++ b/apps/desktop-e2e/.spec.swcrc
@@ -0,0 +1,22 @@
+{
+ "jsc": {
+ "target": "es2017",
+ "parser": {
+ "syntax": "typescript",
+ "decorators": true,
+ "dynamicImport": true
+ },
+ "transform": {
+ "decoratorMetadata": true,
+ "legacyDecorator": true
+ },
+ "keepClassNames": true,
+ "externalHelpers": true,
+ "loose": true
+ },
+ "module": {
+ "type": "es6"
+ },
+ "sourceMaps": true,
+ "exclude": []
+}
diff --git a/apps/desktop-e2e/eslint.config.mjs b/apps/desktop-e2e/eslint.config.mjs
new file mode 100644
index 0000000000..724052a2e2
--- /dev/null
+++ b/apps/desktop-e2e/eslint.config.mjs
@@ -0,0 +1,5 @@
+import baseConfig from "../../eslint.config.mjs";
+
+export default [
+ ...baseConfig
+];
diff --git a/apps/desktop-e2e/jest.config.ts b/apps/desktop-e2e/jest.config.ts
new file mode 100644
index 0000000000..25564ee814
--- /dev/null
+++ b/apps/desktop-e2e/jest.config.ts
@@ -0,0 +1,24 @@
+/* eslint-disable */
+import { readFileSync } from 'fs';
+
+// Reading the SWC compilation config for the spec files
+const swcJestConfig = JSON.parse(
+ readFileSync(`${__dirname}/.spec.swcrc`, 'utf-8')
+);
+
+// Disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves
+swcJestConfig.swcrc = false;
+
+export default {
+ displayName: '@triliumnext/desktop-e2e',
+ preset: '../../jest.preset.js',
+ globalSetup: '/src/support/global-setup.ts',
+ globalTeardown: '/src/support/global-teardown.ts',
+ setupFiles: ['/src/support/test-setup.ts'],
+ testEnvironment: 'node',
+ transform: {
+ '^.+\\.[tj]s$': ['@swc/jest', swcJestConfig],
+ },
+ moduleFileExtensions: ['ts', 'js', 'html'],
+ coverageDirectory: 'test-output/jest/coverage',
+};
diff --git a/apps/desktop-e2e/package.json b/apps/desktop-e2e/package.json
new file mode 100644
index 0000000000..37556fa95c
--- /dev/null
+++ b/apps/desktop-e2e/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "@triliumnext/desktop-e2e",
+ "version": "0.0.1",
+ "private": true,
+ "nx": {
+ "implicitDependencies": [
+ "@triliumnext/desktop"
+ ],
+ "targets": {
+ "e2e": {
+ "executor": "@nx/jest:jest",
+ "outputs": [
+ "{projectRoot}/test-output/jest/coverage"
+ ],
+ "options": {
+ "jestConfig": "apps/desktop-e2e/jest.config.ts",
+ "passWithNoTests": true
+ },
+ "dependsOn": [
+ "@triliumnext/desktop:build"
+ ]
+ }
+ }
+ }
+}
diff --git a/apps/desktop-e2e/src/desktop/desktop.spec.ts b/apps/desktop-e2e/src/desktop/desktop.spec.ts
new file mode 100644
index 0000000000..52572d00fd
--- /dev/null
+++ b/apps/desktop-e2e/src/desktop/desktop.spec.ts
@@ -0,0 +1,10 @@
+import axios from 'axios';
+
+describe('GET /', () => {
+ it('should return a message', async () => {
+ const res = await axios.get(`/`);
+
+ expect(res.status).toBe(200);
+ expect(res.data).toEqual({ message: 'Hello API' });
+ });
+})
diff --git a/apps/desktop-e2e/src/support/global-setup.ts b/apps/desktop-e2e/src/support/global-setup.ts
new file mode 100644
index 0000000000..d18e0f2947
--- /dev/null
+++ b/apps/desktop-e2e/src/support/global-setup.ts
@@ -0,0 +1,11 @@
+/* eslint-disable */
+var __TEARDOWN_MESSAGE__: string;
+
+module.exports = async function() {
+ // Start services that that the app needs to run (e.g. database, docker-compose, etc.).
+ console.log('\nSetting up...\n');
+
+ // Hint: Use `globalThis` to pass variables to global teardown.
+ globalThis.__TEARDOWN_MESSAGE__ = '\nTearing down...\n';
+};
+
diff --git a/apps/desktop-e2e/src/support/global-teardown.ts b/apps/desktop-e2e/src/support/global-teardown.ts
new file mode 100644
index 0000000000..67746cebd3
--- /dev/null
+++ b/apps/desktop-e2e/src/support/global-teardown.ts
@@ -0,0 +1,7 @@
+/* eslint-disable */
+
+module.exports = async function() {
+ // Put clean up logic here (e.g. stopping services, docker-compose, etc.).
+ // Hint: `globalThis` is shared between setup and teardown.
+ console.log(globalThis.__TEARDOWN_MESSAGE__);
+};
diff --git a/apps/desktop-e2e/src/support/test-setup.ts b/apps/desktop-e2e/src/support/test-setup.ts
new file mode 100644
index 0000000000..c803356a28
--- /dev/null
+++ b/apps/desktop-e2e/src/support/test-setup.ts
@@ -0,0 +1,9 @@
+/* eslint-disable */
+import axios from 'axios';
+
+module.exports = async function() {
+ // Configure axios for tests to use.
+ const host = process.env.HOST ?? 'localhost';
+ const port = process.env.PORT ?? '3000';
+ axios.defaults.baseURL = `http://${host}:${port}`;
+};
diff --git a/apps/desktop-e2e/tsconfig.json b/apps/desktop-e2e/tsconfig.json
new file mode 100644
index 0000000000..2e98c0f609
--- /dev/null
+++ b/apps/desktop-e2e/tsconfig.json
@@ -0,0 +1,14 @@
+{
+ "extends": "../../tsconfig.base.json",
+ "compilerOptions": {
+ "outDir": "out-tsc/@triliumnext/desktop-e2e",
+ "esModuleInterop": true,
+ "noUnusedLocals": false,
+ "noImplicitAny": false
+ },
+ "include": [
+ "jest.config.ts",
+ "src/**/*.ts"
+ ],
+ "references": []
+}
diff --git a/apps/desktop/.env b/apps/desktop/.env
new file mode 100644
index 0000000000..b83a6e3d3a
--- /dev/null
+++ b/apps/desktop/.env
@@ -0,0 +1 @@
+TRILIUM_PORT=37741
\ No newline at end of file
diff --git a/apps/desktop/.npmrc b/apps/desktop/.npmrc
new file mode 100644
index 0000000000..1d6a0d53cb
--- /dev/null
+++ b/apps/desktop/.npmrc
@@ -0,0 +1 @@
+node-linker = hoisted
\ No newline at end of file
diff --git a/apps/desktop/.swcrc b/apps/desktop/.swcrc
new file mode 100644
index 0000000000..a2d5b04f47
--- /dev/null
+++ b/apps/desktop/.swcrc
@@ -0,0 +1,8 @@
+{
+ "jsc": {
+ "parser": {
+ "syntax": "typescript"
+ },
+ "target": "es2016"
+ }
+}
diff --git a/images/app-icons/icon.icns b/apps/desktop/electron-forge/app-icon/icon.icns
similarity index 100%
rename from images/app-icons/icon.icns
rename to apps/desktop/electron-forge/app-icon/icon.icns
diff --git a/images/app-icons/icon.ico b/apps/desktop/electron-forge/app-icon/icon.ico
similarity index 100%
rename from images/app-icons/icon.ico
rename to apps/desktop/electron-forge/app-icon/icon.ico
diff --git a/images/app-icons/ios/apple-touch-icon.png b/apps/desktop/electron-forge/app-icon/ios/apple-touch-icon.png
similarity index 100%
rename from images/app-icons/ios/apple-touch-icon.png
rename to apps/desktop/electron-forge/app-icon/ios/apple-touch-icon.png
diff --git a/images/app-icons/png/1000x1000.png b/apps/desktop/electron-forge/app-icon/png/1000x1000.png
similarity index 100%
rename from images/app-icons/png/1000x1000.png
rename to apps/desktop/electron-forge/app-icon/png/1000x1000.png
diff --git a/images/app-icons/png/1024x1024.png b/apps/desktop/electron-forge/app-icon/png/1024x1024.png
similarity index 100%
rename from images/app-icons/png/1024x1024.png
rename to apps/desktop/electron-forge/app-icon/png/1024x1024.png
diff --git a/images/app-icons/png/128x128.png b/apps/desktop/electron-forge/app-icon/png/128x128.png
similarity index 100%
rename from images/app-icons/png/128x128.png
rename to apps/desktop/electron-forge/app-icon/png/128x128.png
diff --git a/images/app-icons/png/16x16-dev.png b/apps/desktop/electron-forge/app-icon/png/16x16-dev.png
similarity index 100%
rename from images/app-icons/png/16x16-dev.png
rename to apps/desktop/electron-forge/app-icon/png/16x16-dev.png
diff --git a/images/app-icons/png/16x16.png b/apps/desktop/electron-forge/app-icon/png/16x16.png
similarity index 100%
rename from images/app-icons/png/16x16.png
rename to apps/desktop/electron-forge/app-icon/png/16x16.png
diff --git a/images/app-icons/png/256x256-dev.png b/apps/desktop/electron-forge/app-icon/png/256x256-dev.png
similarity index 100%
rename from images/app-icons/png/256x256-dev.png
rename to apps/desktop/electron-forge/app-icon/png/256x256-dev.png
diff --git a/images/app-icons/png/256x256.png b/apps/desktop/electron-forge/app-icon/png/256x256.png
similarity index 100%
rename from images/app-icons/png/256x256.png
rename to apps/desktop/electron-forge/app-icon/png/256x256.png
diff --git a/images/app-icons/png/32x32-dev.png b/apps/desktop/electron-forge/app-icon/png/32x32-dev.png
similarity index 100%
rename from images/app-icons/png/32x32-dev.png
rename to apps/desktop/electron-forge/app-icon/png/32x32-dev.png
diff --git a/images/app-icons/png/32x32.png b/apps/desktop/electron-forge/app-icon/png/32x32.png
similarity index 100%
rename from images/app-icons/png/32x32.png
rename to apps/desktop/electron-forge/app-icon/png/32x32.png
diff --git a/images/app-icons/png/512x512.png b/apps/desktop/electron-forge/app-icon/png/512x512.png
similarity index 100%
rename from images/app-icons/png/512x512.png
rename to apps/desktop/electron-forge/app-icon/png/512x512.png
diff --git a/bin/electron-forge/desktop.ejs b/apps/desktop/electron-forge/desktop.ejs
similarity index 100%
rename from bin/electron-forge/desktop.ejs
rename to apps/desktop/electron-forge/desktop.ejs
diff --git a/forge.config.cjs b/apps/desktop/electron-forge/forge.config.cjs
similarity index 66%
rename from forge.config.cjs
rename to apps/desktop/electron-forge/forge.config.cjs
index dff7ac8064..3f81bb4778 100644
--- a/forge.config.cjs
+++ b/apps/desktop/electron-forge/forge.config.cjs
@@ -1,61 +1,49 @@
const path = require("path");
const fs = require("fs-extra");
-const { execSync } = require("child_process");
-const APP_NAME = "TriliumNext Notes";
-const BIN_PATH = path.normalize("./bin/electron-forge");
+const ELECTRON_FORGE_DIR = __dirname;
+
+const EXECUTABLE_NAME = "trilium"; // keep in sync with server's package.json -> packagerConfig.executableName
+const PRODUCT_NAME = "TriliumNext Notes";
+const APP_ICON_PATH = path.join(ELECTRON_FORGE_DIR, "app-icon");
const extraResourcesForPlatform = getExtraResourcesForPlatform();
const baseLinuxMakerConfigOptions = {
- icon: "./images/app-icons/png/128x128.png",
- desktopTemplate: path.resolve(path.join(BIN_PATH, "desktop.ejs")),
+ name: EXECUTABLE_NAME,
+ bin: EXECUTABLE_NAME,
+ productName: PRODUCT_NAME,
+ icon: path.join(APP_ICON_PATH, "png/128x128.png"),
+ desktopTemplate: path.resolve(path.join(ELECTRON_FORGE_DIR, "desktop.ejs")),
categories: ["Office", "Utility"]
};
const windowsSignConfiguration = process.env.WINDOWS_SIGN_EXECUTABLE ? {
- hookModulePath: path.join(BIN_PATH, "sign-windows.cjs")
+ hookModulePath: path.join(ELECTRON_FORGE_DIR, "sign-windows.cjs")
+} : undefined;
+const macosSignConfiguration = process.env.APPLE_ID ? {
+ osxSign: {},
+ osxNotarize: {
+ appleId: process.env.APPLE_ID,
+ appleIdPassword: process.env.APPLE_ID_PASSWORD,
+ teamId: process.env.APPLE_TEAM_ID
+ }
} : undefined;
module.exports = {
- // we run electron-forge inside the ./build folder,
- // to have it output to ./dist, we need to go up a directory first
- outDir: "../dist",
+ outDir: "out",
+ // Documentation of `packagerConfig` options: https://electron.github.io/packager/main/interfaces/Options.html
packagerConfig: {
- executableName: "trilium",
- name: APP_NAME,
+ executableName: EXECUTABLE_NAME,
+ name: PRODUCT_NAME,
overwrite: true,
asar: true,
- icon: "./images/app-icons/icon",
- osxSign: {},
- osxNotarize: {
- appleId: process.env.APPLE_ID,
- appleIdPassword: process.env.APPLE_ID_PASSWORD,
- teamId: process.env.APPLE_TEAM_ID
- },
+ icon: path.join(APP_ICON_PATH, "icon"),
+ ...macosSignConfiguration,
windowsSign: windowsSignConfiguration,
extraResource: [
// All resources should stay in Resources directory for macOS
- ...(process.platform === "darwin" ? [] : extraResourcesForPlatform),
-
- // These always go in Resources
- "translations/",
- "node_modules/@highlightjs/cdn-assets/styles"
- ],
- afterPrune: [
- (buildPath, _electronVersion, _platform, _arch, callback) => {
- // buildPath is a temporary directory that electron-packager creates - it's in the form of
- // /tmp/electron-packager/tmp-SjJl0s/resources/app
- try {
- const cleanupNodeModulesScript = path.join(buildPath, "bin", "cleanupNodeModules.ts");
- // we don't have access to any devDeps like 'tsx' here, so use the built-in '--experimental-strip-types' flag instead
- const command = `node --experimental-strip-types ${cleanupNodeModulesScript} "${buildPath}" --skip-prune-dev-deps`;
- // execSync throws, if above returns any non-zero exit code
- execSync(command);
- callback()
- } catch(err) {
- callback(err)
- }
- }
+ ...(process.platform === "darwin" ? [] : extraResourcesForPlatform)
],
+ prune: false,
afterComplete: [
(buildPath, _electronVersion, platform, _arch, callback) => {
// Only move resources on non-macOS platforms
@@ -80,15 +68,14 @@ module.exports = {
]
},
rebuildConfig: {
- force: true
+ force: true,
+ extraModules: [ "better-sqlite3" ]
},
makers: [
{
name: "@electron-forge/maker-deb",
config: {
- options: {
- ...baseLinuxMakerConfigOptions
- }
+ options: baseLinuxMakerConfigOptions
}
},
{
@@ -117,24 +104,24 @@ module.exports = {
{
name: "@electron-forge/maker-rpm",
config: {
- options: {
- ...baseLinuxMakerConfigOptions
- }
+ options: baseLinuxMakerConfigOptions
}
},
{
name: "@electron-forge/maker-squirrel",
config: {
+ name: EXECUTABLE_NAME,
+ productName: PRODUCT_NAME,
iconUrl: "https://raw.githubusercontent.com/TriliumNext/Notes/develop/images/app-icons/icon.ico",
- setupIcon: "./images/app-icons/win/setup.ico",
- loadingGif: "./images/app-icons/win/setup-banner.gif",
+ setupIcon: path.join(ELECTRON_FORGE_DIR, "setup-icon/setup.ico"),
+ loadingGif: path.join(ELECTRON_FORGE_DIR, "setup-icon/setup-banner.gif"),
windowsSign: windowsSignConfiguration
}
},
{
name: "@electron-forge/maker-dmg",
config: {
- icon: "./images/app-icons/icon.icns"
+ icon: path.join(APP_ICON_PATH, "icon.icns")
}
},
{
@@ -142,7 +129,7 @@ module.exports = {
config: {
options: {
iconUrl: "https://raw.githubusercontent.com/TriliumNext/Notes/develop/images/app-icons/icon.ico",
- icon: "./images/app-icons/icon.ico"
+ icon: path.join(APP_ICON_PATH, "icon.ico")
}
}
}
@@ -184,18 +171,18 @@ module.exports = {
function getExtraResourcesForPlatform() {
const resources = [];
- const getScriptRessources = () => {
+ const getScriptResources = () => {
const scripts = ["trilium-portable", "trilium-safe-mode", "trilium-no-cert-check"];
const scriptExt = (process.platform === "win32") ? "bat" : "sh";
- return scripts.map(script => `./bin/tpl/${script}.${scriptExt}`);
+ return scripts.map(script => `electron-forge/${script}.${scriptExt}`);
}
switch (process.platform) {
case "win32":
- resources.push(...getScriptRessources())
+ resources.push(...getScriptResources())
break;
case "linux":
- resources.push(...getScriptRessources(), "images/app-icons/png/256x256.png");
+ resources.push(...getScriptResources(), path.join(APP_ICON_PATH, "png/256x256.png"));
break;
default:
break;
diff --git a/images/app-icons/win/setup-banner.gif b/apps/desktop/electron-forge/setup-icon/setup-banner.gif
similarity index 100%
rename from images/app-icons/win/setup-banner.gif
rename to apps/desktop/electron-forge/setup-icon/setup-banner.gif
diff --git a/images/app-icons/win/setup.ico b/apps/desktop/electron-forge/setup-icon/setup.ico
similarity index 100%
rename from images/app-icons/win/setup.ico
rename to apps/desktop/electron-forge/setup-icon/setup.ico
diff --git a/bin/electron-forge/sign-windows.cjs b/apps/desktop/electron-forge/sign-windows.cjs
similarity index 67%
rename from bin/electron-forge/sign-windows.cjs
rename to apps/desktop/electron-forge/sign-windows.cjs
index 527a27dc68..caa64dbc69 100644
--- a/bin/electron-forge/sign-windows.cjs
+++ b/apps/desktop/electron-forge/sign-windows.cjs
@@ -1,8 +1,12 @@
const child_process = require("child_process");
+const fs = require("fs");
module.exports = function (filePath) {
const { WINDOWS_SIGN_EXECUTABLE } = process.env;
+ const stats = fs.lstatSync(filePath);
+ console.log(filePath, stats);
+
if (!WINDOWS_SIGN_EXECUTABLE) {
console.warn("[Sign] Skip signing due to missing environment variable.");
return;
@@ -10,5 +14,7 @@ module.exports = function (filePath) {
const command = `${WINDOWS_SIGN_EXECUTABLE} --executable "${filePath}"`;
console.log(`[Sign] ${command}`);
- child_process.execSync(command);
+
+ const output = child_process.execSync(command);
+ console.log(`[Sign] ${output}`);
}
\ No newline at end of file
diff --git a/bin/tpl/trilium-no-cert-check.bat b/apps/desktop/electron-forge/trilium-no-cert-check.bat
similarity index 100%
rename from bin/tpl/trilium-no-cert-check.bat
rename to apps/desktop/electron-forge/trilium-no-cert-check.bat
diff --git a/bin/tpl/trilium-no-cert-check.sh b/apps/desktop/electron-forge/trilium-no-cert-check.sh
similarity index 100%
rename from bin/tpl/trilium-no-cert-check.sh
rename to apps/desktop/electron-forge/trilium-no-cert-check.sh
diff --git a/bin/tpl/trilium-portable.bat b/apps/desktop/electron-forge/trilium-portable.bat
similarity index 100%
rename from bin/tpl/trilium-portable.bat
rename to apps/desktop/electron-forge/trilium-portable.bat
diff --git a/bin/tpl/trilium-portable.sh b/apps/desktop/electron-forge/trilium-portable.sh
old mode 100755
new mode 100644
similarity index 100%
rename from bin/tpl/trilium-portable.sh
rename to apps/desktop/electron-forge/trilium-portable.sh
diff --git a/bin/tpl/trilium-safe-mode.bat b/apps/desktop/electron-forge/trilium-safe-mode.bat
similarity index 100%
rename from bin/tpl/trilium-safe-mode.bat
rename to apps/desktop/electron-forge/trilium-safe-mode.bat
diff --git a/bin/tpl/trilium-safe-mode.sh b/apps/desktop/electron-forge/trilium-safe-mode.sh
similarity index 100%
rename from bin/tpl/trilium-safe-mode.sh
rename to apps/desktop/electron-forge/trilium-safe-mode.sh
diff --git a/apps/desktop/eslint.config.mjs b/apps/desktop/eslint.config.mjs
new file mode 100644
index 0000000000..724052a2e2
--- /dev/null
+++ b/apps/desktop/eslint.config.mjs
@@ -0,0 +1,5 @@
+import baseConfig from "../../eslint.config.mjs";
+
+export default [
+ ...baseConfig
+];
diff --git a/apps/desktop/package.json b/apps/desktop/package.json
new file mode 100644
index 0000000000..30faee0235
--- /dev/null
+++ b/apps/desktop/package.json
@@ -0,0 +1,78 @@
+{
+ "name": "@triliumnext/desktop",
+ "version": "0.0.1",
+ "private": true,
+ "main": "main.js",
+ "dependencies": {
+ "@electron/remote": "2.1.2",
+ "better-sqlite3": "^11.9.1",
+ "electron-debug": "4.1.0",
+ "electron-dl": "4.0.0",
+ "electron-squirrel-startup": "1.0.1",
+ "jquery.fancytree": "2.38.5",
+ "jquery-hotkeys": "0.2.2",
+ "@highlightjs/cdn-assets": "11.11.1"
+ },
+ "devDependencies": {
+ "@types/electron-squirrel-startup": "1.0.2",
+ "@triliumnext/server": "workspace:*",
+ "copy-webpack-plugin": "13.0.0",
+ "electron": "35.1.5",
+ "@electron/rebuild": "3.7.2",
+ "@electron-forge/cli": "7.8.0",
+ "@electron-forge/maker-deb": "7.8.0",
+ "@electron-forge/maker-dmg": "7.8.0",
+ "@electron-forge/maker-flatpak": "7.8.0",
+ "@electron-forge/maker-rpm": "7.8.0",
+ "@electron-forge/maker-squirrel": "7.8.0",
+ "@electron-forge/maker-zip": "7.8.0",
+ "@electron-forge/plugin-auto-unpack-natives": "7.8.0",
+ "prebuild-install": "^7.1.1"
+ },
+ "config": {
+ "forge": "../electron-forge/forge.config.cjs"
+ },
+ "packageManager": "pnpm@10.9.0+sha512.0486e394640d3c1fb3c9d43d49cf92879ff74f8516959c235308f5a8f62e2e19528a65cdc2a3058f587cde71eba3d5b56327c8c33a97e4c4051ca48a10ca2d5f",
+ "scripts": {
+ "start-prod": "nx build desktop && cross-env TRILIUM_DATA_DIR=data TRILIUM_RESOURCE_DIR=dist TRILIUM_PORT=37841 electron dist/main.js",
+ "rebuild": "electron-rebuild"
+ },
+ "license": "AGPL-3.0-only",
+ "author": {
+ "name": "TriliumNext Notes Team",
+ "email": "contact@eliandoran.me",
+ "url": "https://github.com/TriliumNext/Notes"
+ },
+ "description": "Build your personal knowledge base with TriliumNext Notes",
+ "nx": {
+ "targets": {
+ "serve": {
+ "executor": "@nx/js:node",
+ "defaultConfiguration": "development",
+ "dependsOn": [
+ "build"
+ ],
+ "options": {
+ "buildTarget": "@triliumnext/desktop:build",
+ "runBuildTargetDependencies": false
+ },
+ "configurations": {
+ "development": {
+ "buildTarget": "@triliumnext/desktop:build:development"
+ },
+ "production": {
+ "buildTarget": "@triliumnext/desktop:build:production"
+ }
+ }
+ },
+ "electron-forge:make": {
+ "dependsOn": [ "build" ],
+ "command": "pnpm -C apps/desktop exec cross-env DEBUG=* NODE_INSTALLER=npm electron-forge make dist"
+ },
+ "electron-forge:package": {
+ "dependsOn": [ "build" ],
+ "command": "pnpm -C apps/desktop exec cross-env DEBUG=* NODE_INSTALLER=npm electron-forge package dist"
+ }
+ }
+ }
+}
diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Advanced Usage/Internal API/API Reference.dat b/apps/desktop/src/assets/.gitkeep
similarity index 100%
rename from src/public/app/doc_notes/en/User Guide/User Guide/Advanced Usage/Internal API/API Reference.dat
rename to apps/desktop/src/assets/.gitkeep
diff --git a/images/app-icons/tray/bookmarksTemplate-inverted.png b/apps/desktop/src/assets/images/tray/bookmarksTemplate-inverted.png
similarity index 100%
rename from images/app-icons/tray/bookmarksTemplate-inverted.png
rename to apps/desktop/src/assets/images/tray/bookmarksTemplate-inverted.png
diff --git a/images/app-icons/tray/bookmarksTemplate-inverted@1.25x.png b/apps/desktop/src/assets/images/tray/bookmarksTemplate-inverted@1.25x.png
similarity index 100%
rename from images/app-icons/tray/bookmarksTemplate-inverted@1.25x.png
rename to apps/desktop/src/assets/images/tray/bookmarksTemplate-inverted@1.25x.png
diff --git a/images/app-icons/tray/bookmarksTemplate-inverted@1.5x.png b/apps/desktop/src/assets/images/tray/bookmarksTemplate-inverted@1.5x.png
similarity index 100%
rename from images/app-icons/tray/bookmarksTemplate-inverted@1.5x.png
rename to apps/desktop/src/assets/images/tray/bookmarksTemplate-inverted@1.5x.png
diff --git a/images/app-icons/tray/bookmarksTemplate-inverted@2x.png b/apps/desktop/src/assets/images/tray/bookmarksTemplate-inverted@2x.png
similarity index 100%
rename from images/app-icons/tray/bookmarksTemplate-inverted@2x.png
rename to apps/desktop/src/assets/images/tray/bookmarksTemplate-inverted@2x.png
diff --git a/images/app-icons/tray/bookmarksTemplate.png b/apps/desktop/src/assets/images/tray/bookmarksTemplate.png
similarity index 100%
rename from images/app-icons/tray/bookmarksTemplate.png
rename to apps/desktop/src/assets/images/tray/bookmarksTemplate.png
diff --git a/images/app-icons/tray/bookmarksTemplate@1.25x.png b/apps/desktop/src/assets/images/tray/bookmarksTemplate@1.25x.png
similarity index 100%
rename from images/app-icons/tray/bookmarksTemplate@1.25x.png
rename to apps/desktop/src/assets/images/tray/bookmarksTemplate@1.25x.png
diff --git a/images/app-icons/tray/bookmarksTemplate@1.5x.png b/apps/desktop/src/assets/images/tray/bookmarksTemplate@1.5x.png
similarity index 100%
rename from images/app-icons/tray/bookmarksTemplate@1.5x.png
rename to apps/desktop/src/assets/images/tray/bookmarksTemplate@1.5x.png
diff --git a/images/app-icons/tray/bookmarksTemplate@2x.png b/apps/desktop/src/assets/images/tray/bookmarksTemplate@2x.png
similarity index 100%
rename from images/app-icons/tray/bookmarksTemplate@2x.png
rename to apps/desktop/src/assets/images/tray/bookmarksTemplate@2x.png
diff --git a/images/app-icons/tray/closeTemplate-inverted.png b/apps/desktop/src/assets/images/tray/closeTemplate-inverted.png
similarity index 100%
rename from images/app-icons/tray/closeTemplate-inverted.png
rename to apps/desktop/src/assets/images/tray/closeTemplate-inverted.png
diff --git a/images/app-icons/tray/closeTemplate-inverted@1.25x.png b/apps/desktop/src/assets/images/tray/closeTemplate-inverted@1.25x.png
similarity index 100%
rename from images/app-icons/tray/closeTemplate-inverted@1.25x.png
rename to apps/desktop/src/assets/images/tray/closeTemplate-inverted@1.25x.png
diff --git a/images/app-icons/tray/closeTemplate-inverted@1.5x.png b/apps/desktop/src/assets/images/tray/closeTemplate-inverted@1.5x.png
similarity index 100%
rename from images/app-icons/tray/closeTemplate-inverted@1.5x.png
rename to apps/desktop/src/assets/images/tray/closeTemplate-inverted@1.5x.png
diff --git a/images/app-icons/tray/closeTemplate-inverted@2x.png b/apps/desktop/src/assets/images/tray/closeTemplate-inverted@2x.png
similarity index 100%
rename from images/app-icons/tray/closeTemplate-inverted@2x.png
rename to apps/desktop/src/assets/images/tray/closeTemplate-inverted@2x.png
diff --git a/images/app-icons/tray/closeTemplate.png b/apps/desktop/src/assets/images/tray/closeTemplate.png
similarity index 100%
rename from images/app-icons/tray/closeTemplate.png
rename to apps/desktop/src/assets/images/tray/closeTemplate.png
diff --git a/images/app-icons/tray/closeTemplate@1.25x.png b/apps/desktop/src/assets/images/tray/closeTemplate@1.25x.png
similarity index 100%
rename from images/app-icons/tray/closeTemplate@1.25x.png
rename to apps/desktop/src/assets/images/tray/closeTemplate@1.25x.png
diff --git a/images/app-icons/tray/closeTemplate@1.5x.png b/apps/desktop/src/assets/images/tray/closeTemplate@1.5x.png
similarity index 100%
rename from images/app-icons/tray/closeTemplate@1.5x.png
rename to apps/desktop/src/assets/images/tray/closeTemplate@1.5x.png
diff --git a/images/app-icons/tray/closeTemplate@2x.png b/apps/desktop/src/assets/images/tray/closeTemplate@2x.png
similarity index 100%
rename from images/app-icons/tray/closeTemplate@2x.png
rename to apps/desktop/src/assets/images/tray/closeTemplate@2x.png
diff --git a/images/app-icons/tray/icon-blackTemplate.png b/apps/desktop/src/assets/images/tray/icon-blackTemplate.png
similarity index 100%
rename from images/app-icons/tray/icon-blackTemplate.png
rename to apps/desktop/src/assets/images/tray/icon-blackTemplate.png
diff --git a/images/app-icons/tray/icon-blackTemplate@1.25x.png b/apps/desktop/src/assets/images/tray/icon-blackTemplate@1.25x.png
similarity index 100%
rename from images/app-icons/tray/icon-blackTemplate@1.25x.png
rename to apps/desktop/src/assets/images/tray/icon-blackTemplate@1.25x.png
diff --git a/images/app-icons/tray/icon-blackTemplate@1.5x.png b/apps/desktop/src/assets/images/tray/icon-blackTemplate@1.5x.png
similarity index 100%
rename from images/app-icons/tray/icon-blackTemplate@1.5x.png
rename to apps/desktop/src/assets/images/tray/icon-blackTemplate@1.5x.png
diff --git a/images/app-icons/tray/icon-blackTemplate@2x.png b/apps/desktop/src/assets/images/tray/icon-blackTemplate@2x.png
similarity index 100%
rename from images/app-icons/tray/icon-blackTemplate@2x.png
rename to apps/desktop/src/assets/images/tray/icon-blackTemplate@2x.png
diff --git a/images/app-icons/tray/icon-color.png b/apps/desktop/src/assets/images/tray/icon-color.png
similarity index 100%
rename from images/app-icons/tray/icon-color.png
rename to apps/desktop/src/assets/images/tray/icon-color.png
diff --git a/images/app-icons/tray/icon-color@1.25x.png b/apps/desktop/src/assets/images/tray/icon-color@1.25x.png
similarity index 100%
rename from images/app-icons/tray/icon-color@1.25x.png
rename to apps/desktop/src/assets/images/tray/icon-color@1.25x.png
diff --git a/images/app-icons/tray/icon-color@1.5x.png b/apps/desktop/src/assets/images/tray/icon-color@1.5x.png
similarity index 100%
rename from images/app-icons/tray/icon-color@1.5x.png
rename to apps/desktop/src/assets/images/tray/icon-color@1.5x.png
diff --git a/images/app-icons/tray/icon-color@2x.png b/apps/desktop/src/assets/images/tray/icon-color@2x.png
similarity index 100%
rename from images/app-icons/tray/icon-color@2x.png
rename to apps/desktop/src/assets/images/tray/icon-color@2x.png
diff --git a/images/app-icons/tray/icon-purple.png b/apps/desktop/src/assets/images/tray/icon-purple.png
similarity index 100%
rename from images/app-icons/tray/icon-purple.png
rename to apps/desktop/src/assets/images/tray/icon-purple.png
diff --git a/images/app-icons/tray/icon-purple@1.25x.png b/apps/desktop/src/assets/images/tray/icon-purple@1.25x.png
similarity index 100%
rename from images/app-icons/tray/icon-purple@1.25x.png
rename to apps/desktop/src/assets/images/tray/icon-purple@1.25x.png
diff --git a/images/app-icons/tray/icon-purple@1.5x.png b/apps/desktop/src/assets/images/tray/icon-purple@1.5x.png
similarity index 100%
rename from images/app-icons/tray/icon-purple@1.5x.png
rename to apps/desktop/src/assets/images/tray/icon-purple@1.5x.png
diff --git a/images/app-icons/tray/icon-purple@2x.png b/apps/desktop/src/assets/images/tray/icon-purple@2x.png
similarity index 100%
rename from images/app-icons/tray/icon-purple@2x.png
rename to apps/desktop/src/assets/images/tray/icon-purple@2x.png
diff --git a/images/app-icons/tray/new-noteTemplate-inverted.png b/apps/desktop/src/assets/images/tray/new-noteTemplate-inverted.png
similarity index 100%
rename from images/app-icons/tray/new-noteTemplate-inverted.png
rename to apps/desktop/src/assets/images/tray/new-noteTemplate-inverted.png
diff --git a/images/app-icons/tray/new-noteTemplate-inverted@1.25x.png b/apps/desktop/src/assets/images/tray/new-noteTemplate-inverted@1.25x.png
similarity index 100%
rename from images/app-icons/tray/new-noteTemplate-inverted@1.25x.png
rename to apps/desktop/src/assets/images/tray/new-noteTemplate-inverted@1.25x.png
diff --git a/images/app-icons/tray/new-noteTemplate-inverted@1.5x.png b/apps/desktop/src/assets/images/tray/new-noteTemplate-inverted@1.5x.png
similarity index 100%
rename from images/app-icons/tray/new-noteTemplate-inverted@1.5x.png
rename to apps/desktop/src/assets/images/tray/new-noteTemplate-inverted@1.5x.png
diff --git a/images/app-icons/tray/new-noteTemplate-inverted@2x.png b/apps/desktop/src/assets/images/tray/new-noteTemplate-inverted@2x.png
similarity index 100%
rename from images/app-icons/tray/new-noteTemplate-inverted@2x.png
rename to apps/desktop/src/assets/images/tray/new-noteTemplate-inverted@2x.png
diff --git a/images/app-icons/tray/new-noteTemplate.png b/apps/desktop/src/assets/images/tray/new-noteTemplate.png
similarity index 100%
rename from images/app-icons/tray/new-noteTemplate.png
rename to apps/desktop/src/assets/images/tray/new-noteTemplate.png
diff --git a/images/app-icons/tray/new-noteTemplate@1.25x.png b/apps/desktop/src/assets/images/tray/new-noteTemplate@1.25x.png
similarity index 100%
rename from images/app-icons/tray/new-noteTemplate@1.25x.png
rename to apps/desktop/src/assets/images/tray/new-noteTemplate@1.25x.png
diff --git a/images/app-icons/tray/new-noteTemplate@1.5x.png b/apps/desktop/src/assets/images/tray/new-noteTemplate@1.5x.png
similarity index 100%
rename from images/app-icons/tray/new-noteTemplate@1.5x.png
rename to apps/desktop/src/assets/images/tray/new-noteTemplate@1.5x.png
diff --git a/images/app-icons/tray/new-noteTemplate@2x.png b/apps/desktop/src/assets/images/tray/new-noteTemplate@2x.png
similarity index 100%
rename from images/app-icons/tray/new-noteTemplate@2x.png
rename to apps/desktop/src/assets/images/tray/new-noteTemplate@2x.png
diff --git a/images/app-icons/tray/new-windowTemplate-inverted.png b/apps/desktop/src/assets/images/tray/new-windowTemplate-inverted.png
similarity index 100%
rename from images/app-icons/tray/new-windowTemplate-inverted.png
rename to apps/desktop/src/assets/images/tray/new-windowTemplate-inverted.png
diff --git a/images/app-icons/tray/new-windowTemplate-inverted@1.25x.png b/apps/desktop/src/assets/images/tray/new-windowTemplate-inverted@1.25x.png
similarity index 100%
rename from images/app-icons/tray/new-windowTemplate-inverted@1.25x.png
rename to apps/desktop/src/assets/images/tray/new-windowTemplate-inverted@1.25x.png
diff --git a/images/app-icons/tray/new-windowTemplate-inverted@1.5x.png b/apps/desktop/src/assets/images/tray/new-windowTemplate-inverted@1.5x.png
similarity index 100%
rename from images/app-icons/tray/new-windowTemplate-inverted@1.5x.png
rename to apps/desktop/src/assets/images/tray/new-windowTemplate-inverted@1.5x.png
diff --git a/images/app-icons/tray/new-windowTemplate-inverted@2x.png b/apps/desktop/src/assets/images/tray/new-windowTemplate-inverted@2x.png
similarity index 100%
rename from images/app-icons/tray/new-windowTemplate-inverted@2x.png
rename to apps/desktop/src/assets/images/tray/new-windowTemplate-inverted@2x.png
diff --git a/images/app-icons/tray/new-windowTemplate.png b/apps/desktop/src/assets/images/tray/new-windowTemplate.png
similarity index 100%
rename from images/app-icons/tray/new-windowTemplate.png
rename to apps/desktop/src/assets/images/tray/new-windowTemplate.png
diff --git a/images/app-icons/tray/new-windowTemplate@1.25x.png b/apps/desktop/src/assets/images/tray/new-windowTemplate@1.25x.png
similarity index 100%
rename from images/app-icons/tray/new-windowTemplate@1.25x.png
rename to apps/desktop/src/assets/images/tray/new-windowTemplate@1.25x.png
diff --git a/images/app-icons/tray/new-windowTemplate@1.5x.png b/apps/desktop/src/assets/images/tray/new-windowTemplate@1.5x.png
similarity index 100%
rename from images/app-icons/tray/new-windowTemplate@1.5x.png
rename to apps/desktop/src/assets/images/tray/new-windowTemplate@1.5x.png
diff --git a/images/app-icons/tray/new-windowTemplate@2x.png b/apps/desktop/src/assets/images/tray/new-windowTemplate@2x.png
similarity index 100%
rename from images/app-icons/tray/new-windowTemplate@2x.png
rename to apps/desktop/src/assets/images/tray/new-windowTemplate@2x.png
diff --git a/images/app-icons/tray/recentsTemplate-inverted.png b/apps/desktop/src/assets/images/tray/recentsTemplate-inverted.png
similarity index 100%
rename from images/app-icons/tray/recentsTemplate-inverted.png
rename to apps/desktop/src/assets/images/tray/recentsTemplate-inverted.png
diff --git a/images/app-icons/tray/recentsTemplate-inverted@1.25x.png b/apps/desktop/src/assets/images/tray/recentsTemplate-inverted@1.25x.png
similarity index 100%
rename from images/app-icons/tray/recentsTemplate-inverted@1.25x.png
rename to apps/desktop/src/assets/images/tray/recentsTemplate-inverted@1.25x.png
diff --git a/images/app-icons/tray/recentsTemplate-inverted@1.5x.png b/apps/desktop/src/assets/images/tray/recentsTemplate-inverted@1.5x.png
similarity index 100%
rename from images/app-icons/tray/recentsTemplate-inverted@1.5x.png
rename to apps/desktop/src/assets/images/tray/recentsTemplate-inverted@1.5x.png
diff --git a/images/app-icons/tray/recentsTemplate-inverted@2x.png b/apps/desktop/src/assets/images/tray/recentsTemplate-inverted@2x.png
similarity index 100%
rename from images/app-icons/tray/recentsTemplate-inverted@2x.png
rename to apps/desktop/src/assets/images/tray/recentsTemplate-inverted@2x.png
diff --git a/images/app-icons/tray/recentsTemplate.png b/apps/desktop/src/assets/images/tray/recentsTemplate.png
similarity index 100%
rename from images/app-icons/tray/recentsTemplate.png
rename to apps/desktop/src/assets/images/tray/recentsTemplate.png
diff --git a/images/app-icons/tray/recentsTemplate@1.25x.png b/apps/desktop/src/assets/images/tray/recentsTemplate@1.25x.png
similarity index 100%
rename from images/app-icons/tray/recentsTemplate@1.25x.png
rename to apps/desktop/src/assets/images/tray/recentsTemplate@1.25x.png
diff --git a/images/app-icons/tray/recentsTemplate@1.5x.png b/apps/desktop/src/assets/images/tray/recentsTemplate@1.5x.png
similarity index 100%
rename from images/app-icons/tray/recentsTemplate@1.5x.png
rename to apps/desktop/src/assets/images/tray/recentsTemplate@1.5x.png
diff --git a/images/app-icons/tray/recentsTemplate@2x.png b/apps/desktop/src/assets/images/tray/recentsTemplate@2x.png
similarity index 100%
rename from images/app-icons/tray/recentsTemplate@2x.png
rename to apps/desktop/src/assets/images/tray/recentsTemplate@2x.png
diff --git a/images/app-icons/tray/todayTemplate-inverted.png b/apps/desktop/src/assets/images/tray/todayTemplate-inverted.png
similarity index 100%
rename from images/app-icons/tray/todayTemplate-inverted.png
rename to apps/desktop/src/assets/images/tray/todayTemplate-inverted.png
diff --git a/images/app-icons/tray/todayTemplate-inverted@1.25x.png b/apps/desktop/src/assets/images/tray/todayTemplate-inverted@1.25x.png
similarity index 100%
rename from images/app-icons/tray/todayTemplate-inverted@1.25x.png
rename to apps/desktop/src/assets/images/tray/todayTemplate-inverted@1.25x.png
diff --git a/images/app-icons/tray/todayTemplate-inverted@1.5x.png b/apps/desktop/src/assets/images/tray/todayTemplate-inverted@1.5x.png
similarity index 100%
rename from images/app-icons/tray/todayTemplate-inverted@1.5x.png
rename to apps/desktop/src/assets/images/tray/todayTemplate-inverted@1.5x.png
diff --git a/images/app-icons/tray/todayTemplate-inverted@2x.png b/apps/desktop/src/assets/images/tray/todayTemplate-inverted@2x.png
similarity index 100%
rename from images/app-icons/tray/todayTemplate-inverted@2x.png
rename to apps/desktop/src/assets/images/tray/todayTemplate-inverted@2x.png
diff --git a/images/app-icons/tray/todayTemplate.png b/apps/desktop/src/assets/images/tray/todayTemplate.png
similarity index 100%
rename from images/app-icons/tray/todayTemplate.png
rename to apps/desktop/src/assets/images/tray/todayTemplate.png
diff --git a/images/app-icons/tray/todayTemplate@1.25x.png b/apps/desktop/src/assets/images/tray/todayTemplate@1.25x.png
similarity index 100%
rename from images/app-icons/tray/todayTemplate@1.25x.png
rename to apps/desktop/src/assets/images/tray/todayTemplate@1.25x.png
diff --git a/images/app-icons/tray/todayTemplate@1.5x.png b/apps/desktop/src/assets/images/tray/todayTemplate@1.5x.png
similarity index 100%
rename from images/app-icons/tray/todayTemplate@1.5x.png
rename to apps/desktop/src/assets/images/tray/todayTemplate@1.5x.png
diff --git a/images/app-icons/tray/todayTemplate@2x.png b/apps/desktop/src/assets/images/tray/todayTemplate@2x.png
similarity index 100%
rename from images/app-icons/tray/todayTemplate@2x.png
rename to apps/desktop/src/assets/images/tray/todayTemplate@2x.png
diff --git a/apps/desktop/src/electron-main.ts b/apps/desktop/src/electron-main.ts
new file mode 100644
index 0000000000..1ded01e95b
--- /dev/null
+++ b/apps/desktop/src/electron-main.ts
@@ -0,0 +1,71 @@
+import { initializeTranslations } from "@triliumnext/server/src/services/i18n.js";
+
+import electron from "electron";
+import sqlInit from "@triliumnext/server/src/services/sql_init.js";
+import windowService from "@triliumnext/server/src/services/window.js";
+import tray from "@triliumnext/server/src/services/tray.js";
+import options from "@triliumnext/server/src/services/options.js";
+import electronDebug from "electron-debug";
+import electronDl from "electron-dl";
+
+async function main() {
+ // Prevent Trilium starting twice on first install and on uninstall for the Windows installer.
+ if ((require("electron-squirrel-startup")).default) {
+ process.exit(0);
+ }
+
+ // Adds debug features like hotkeys for triggering dev tools and reload
+ electronDebug();
+ electronDl({ saveAs: true });
+
+ // needed for excalidraw export https://github.com/zadam/trilium/issues/4271
+ electron.app.commandLine.appendSwitch("enable-experimental-web-platform-features");
+ electron.app.commandLine.appendSwitch("lang", options.getOptionOrNull("formattingLocale") ?? "en");
+
+ // Quit when all windows are closed, except on macOS. There, it's common
+ // for applications and their menu bar to stay active until the user quits
+ // explicitly with Cmd + Q.
+ electron.app.on("window-all-closed", () => {
+ if (process.platform !== "darwin") {
+ electron.app.quit();
+ }
+ });
+
+ electron.app.on("ready", async () => {
+ // electron.app.setAppUserModelId('com.github.zadam.trilium');
+
+ // if db is not initialized -> setup process
+ // if db is initialized, then we need to wait until the migration process is finished
+ if (sqlInit.isDbInitialized()) {
+ await sqlInit.dbReady;
+
+ await windowService.createMainWindow(electron.app);
+
+ if (process.platform === "darwin") {
+ electron.app.on("activate", async () => {
+ if (electron.BrowserWindow.getAllWindows().length === 0) {
+ await windowService.createMainWindow(electron.app);
+ }
+ });
+ }
+
+ tray.createTray();
+ } else {
+ await windowService.createSetupWindow();
+ }
+
+ await windowService.registerGlobalShortcuts();
+ });
+
+ electron.app.on("will-quit", () => {
+ electron.globalShortcut.unregisterAll();
+ });
+
+ // this is to disable electron warning spam in the dev console (local development only)
+ process.env["ELECTRON_DISABLE_SECURITY_WARNINGS"] = "true";
+
+ await initializeTranslations();
+ await import("@triliumnext/server/src/main.js");
+}
+
+main();
diff --git a/apps/desktop/tsconfig.app.json b/apps/desktop/tsconfig.app.json
new file mode 100644
index 0000000000..dc261ef604
--- /dev/null
+++ b/apps/desktop/tsconfig.app.json
@@ -0,0 +1,25 @@
+{
+ "extends": "../../tsconfig.base.json",
+ "compilerOptions": {
+ "outDir": "dist",
+ "types": [
+ "node",
+ "express"
+ ],
+ "rootDir": "src",
+ "tsBuildInfoFile": "dist/tsconfig.app.tsbuildinfo"
+ },
+ "include": [
+ "src/**/*.ts"
+ ],
+ "exclude": [
+ "eslint.config.js",
+ "eslint.config.cjs",
+ "eslint.config.mjs"
+ ],
+ "references": [
+ {
+ "path": "../server/tsconfig.app.json"
+ }
+ ]
+}
diff --git a/apps/desktop/tsconfig.json b/apps/desktop/tsconfig.json
new file mode 100644
index 0000000000..38116a0b8a
--- /dev/null
+++ b/apps/desktop/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "extends": "../../tsconfig.base.json",
+ "files": [],
+ "include": [],
+ "references": [
+ {
+ "path": "../server"
+ },
+ {
+ "path": "./tsconfig.app.json"
+ }
+ ]
+}
diff --git a/apps/desktop/webpack.config.cjs b/apps/desktop/webpack.config.cjs
new file mode 100644
index 0000000000..5ee7194dbb
--- /dev/null
+++ b/apps/desktop/webpack.config.cjs
@@ -0,0 +1,59 @@
+const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
+const CopyPlugin = require('copy-webpack-plugin');
+const { join } = require('path');
+
+const outputDir = join(__dirname, 'dist');
+
+module.exports = {
+ output: {
+ path: outputDir,
+ },
+ target: [ "node" ],
+ plugins: [
+ new NxAppWebpackPlugin({
+ target: 'node',
+ compiler: 'tsc',
+ main: './src/electron-main.ts',
+ tsConfig: './tsconfig.app.json',
+ assets: ["./src/assets"],
+ optimization: false,
+ outputHashing: 'none',
+ generatePackageJson: false,
+ externalDependencies: [
+ "electron/main",
+ "@electron/remote/main",
+ "electron",
+ "@electron/remote",
+ "better-sqlite3"
+ ]
+ }),
+ new CopyPlugin({
+ patterns: [
+ {
+ from: "../client/dist",
+ to: join(outputDir, "public")
+ },
+ {
+ from: "../server/dist/node_modules",
+ to: join(outputDir, "node_modules")
+ },
+ {
+ from: "../server/dist/assets",
+ to: join(outputDir, "assets")
+ },
+ {
+ from: "node_modules/@electron/remote",
+ to: join(outputDir, "node_modules/@electron/remote")
+ },
+ {
+ from: "node_modules/prebuild-install",
+ to: join(outputDir, "node_modules/better-sqlite3/node_modules/prebuild-install")
+ },
+ {
+ from: "package.json",
+ to: join(outputDir, "package.json")
+ }
+ ]
+ })
+ ]
+};
diff --git a/apps/server/.serve.env b/apps/server/.serve.env
new file mode 100644
index 0000000000..5006a37650
--- /dev/null
+++ b/apps/server/.serve.env
@@ -0,0 +1,3 @@
+TRILIUM_ENV=dev
+TRILIUM_DATA_DIR=./apps/server/data
+TRILIUM_PUBLIC_SERVER=http://localhost:4200
\ No newline at end of file
diff --git a/apps/server/Dockerfile b/apps/server/Dockerfile
new file mode 100644
index 0000000000..2cfd939c91
--- /dev/null
+++ b/apps/server/Dockerfile
@@ -0,0 +1,25 @@
+FROM node:22.14.0-alpine AS builder
+ RUN corepack enable
+
+ # Install native dependencies since we might be building cross-platform.
+ WORKDIR /usr/src/app
+ COPY /apps/server/dist/package.json /apps/server/dist/pnpm-lock.yaml /apps/server/pnpm-workspace.yaml /usr/src/app/
+ RUN pnpm install --frozen-lockfile --prod && pnpm rebuild
+
+FROM node:22.14.0-alpine
+ # Install runtime dependencies
+ RUN apk add --no-cache su-exec shadow
+
+ WORKDIR /usr/src/app
+ COPY /apps/server/dist /usr/src/app
+ RUN rm -rf /usr/src/app/node_modules/better-sqlite3
+ COPY --from=builder /usr/src/app/node_modules/better-sqlite3 /usr/src/app/node_modules/better-sqlite3
+ COPY /apps/server/start-docker.sh /usr/src/app
+
+ # Add application user
+ RUN adduser -s /bin/false node; exit 0
+
+ # Configure container
+ EXPOSE 8080
+ CMD [ "sh", "./start-docker.sh" ]
+ HEALTHCHECK --start-period=10s CMD exec su-exec node node docker_healthcheck.js
\ No newline at end of file
diff --git a/apps/server/eslint.config.mjs b/apps/server/eslint.config.mjs
new file mode 100644
index 0000000000..724052a2e2
--- /dev/null
+++ b/apps/server/eslint.config.mjs
@@ -0,0 +1,5 @@
+import baseConfig from "../../eslint.config.mjs";
+
+export default [
+ ...baseConfig
+];
diff --git a/apps/server/package.json b/apps/server/package.json
new file mode 100644
index 0000000000..8ac5e4a06b
--- /dev/null
+++ b/apps/server/package.json
@@ -0,0 +1,167 @@
+{
+ "name": "@triliumnext/server",
+ "version": "0.0.1",
+ "private": true,
+ "dependencies": {
+ "better-sqlite3": "11.9.1",
+ "jquery.fancytree": "2.38.5",
+ "jquery-hotkeys": "0.2.2",
+ "@highlightjs/cdn-assets": "11.11.1"
+ },
+ "devDependencies": {
+ "@electron/remote": "2.1.2",
+ "@excalidraw/excalidraw": "0.18.0",
+ "@types/archiver": "6.0.3",
+ "@types/better-sqlite3": "7.6.13",
+ "@types/cheerio": "0.22.35",
+ "@types/cls-hooked": "4.3.9",
+ "@types/compression": "1.7.5",
+ "@types/cookie-parser": "1.4.8",
+ "@types/debounce": "1.2.4",
+ "@types/ejs": "3.1.5",
+ "@types/escape-html": "1.0.4",
+ "@types/express-http-proxy": "1.6.6",
+ "@types/express-session": "1.18.1",
+ "@types/fs-extra": "11.0.4",
+ "@types/html": "1.0.4",
+ "@types/ini": "4.1.1",
+ "@types/js-yaml": "4.0.9",
+ "@types/jsdom": "21.1.7",
+ "@types/mime-types": "2.1.4",
+ "@types/multer": "1.4.12",
+ "@types/safe-compare": "1.1.2",
+ "@types/sanitize-html": "2.15.0",
+ "@types/sax": "1.2.7",
+ "@types/serve-favicon": "2.5.7",
+ "@types/serve-static": "1.15.7",
+ "@types/session-file-store": "1.2.5",
+ "@types/stream-throttle": "0.1.4",
+ "@types/supertest": "6.0.3",
+ "@types/swagger-ui-express": "4.1.8",
+ "@types/tmp": "0.2.6",
+ "@types/turndown": "5.0.5",
+ "@types/ws": "8.18.1",
+ "@types/xml2js": "0.4.14",
+ "autocomplete.js": "0.38.1",
+ "boxicons": "2.1.4",
+ "codemirror": "5.65.19",
+ "express-http-proxy": "2.1.1",
+ "jquery": "3.7.1",
+ "katex": "0.16.22",
+ "normalize.css": "8.0.1",
+ "@anthropic-ai/sdk": "0.39.0",
+ "@braintree/sanitize-url": "7.1.1",
+ "@triliumnext/commons": "workspace:*",
+ "@triliumnext/express-partial-content": "1.0.1",
+ "@triliumnext/turndown-plugin-gfm": "workspace:*",
+ "archiver": "7.0.1",
+ "async-mutex": "0.5.0",
+ "axios": "1.8.4",
+ "bindings": "1.5.0",
+ "chardet": "2.1.0",
+ "cheerio": "1.0.0",
+ "chokidar": "4.0.3",
+ "cls-hooked": "4.2.2",
+ "compression": "1.8.0",
+ "cookie-parser": "1.4.7",
+ "csrf-csrf": "3.1.0",
+ "dayjs": "1.11.13",
+ "debounce": "2.2.0",
+ "debug": "4.4.0",
+ "ejs": "3.1.10",
+ "electron": "35.1.5",
+ "electron-debug": "4.1.0",
+ "electron-window-state": "5.0.3",
+ "escape-html": "1.0.3",
+ "express": "4.21.2",
+ "express-openid-connect": "^2.17.1",
+ "express-rate-limit": "7.5.0",
+ "express-session": "1.18.1",
+ "file-uri-to-path": "2.0.0",
+ "fs-extra": "11.3.0",
+ "helmet": "8.1.0",
+ "html": "1.0.0",
+ "html2plaintext": "2.1.4",
+ "http-proxy-agent": "7.0.2",
+ "https-proxy-agent": "7.0.6",
+ "i18next": "25.0.0",
+ "i18next-fs-backend": "2.6.0",
+ "image-type": "5.2.0",
+ "ini": "5.0.0",
+ "is-animated": "2.0.2",
+ "is-svg": "5.1.0",
+ "jimp": "1.6.0",
+ "js-yaml": "4.1.0",
+ "jsdom": "26.1.0",
+ "marked": "15.0.8",
+ "mime-types": "3.0.1",
+ "multer": "1.4.5-lts.2",
+ "normalize-strings": "1.1.1",
+ "ollama": "0.5.14",
+ "openai": "4.95.1",
+ "rand-token": "1.0.1",
+ "safe-compare": "1.1.4",
+ "sanitize-filename": "1.6.3",
+ "sanitize-html": "2.16.0",
+ "sax": "1.4.1",
+ "serve-favicon": "2.5.0",
+ "session-file-store": "1.5.0",
+ "stream-throttle": "0.1.3",
+ "strip-bom": "5.0.0",
+ "striptags": "3.2.0",
+ "supertest": "7.1.0",
+ "swagger-jsdoc": "6.2.8",
+ "swagger-ui-express": "5.0.1",
+ "time2fa": "^1.3.0",
+ "tmp": "0.2.3",
+ "turndown": "7.2.0",
+ "unescape": "1.0.1",
+ "webpack": "5.99.6",
+ "ws": "8.18.1",
+ "xml2js": "0.6.2",
+ "yauzl": "3.2.0",
+ "copy-webpack-plugin": "13.0.0"
+ },
+ "nx": {
+ "implicitDependencies": [
+ "@triliumnext/client"
+ ],
+ "targets": {
+ "serve": {
+ "executor": "@nx/js:node",
+ "defaultConfiguration": "development",
+ "dependsOn": [
+ "build"
+ ],
+ "options": {
+ "buildTarget": "@triliumnext/server:build",
+ "runBuildTargetDependencies": false
+ },
+ "configurations": {
+ "development": {
+ "buildTarget": "@triliumnext/server:build:development"
+ },
+ "production": {
+ "buildTarget": "@triliumnext/server:build:production"
+ }
+ }
+ },
+ "package": {
+ "dependsOn": [ "build" ],
+ "command": "bash apps/server/scripts/build-server.sh"
+ },
+ "docker-build": {
+ "dependsOn": [
+ "build"
+ ],
+ "command": "docker build -f apps/server/Dockerfile . -t triliumnext"
+ },
+ "docker-start": {
+ "dependsOn": [
+ "docker-build"
+ ],
+ "command": "docker run -p 8081:8080 triliumnext"
+ }
+ }
+ }
+}
diff --git a/bin/build-server.sh b/apps/server/scripts/build-server.sh
old mode 100755
new mode 100644
similarity index 74%
rename from bin/build-server.sh
rename to apps/server/scripts/build-server.sh
index 93102737c6..313726c862
--- a/bin/build-server.sh
+++ b/apps/server/scripts/build-server.sh
@@ -23,18 +23,9 @@ echo "Selected Arch: $ARCH"
# Set Node.js version and architecture-specific filename
NODE_VERSION=22.14.0
-BUILD_DIR="./build"
-DIST_DIR="./dist"
-CLEANUP_SCRIPT="./bin/cleanupNodeModules.ts"
-
-
-# Trigger the build
-echo "Build start"
-npm run build:prepare-dist
-echo "Build finished"
-
-# pruning of unnecessary files and devDeps in node_modules
-node --experimental-strip-types $CLEANUP_SCRIPT $BUILD_DIR
+script_dir=$(realpath $(dirname $0))
+BUILD_DIR="$script_dir/../dist"
+DIST_DIR="$script_dir/../out"
NODE_FILENAME=node-v${NODE_VERSION}-linux-${ARCH}
@@ -45,7 +36,7 @@ mv $NODE_FILENAME node
cd ..
-rm -r $BUILD_DIR/node/lib/node_modules/{npm,corepack} \
+rm -rf $BUILD_DIR/node/lib/node_modules/{npm,corepack} \
$BUILD_DIR/node/bin/{npm,npx,corepack} \
$BUILD_DIR/node/CHANGELOG.md \
$BUILD_DIR/node/include/node \
@@ -55,12 +46,8 @@ rm -r $BUILD_DIR/node/lib/node_modules/{npm,corepack} \
printf "#!/bin/sh\n./node/bin/node src/main\n" > $BUILD_DIR/trilium.sh
chmod 755 $BUILD_DIR/trilium.sh
-# TriliumNextTODO: is this still required? If yes → move to copy-dist/copy-trilium
-cp bin/tpl/anonymize-database.sql $BUILD_DIR/
-
VERSION=`jq -r ".version" package.json`
-
ARCHIVE_NAME="TriliumNextNotes-Server-${VERSION}-linux-${ARCH}"
echo "Creating Archive $ARCHIVE_NAME..."
diff --git a/src/anonymize.ts b/apps/server/src/anonymize.ts
similarity index 100%
rename from src/anonymize.ts
rename to apps/server/src/anonymize.ts
diff --git a/apps/server/src/app.ts b/apps/server/src/app.ts
new file mode 100644
index 0000000000..43170e0bd5
--- /dev/null
+++ b/apps/server/src/app.ts
@@ -0,0 +1,143 @@
+import express from "express";
+import path from "path";
+import favicon from "serve-favicon";
+import cookieParser from "cookie-parser";
+import helmet from "helmet";
+import compression from "compression";
+import sessionParser from "./routes/session_parser.js";
+import config from "./services/config.js";
+import utils, { getResourceDir } from "./services/utils.js";
+import assets from "./routes/assets.js";
+import routes from "./routes/routes.js";
+import custom from "./routes/custom.js";
+import error_handlers from "./routes/error_handlers.js";
+import { startScheduledCleanup } from "./services/erase.js";
+import sql_init from "./services/sql_init.js";
+import { auth } from "express-openid-connect";
+import openID from "./services/open_id.js";
+import { t } from "i18next";
+import eventService from "./services/events.js";
+import log from "./services/log.js";
+import "./services/handlers.js";
+import "./becca/becca_loader.js";
+import { RESOURCE_DIR } from "./services/resource_dir.js";
+
+export default async function buildApp() {
+ const app = express();
+
+ // Initialize DB
+ sql_init.initializeDb();
+
+ // Listen for database initialization event
+ eventService.subscribe(eventService.DB_INITIALIZED, async () => {
+ try {
+ log.info("Database initialized, setting up LLM features");
+
+ // Initialize embedding providers
+ const { initializeEmbeddings } = await import("./services/llm/embeddings/init.js");
+ await initializeEmbeddings();
+
+ // Initialize the index service for LLM functionality
+ const { default: indexService } = await import("./services/llm/index_service.js");
+ await indexService.initialize().catch(e => console.error("Failed to initialize index service:", e));
+
+ log.info("LLM features initialized successfully");
+ } catch (error) {
+ console.error("Error initializing LLM features:", error);
+ }
+ });
+
+ // Initialize LLM features only if database is already initialized
+ if (sql_init.isDbInitialized()) {
+ try {
+ // Initialize embedding providers
+ const { initializeEmbeddings } = await import("./services/llm/embeddings/init.js");
+ await initializeEmbeddings();
+
+ // Initialize the index service for LLM functionality
+ const { default: indexService } = await import("./services/llm/index_service.js");
+ await indexService.initialize().catch(e => console.error("Failed to initialize index service:", e));
+ } catch (error) {
+ console.error("Error initializing LLM features:", error);
+ }
+ } else {
+ console.log("Database not initialized yet. LLM features will be initialized after setup.");
+ }
+
+ const publicDir = path.join(getResourceDir(), "public");
+ const publicAssetsDir = path.join(publicDir, "assets");
+ const assetsDir = RESOURCE_DIR;
+
+ // view engine setup
+ app.set("views", path.join(assetsDir, "views"));
+ app.engine("ejs", (await import("ejs")).renderFile);
+ app.set("view engine", "ejs");
+
+ app.use((req, res, next) => {
+ // set CORS header
+ if (config["Network"]["corsAllowOrigin"]) {
+ res.header("Access-Control-Allow-Origin", config["Network"]["corsAllowOrigin"]);
+ }
+ if (config["Network"]["corsAllowMethods"]) {
+ res.header("Access-Control-Allow-Methods", config["Network"]["corsAllowMethods"]);
+ }
+ if (config["Network"]["corsAllowHeaders"]) {
+ res.header("Access-Control-Allow-Headers", config["Network"]["corsAllowHeaders"]);
+ }
+
+ res.locals.t = t;
+ return next();
+ });
+
+ if (!utils.isElectron) {
+ app.use(compression()); // HTTP compression
+ }
+
+ app.use(
+ helmet({
+ hidePoweredBy: false, // errors out in electron
+ contentSecurityPolicy: false,
+ crossOriginEmbedderPolicy: false
+ })
+ );
+
+ app.use(express.text({ limit: "500mb" }));
+ app.use(express.json({ limit: "500mb" }));
+ app.use(express.raw({ limit: "500mb" }));
+ app.use(express.urlencoded({ extended: false }));
+ app.use(cookieParser());
+
+ app.use(express.static(path.join(publicDir, "root")));
+ app.use(`/manifest.webmanifest`, express.static(path.join(publicAssetsDir, "manifest.webmanifest")));
+ app.use(`/robots.txt`, express.static(path.join(publicAssetsDir, "robots.txt")));
+ app.use(`/icon.png`, express.static(path.join(publicAssetsDir, "icon.png")));
+ app.use(sessionParser);
+ app.use(favicon(path.join(assetsDir, "icon.ico")));
+
+ if (openID.isOpenIDEnabled())
+ app.use(auth(openID.generateOAuthConfig()));
+
+ await assets.register(app);
+ routes.register(app);
+ custom.register(app);
+ error_handlers.register(app);
+
+ // triggers sync timer
+ await import("./services/sync.js");
+
+ // triggers backup timer
+ await import("./services/backup.js");
+
+ // trigger consistency checks timer
+ await import("./services/consistency_checks.js");
+
+ await import("./services/scheduler.js");
+
+ startScheduledCleanup();
+
+ if (utils.isElectron) {
+ (await import("@electron/remote/main")).initialize();
+ }
+
+ return app;
+}
diff --git a/config-sample.ini b/apps/server/src/assets/config-sample.ini
similarity index 100%
rename from config-sample.ini
rename to apps/server/src/assets/config-sample.ini
diff --git a/db/TODO.txt b/apps/server/src/assets/db/TODO.txt
similarity index 100%
rename from db/TODO.txt
rename to apps/server/src/assets/db/TODO.txt
diff --git a/db/demo.zip b/apps/server/src/assets/db/demo.zip
similarity index 100%
rename from db/demo.zip
rename to apps/server/src/assets/db/demo.zip
diff --git a/db/image-deleted.png b/apps/server/src/assets/db/image-deleted.png
similarity index 100%
rename from db/image-deleted.png
rename to apps/server/src/assets/db/image-deleted.png
diff --git a/db/migrations/0215__content_structure.sql b/apps/server/src/assets/db/migrations/0215__content_structure.sql
similarity index 100%
rename from db/migrations/0215__content_structure.sql
rename to apps/server/src/assets/db/migrations/0215__content_structure.sql
diff --git a/db/migrations/0216__move_content_into_blobs.ts b/apps/server/src/assets/db/migrations/0216__move_content_into_blobs.ts
similarity index 100%
rename from db/migrations/0216__move_content_into_blobs.ts
rename to apps/server/src/assets/db/migrations/0216__move_content_into_blobs.ts
diff --git a/db/migrations/0217__drop_content_tables.sql b/apps/server/src/assets/db/migrations/0217__drop_content_tables.sql
similarity index 100%
rename from db/migrations/0217__drop_content_tables.sql
rename to apps/server/src/assets/db/migrations/0217__drop_content_tables.sql
diff --git a/db/migrations/0218__rename_note_revision_to_revision.sql b/apps/server/src/assets/db/migrations/0218__rename_note_revision_to_revision.sql
similarity index 100%
rename from db/migrations/0218__rename_note_revision_to_revision.sql
rename to apps/server/src/assets/db/migrations/0218__rename_note_revision_to_revision.sql
diff --git a/db/migrations/0219__attachments.sql b/apps/server/src/assets/db/migrations/0219__attachments.sql
similarity index 100%
rename from db/migrations/0219__attachments.sql
rename to apps/server/src/assets/db/migrations/0219__attachments.sql
diff --git a/db/migrations/0220__migrate_images_to_attachments.ts b/apps/server/src/assets/db/migrations/0220__migrate_images_to_attachments.ts
similarity index 100%
rename from db/migrations/0220__migrate_images_to_attachments.ts
rename to apps/server/src/assets/db/migrations/0220__migrate_images_to_attachments.ts
diff --git a/db/migrations/0221__remove_hideIncludedImages_main_option.sql b/apps/server/src/assets/db/migrations/0221__remove_hideIncludedImages_main_option.sql
similarity index 100%
rename from db/migrations/0221__remove_hideIncludedImages_main_option.sql
rename to apps/server/src/assets/db/migrations/0221__remove_hideIncludedImages_main_option.sql
diff --git a/db/migrations/0222__rename_openTabs_to_openNoteContexts.sql b/apps/server/src/assets/db/migrations/0222__rename_openTabs_to_openNoteContexts.sql
similarity index 100%
rename from db/migrations/0222__rename_openTabs_to_openNoteContexts.sql
rename to apps/server/src/assets/db/migrations/0222__rename_openTabs_to_openNoteContexts.sql
diff --git a/db/migrations/0223__NOOP.sql b/apps/server/src/assets/db/migrations/0223__NOOP.sql
similarity index 100%
rename from db/migrations/0223__NOOP.sql
rename to apps/server/src/assets/db/migrations/0223__NOOP.sql
diff --git a/db/migrations/0224__fix_blobIds.sql b/apps/server/src/assets/db/migrations/0224__fix_blobIds.sql
similarity index 100%
rename from db/migrations/0224__fix_blobIds.sql
rename to apps/server/src/assets/db/migrations/0224__fix_blobIds.sql
diff --git a/db/migrations/0225__create_blobId_indices.sql b/apps/server/src/assets/db/migrations/0225__create_blobId_indices.sql
similarity index 100%
rename from db/migrations/0225__create_blobId_indices.sql
rename to apps/server/src/assets/db/migrations/0225__create_blobId_indices.sql
diff --git a/db/migrations/0226__rename_noteSize_label.sql b/apps/server/src/assets/db/migrations/0226__rename_noteSize_label.sql
similarity index 100%
rename from db/migrations/0226__rename_noteSize_label.sql
rename to apps/server/src/assets/db/migrations/0226__rename_noteSize_label.sql
diff --git a/db/migrations/0227__disable_image_compression.sql b/apps/server/src/assets/db/migrations/0227__disable_image_compression.sql
similarity index 100%
rename from db/migrations/0227__disable_image_compression.sql
rename to apps/server/src/assets/db/migrations/0227__disable_image_compression.sql
diff --git a/db/migrations/0228__fix_blobIds.sql b/apps/server/src/assets/db/migrations/0228__fix_blobIds.sql
similarity index 100%
rename from db/migrations/0228__fix_blobIds.sql
rename to apps/server/src/assets/db/migrations/0228__fix_blobIds.sql
diff --git a/db/migrations/0229__add_oauth_user_data_table.sql b/apps/server/src/assets/db/migrations/0229__add_oauth_user_data_table.sql
similarity index 100%
rename from db/migrations/0229__add_oauth_user_data_table.sql
rename to apps/server/src/assets/db/migrations/0229__add_oauth_user_data_table.sql
diff --git a/db/migrations/0230__vector_embeddings.sql b/apps/server/src/assets/db/migrations/0230__vector_embeddings.sql
similarity index 100%
rename from db/migrations/0230__vector_embeddings.sql
rename to apps/server/src/assets/db/migrations/0230__vector_embeddings.sql
diff --git a/db/schema.sql b/apps/server/src/assets/db/schema.sql
similarity index 100%
rename from db/schema.sql
rename to apps/server/src/assets/db/schema.sql
diff --git a/src/etapi/etapi.openapi.yaml b/apps/server/src/assets/etapi.openapi.yaml
similarity index 100%
rename from src/etapi/etapi.openapi.yaml
rename to apps/server/src/assets/etapi.openapi.yaml
diff --git a/apps/server/src/assets/icon.ico b/apps/server/src/assets/icon.ico
new file mode 100644
index 0000000000..398e3854e6
Binary files /dev/null and b/apps/server/src/assets/icon.ico differ
diff --git a/images/google-logo.svg b/apps/server/src/assets/images/google-logo.svg
similarity index 100%
rename from images/google-logo.svg
rename to apps/server/src/assets/images/google-logo.svg
diff --git a/images/icon-black.svg b/apps/server/src/assets/images/icon-black.svg
similarity index 100%
rename from images/icon-black.svg
rename to apps/server/src/assets/images/icon-black.svg
diff --git a/images/icon-color.svg b/apps/server/src/assets/images/icon-color.svg
similarity index 100%
rename from images/icon-color.svg
rename to apps/server/src/assets/images/icon-color.svg
diff --git a/images/icon-installer.svg b/apps/server/src/assets/images/icon-installer.svg
similarity index 98%
rename from images/icon-installer.svg
rename to apps/server/src/assets/images/icon-installer.svg
index 3886e79047..ed13969485 100644
--- a/images/icon-installer.svg
+++ b/apps/server/src/assets/images/icon-installer.svg
@@ -1,125 +1,125 @@
-
-
-
+
+
+
diff --git a/images/icon-purple.svg b/apps/server/src/assets/images/icon-purple.svg
similarity index 100%
rename from images/icon-purple.svg
rename to apps/server/src/assets/images/icon-purple.svg
diff --git a/images/icon-white.svg b/apps/server/src/assets/images/icon-white.svg
similarity index 100%
rename from images/icon-white.svg
rename to apps/server/src/assets/images/icon-white.svg
diff --git a/src/services/llm/prompts/base_system_prompt.md b/apps/server/src/assets/llm/prompts/base_system_prompt.md
similarity index 100%
rename from src/services/llm/prompts/base_system_prompt.md
rename to apps/server/src/assets/llm/prompts/base_system_prompt.md
diff --git a/src/services/llm/prompts/providers/anthropic_tool_prompt.md b/apps/server/src/assets/llm/prompts/providers/anthropic_tool_prompt.md
similarity index 100%
rename from src/services/llm/prompts/providers/anthropic_tool_prompt.md
rename to apps/server/src/assets/llm/prompts/providers/anthropic_tool_prompt.md
diff --git a/src/services/llm/prompts/providers/ollama_tool_prompt.md b/apps/server/src/assets/llm/prompts/providers/ollama_tool_prompt.md
similarity index 100%
rename from src/services/llm/prompts/providers/ollama_tool_prompt.md
rename to apps/server/src/assets/llm/prompts/providers/ollama_tool_prompt.md
diff --git a/src/services/llm/prompts/providers/openai_tool_prompt.md b/apps/server/src/assets/llm/prompts/providers/openai_tool_prompt.md
similarity index 100%
rename from src/services/llm/prompts/providers/openai_tool_prompt.md
rename to apps/server/src/assets/llm/prompts/providers/openai_tool_prompt.md
diff --git a/src/routes/api/openapi.json b/apps/server/src/assets/openapi.json
similarity index 100%
rename from src/routes/api/openapi.json
rename to apps/server/src/assets/openapi.json
diff --git a/translations/cn/server.json b/apps/server/src/assets/translations/cn/server.json
similarity index 100%
rename from translations/cn/server.json
rename to apps/server/src/assets/translations/cn/server.json
diff --git a/translations/de/server.json b/apps/server/src/assets/translations/de/server.json
similarity index 100%
rename from translations/de/server.json
rename to apps/server/src/assets/translations/de/server.json
diff --git a/translations/en/server.json b/apps/server/src/assets/translations/en/server.json
similarity index 100%
rename from translations/en/server.json
rename to apps/server/src/assets/translations/en/server.json
diff --git a/translations/es/server.json b/apps/server/src/assets/translations/es/server.json
similarity index 100%
rename from translations/es/server.json
rename to apps/server/src/assets/translations/es/server.json
diff --git a/translations/fr/server.json b/apps/server/src/assets/translations/fr/server.json
similarity index 100%
rename from translations/fr/server.json
rename to apps/server/src/assets/translations/fr/server.json
diff --git a/translations/pt_br/server.json b/apps/server/src/assets/translations/pt_br/server.json
similarity index 100%
rename from translations/pt_br/server.json
rename to apps/server/src/assets/translations/pt_br/server.json
diff --git a/translations/ro/server.json b/apps/server/src/assets/translations/ro/server.json
similarity index 100%
rename from translations/ro/server.json
rename to apps/server/src/assets/translations/ro/server.json
diff --git a/translations/tw/server.json b/apps/server/src/assets/translations/tw/server.json
similarity index 100%
rename from translations/tw/server.json
rename to apps/server/src/assets/translations/tw/server.json
diff --git a/src/views/desktop.ejs b/apps/server/src/assets/views/desktop.ejs
similarity index 97%
rename from src/views/desktop.ejs
rename to apps/server/src/assets/views/desktop.ejs
index 1e7112e78b..b0de6cf888 100644
--- a/src/views/desktop.ejs
+++ b/apps/server/src/assets/views/desktop.ejs
@@ -68,6 +68,7 @@
$("body").show();
+
diff --git a/src/views/login.ejs b/apps/server/src/assets/views/login.ejs
similarity index 97%
rename from src/views/login.ejs
rename to apps/server/src/assets/views/login.ejs
index d013b1b156..1bda4741ee 100644
--- a/src/views/login.ejs
+++ b/apps/server/src/assets/views/login.ejs
@@ -75,6 +75,8 @@
<% } %>