From 24ed474c8c93f68ba3da00b0e4aa5dfb0a02ab07 Mon Sep 17 00:00:00 2001 From: grantzhu Date: Mon, 4 Aug 2025 21:24:38 +0800 Subject: [PATCH 01/17] fix: remove unnecessary idea directory, this will affect other developers using jetbrains ide from opening this project --- .gitignore | 1 + .idea/.gitignore | 6 ------ .idea/codeStyles/Project.xml | 15 --------------- .idea/codeStyles/codeStyleConfig.xml | 5 ----- .idea/dataSources.xml | 12 ------------ .idea/encodings.xml | 4 ---- .idea/git_toolbox_prj.xml | 15 --------------- .idea/inspectionProfiles/Project_Default.xml | 11 ----------- .idea/jsLibraryMappings.xml | 6 ------ .idea/jsLinters/jslint.xml | 9 --------- .idea/misc.xml | 8 -------- .idea/modules.xml | 8 -------- .idea/sqldialects.xml | 7 ------- .idea/vcs.xml | 6 ------ apps/web-clipper/.idea/.gitignore | 5 ----- .../.idea/inspectionProfiles/Project_Default.xml | 10 ---------- apps/web-clipper/.idea/misc.xml | 9 --------- apps/web-clipper/.idea/modules.xml | 8 -------- apps/web-clipper/.idea/vcs.xml | 6 ------ 19 files changed, 1 insertion(+), 150 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/codeStyles/Project.xml delete mode 100644 .idea/codeStyles/codeStyleConfig.xml delete mode 100644 .idea/dataSources.xml delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/git_toolbox_prj.xml delete mode 100644 .idea/inspectionProfiles/Project_Default.xml delete mode 100644 .idea/jsLibraryMappings.xml delete mode 100644 .idea/jsLinters/jslint.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/sqldialects.xml delete mode 100644 .idea/vcs.xml delete mode 100644 apps/web-clipper/.idea/.gitignore delete mode 100644 apps/web-clipper/.idea/inspectionProfiles/Project_Default.xml delete mode 100644 apps/web-clipper/.idea/misc.xml delete mode 100644 apps/web-clipper/.idea/modules.xml delete mode 100644 apps/web-clipper/.idea/vcs.xml diff --git a/.gitignore b/.gitignore index d7694258d..09749c270 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ node_modules # IDEs and editors /.idea +.idea .project .classpath .c9/ diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 2102c8715..000000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -# Default ignored files -/workspace.xml - -# Datasource local storage ignored files -/dataSources.local.xml -/dataSources/ diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index d49935027..000000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index 79ee123c2..000000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml deleted file mode 100644 index 88634a324..000000000 --- a/.idea/dataSources.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - sqlite.xerial - true - org.sqlite.JDBC - jdbc:sqlite:$PROJECT_DIR$/data/document.db - $ProjectFileDir$ - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 15a15b218..000000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml deleted file mode 100644 index 02b915b85..000000000 --- a/.idea/git_toolbox_prj.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 22cdf9bd9..000000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml deleted file mode 100644 index d23208fbb..000000000 --- a/.idea/jsLibraryMappings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/jsLinters/jslint.xml b/.idea/jsLinters/jslint.xml deleted file mode 100644 index 742a5fe03..000000000 --- a/.idea/jsLinters/jslint.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 44ee38ede..000000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 09c4a5cbf..000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml deleted file mode 100644 index dd88c0a28..000000000 --- a/.idea/sqldialects.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index dcb6b8c4c..000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/apps/web-clipper/.idea/.gitignore b/apps/web-clipper/.idea/.gitignore deleted file mode 100644 index c0f9e196c..000000000 --- a/apps/web-clipper/.idea/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -# Default ignored files -/workspace.xml - -# Datasource local storage ignored files -/dataSources.local.xml \ No newline at end of file diff --git a/apps/web-clipper/.idea/inspectionProfiles/Project_Default.xml b/apps/web-clipper/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 146ab09b7..000000000 --- a/apps/web-clipper/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - \ No newline at end of file diff --git a/apps/web-clipper/.idea/misc.xml b/apps/web-clipper/.idea/misc.xml deleted file mode 100644 index 7e5bdf89f..000000000 --- a/apps/web-clipper/.idea/misc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/apps/web-clipper/.idea/modules.xml b/apps/web-clipper/.idea/modules.xml deleted file mode 100644 index ebf785642..000000000 --- a/apps/web-clipper/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/apps/web-clipper/.idea/vcs.xml b/apps/web-clipper/.idea/vcs.xml deleted file mode 100644 index 94a25f7f4..000000000 --- a/apps/web-clipper/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From 68dd54a100f83796d0e6788461d0f38aba71faaf Mon Sep 17 00:00:00 2001 From: serossi <41602856+serossi@users.noreply.github.com> Date: Wed, 6 Aug 2025 16:07:27 +0200 Subject: [PATCH 02/17] Update Packaged version for Linux.md Added Autoupdate Script for Server from Github releases --- .../Packaged version for Linux.md | 79 ++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/docs/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Packaged version for Linux.md b/docs/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Packaged version for Linux.md index 5b2273983..b2773f49a 100644 --- a/docs/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Packaged version for Linux.md +++ b/docs/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Packaged version for Linux.md @@ -60,6 +60,83 @@ sudo systemctl enable --now -q trilium ``` * You can now open a browser to http://\[your-server-hostname\]:8080 and you should see the Trilium initialization page. +## Simple Autoupdate for Server +Run as the same User Trilium runs + +if you run as root please remove 'sudo' from the commands + +requires "jq" ```apt install jq``` + +It will stop the service above, overwrite everything (i expect no config.ini), and start service + +``` +#!/bin/bash + +# Configuration +REPO="TriliumNext/Trilium" +PATTERN="TriliumNotes-Server-.*-linux-x64.tar.xz" +DOWNLOAD_DIR="/var/tmp/trilium_download" +OUTPUT_DIR="/opt/trilium" +SERVICE_NAME="trilium" + +# Ensure dependencies are installed +command -v curl >/dev/null 2>&1 || { echo "Error: curl is required"; exit 1; } +command -v jq >/dev/null 2>&1 || { echo "Error: jq is required"; exit 1; } +command -v tar >/dev/null 2>&1 || { echo "Error: tar is required"; exit 1; } + +# Create download directory +mkdir -p "$DOWNLOAD_DIR" || { echo "Error: Cannot create $DOWNLOAD_DIR"; exit 1; } + +# Download the latest release +LATEST_URL=$(curl -sL https://api.github.com/repos/$REPO/releases/latest | jq -r ".assets[] | select(.name | test(\"$PATTERN\")) | .browser_download_url") +if [ -z "$LATEST_URL" ]; then + echo "Error: No asset found matching pattern '$PATTERN'" + exit 1 +fi + +FILE_NAME=$(basename "$LATEST_URL") +FILE_PATH="$DOWNLOAD_DIR/$FILE_NAME" + +# Check if the file already exists and is up-to-date +if [ -f "$FILE_PATH" ]; then + echo "Latest release $FILE_NAME already downloaded" +else + curl -LO --output-dir "$DOWNLOAD_DIR" "$LATEST_URL" || { echo "Error: Download failed"; exit 1; } + echo "Downloaded $FILE_NAME to $DOWNLOAD_DIR" +fi + +# Extract the tarball +EXTRACT_DIR="$DOWNLOAD_DIR/extracted" +mkdir -p "$EXTRACT_DIR" +tar -xJf "$FILE_PATH" -C "$EXTRACT_DIR" || { echo "Error: Extraction failed"; exit 1; } + +# Find the extracted directory (e.g., TriliumNotes-Server-0.97.2-linux-x64) +INNER_DIR=$(find "$EXTRACT_DIR" -maxdepth 1 -type d -name "TriliumNotes-Server-*-linux-x64" | head -n 1) +if [ -z "$INNER_DIR" ]; then + echo "Error: Could not find extracted directory matching TriliumNotes-Server-*-linux-x64" + exit 1 +fi + +# Stop the trilium-server service +if systemctl is-active --quiet "$SERVICE_NAME"; then + echo "Stopping $SERVICE_NAME service..." + sudo systemctl stop "$SERVICE_NAME" || { echo "Error: Failed to stop $SERVICE_NAME"; exit 1; } +fi + +# Copy contents to /opt/trilium, overwriting existing files +echo "Copying contents from $INNER_DIR to $OUTPUT_DIR..." +sudo mkdir -p "$OUTPUT_DIR" +sudo cp -r "$INNER_DIR"/* "$OUTPUT_DIR"/ || { echo "Error: Copy failed"; exit 1; } +echo "Files copied to $OUTPUT_DIR" + +# Start the trilium-server service +echo "Starting $SERVICE_NAME service..." +sudo systemctl start "$SERVICE_NAME" || { echo "Error: Failed to start $SERVICE_NAME"; exit 1; } + +# Clean up +rm -rf "$EXTRACT_DIR" +echo "Cleanup complete. Trilium updated successfully." +``` ## Common issues @@ -76,4 +153,4 @@ If you get an error like this, you need to either upgrade your glibc (typically ## TLS -Don't forget to [configure TLS](../TLS%20Configuration.md), which is required for secure usage! \ No newline at end of file +Don't forget to [configure TLS](../TLS%20Configuration.md), which is required for secure usage! From f39a5c55ba6fd274582f0e965b4fa41e0e21f6b1 Mon Sep 17 00:00:00 2001 From: serossi <41602856+serossi@users.noreply.github.com> Date: Wed, 6 Aug 2025 16:30:39 +0200 Subject: [PATCH 03/17] Update Packaged version for Linux.md Updated the Script for Version check --- .../Packaged version for Linux.md | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/docs/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Packaged version for Linux.md b/docs/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Packaged version for Linux.md index b2773f49a..e92290cb4 100644 --- a/docs/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Packaged version for Linux.md +++ b/docs/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Packaged version for Linux.md @@ -68,6 +68,7 @@ if you run as root please remove 'sudo' from the commands requires "jq" ```apt install jq``` It will stop the service above, overwrite everything (i expect no config.ini), and start service +It also creates a version file in the Trilium directory so it updates only with a newer Version ``` #!/bin/bash @@ -78,6 +79,7 @@ PATTERN="TriliumNotes-Server-.*-linux-x64.tar.xz" DOWNLOAD_DIR="/var/tmp/trilium_download" OUTPUT_DIR="/opt/trilium" SERVICE_NAME="trilium" +VERSION_FILE="$OUTPUT_DIR/version.txt" # Ensure dependencies are installed command -v curl >/dev/null 2>&1 || { echo "Error: curl is required"; exit 1; } @@ -87,6 +89,27 @@ command -v tar >/dev/null 2>&1 || { echo "Error: tar is required"; exit 1; } # Create download directory mkdir -p "$DOWNLOAD_DIR" || { echo "Error: Cannot create $DOWNLOAD_DIR"; exit 1; } +# Get the latest release version +LATEST_VERSION=$(curl -sL https://api.github.com/repos/$REPO/releases/latest | jq -r '.tag_name') +if [ -z "$LATEST_VERSION" ]; then + echo "Error: Could not fetch latest release version" + exit 1 +fi + +# Check current installed version (from version.txt or existing tarball) +CURRENT_VERSION="" +if [ -f "$VERSION_FILE" ]; then + CURRENT_VERSION=$(cat "$VERSION_FILE") +elif [ -f "$DOWNLOAD_DIR/TriliumNotes-Server-$LATEST_VERSION-linux-x64.tar.xz" ]; then + CURRENT_VERSION="$LATEST_VERSION" +fi + +# Compare versions +if [ "$CURRENT_VERSION" = "$LATEST_VERSION" ]; then + echo "Latest version ($LATEST_VERSION) is already installed" + exit 0 +fi + # Download the latest release LATEST_URL=$(curl -sL https://api.github.com/repos/$REPO/releases/latest | jq -r ".assets[] | select(.name | test(\"$PATTERN\")) | .browser_download_url") if [ -z "$LATEST_URL" ]; then @@ -97,7 +120,7 @@ fi FILE_NAME=$(basename "$LATEST_URL") FILE_PATH="$DOWNLOAD_DIR/$FILE_NAME" -# Check if the file already exists and is up-to-date +# Download if not already present if [ -f "$FILE_PATH" ]; then echo "Latest release $FILE_NAME already downloaded" else @@ -127,6 +150,7 @@ fi echo "Copying contents from $INNER_DIR to $OUTPUT_DIR..." sudo mkdir -p "$OUTPUT_DIR" sudo cp -r "$INNER_DIR"/* "$OUTPUT_DIR"/ || { echo "Error: Copy failed"; exit 1; } +echo "$LATEST_VERSION" | sudo tee "$VERSION_FILE" >/dev/null echo "Files copied to $OUTPUT_DIR" # Start the trilium-server service @@ -135,7 +159,7 @@ sudo systemctl start "$SERVICE_NAME" || { echo "Error: Failed to start $SERVICE_ # Clean up rm -rf "$EXTRACT_DIR" -echo "Cleanup complete. Trilium updated successfully." +echo "Cleanup complete. Trilium updated to $LATEST_VERSION." ``` ## Common issues From d975790e79304eca49e8fd27e7ccb472ddfe9d42 Mon Sep 17 00:00:00 2001 From: Papierkorb2292 <104673791+Papierkorb2292@users.noreply.github.com> Date: Fri, 8 Aug 2025 09:15:01 +0200 Subject: [PATCH 04/17] Added zen mode for mobile layout (useful on tablets) --- apps/client/src/layouts/mobile_layout.ts | 4 +++- apps/client/src/stylesheets/style.css | 8 +++++++- apps/client/src/widgets/buttons/global_menu.ts | 1 - apps/client/src/widgets/close_zen_button.ts | 6 ++++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/apps/client/src/layouts/mobile_layout.ts b/apps/client/src/layouts/mobile_layout.ts index ba656d445..10b6d2ebe 100644 --- a/apps/client/src/layouts/mobile_layout.ts +++ b/apps/client/src/layouts/mobile_layout.ts @@ -26,6 +26,7 @@ import TabRowWidget from "../widgets/tab_row.js"; import RefreshButton from "../widgets/floating_buttons/refresh_button.js"; import MobileEditorToolbar from "../widgets/ribbon_widgets/mobile_editor_toolbar.js"; import { applyModals } from "./layout_commons.js"; +import CloseZenButton from "../widgets/close_zen_button.js"; const MOBILE_CSS = `