Merge remote-tracking branch 'origin/develop' into feat/ts-unit-and-integration-tests

; Conflicts:
;	package.json
;	tsconfig.json
This commit is contained in:
Elian Doran 2024-07-15 21:17:20 +03:00
commit 6a7eb9b34f
No known key found for this signature in database
47 changed files with 487 additions and 156 deletions

View File

@ -5,3 +5,6 @@
/docs /docs
/npm-debug.log /npm-debug.log
node_modules node_modules
src/**/*.ts
!src/services/asset_path.ts

25
.github/workflows/dev.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: Dev
on:
push:
jobs:
build_docker:
name: Build Docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up node & dependencies
uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
- run: npm ci
- name: Run the TypeScript build
run: npx tsc
- name: Create server-package.json
run: cat package.json | grep -v electron > server-package.json
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max

147
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,147 @@
name: Main
on:
push:
branches:
- 'develop'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build_darwin-x64:
name: Build macOS x86_64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up node & dependencies
uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
- run: npm ci
- run: ./bin/build-mac-x64.sh
- uses: actions/upload-artifact@v4
with:
name: trilium-mac-x64.zip
path: dist/trilium-mac-x64*.zip
build_darwin-arm64:
name: Build macOS aarch64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up node & dependencies
uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
- run: npm ci
- run: ./bin/build-mac-arm64.sh
- uses: actions/upload-artifact@v4
with:
name: trilium-mac-arm64.zip
path: dist/trilium-mac-arm64*.zip
build_linux-x64:
name: Build Linux x86_64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up node & dependencies
uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
- run: npm ci
- run: ./bin/build-linux-x64.sh
- uses: actions/upload-artifact@v4
with:
name: trilium-linux-x64.tar.xz
path: dist/trilium-linux-x64-*.tar.xz
- uses: actions/upload-artifact@v4
with:
name: trilium_amd64.deb
path: dist/trilium_*.deb
build_linux_server-x64:
name: Build Linux Server x86_64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up node & dependencies
uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
- run: npm ci
- run: ./bin/build-server.sh
- uses: actions/upload-artifact@v4
with:
name: trilium-linux-x64-server.tar.xz
path: dist/trilium-linux-x64-server-*.tar.xz
build_windows-x64:
name: Build Windows x86_64
runs-on: ubuntu-latest
steps:
- name: Set up Wine
run: |
sudo dpkg --add-architecture i386
wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
sudo add-apt-repository ppa:cybermax-dexter/sdl2-backport
sudo apt-add-repository "deb https://dl.winehq.org/wine-builds/ubuntu $(lsb_release -cs) main"
sudo apt install --install-recommends winehq-stable
- uses: actions/checkout@v4
- name: Set up node & dependencies
uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
- run: npm ci
- run: ./bin/build-win-x64.sh
- uses: actions/upload-artifact@v4
with:
name: trilium-windows-x64.zip
path: dist/trilium-windows-x64-*.zip
build_docker:
name: Build Docker image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Set up node & dependencies
uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
- run: npm ci
- name: Run the TypeScript build
run: npx tsc
- name: Create server-package.json
run: cat package.json | grep -v electron > server-package.json
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6
id: push
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
.DS_Store .DS_Store
node_modules/ node_modules/
dist/ dist/
build/
src/public/app-dist/ src/public/app-dist/
npm-debug.log npm-debug.log
yarn-error.log yarn-error.log

View File

@ -1,5 +1,5 @@
{ {
"editor.formatOnSave": true, "editor.formatOnSave": false,
"editor.defaultFormatter": "esbenp.prettier-vscode", "editor.defaultFormatter": "esbenp.prettier-vscode",
"files.eol": "\n", "files.eol": "\n",
"typescript.tsdk": "node_modules/typescript/lib" "typescript.tsdk": "node_modules/typescript/lib"

View File

@ -1,6 +1,18 @@
# !!! Don't try to build this Dockerfile directly, run it through bin/build-docker.sh script !!! # !!! Don't try to build this Dockerfile directly, run it through bin/build-docker.sh script !!!
FROM node:18.18.2-alpine FROM node:18.18.2-alpine
# Configure system dependencies
RUN apk add --no-cache --virtual .build-dependencies \
autoconf \
automake \
g++ \
gcc \
libtool \
make \
nasm \
libpng-dev \
python3
# Create app directory # Create app directory
WORKDIR /usr/src/app WORKDIR /usr/src/app
@ -9,25 +21,21 @@ COPY . .
COPY server-package.json package.json COPY server-package.json package.json
# Copy TypeScript build artifacts into the original directory structure.
RUN ls
RUN cp -R build/src/* src/.
RUN rm -r build
# Install app dependencies # Install app dependencies
RUN set -x \ RUN set -x \
&& apk add --no-cache --virtual .build-dependencies \
autoconf \
automake \
g++ \
gcc \
libtool \
make \
nasm \
libpng-dev \
python3 \
&& npm install \ && npm install \
&& apk del .build-dependencies \ && apk del .build-dependencies \
&& npm run webpack \ && npm run webpack \
&& npm prune --omit=dev \ && npm prune --omit=dev \
&& cp src/public/app/share.js src/public/app-dist/. \ && cp src/public/app/share.js src/public/app-dist/. \
&& cp -r src/public/app/doc_notes src/public/app-dist/. \ && cp -r src/public/app/doc_notes src/public/app-dist/. \
&& rm -rf src/public/app && rm -rf src/public/app \
&& rm src/services/asset_path.ts
# Some setup tools need to be kept # Some setup tools need to be kept
RUN apk add --no-cache su-exec shadow RUN apk add --no-cache su-exec shadow

View File

@ -1,98 +1,95 @@
# Trilium Notes # TriliumNext Notes
## Trilium is in maintenance mode - see details in https://github.com/zadam/trilium/issues/4620 [English](https://github.com/TriliumNext/Notes/blob/master/README.md) | [Chinese](https://github.com/TriliumNext/Notes/blob/master/README-ZH_CN.md) | [Russian](https://github.com/TriliumNext/Notes/blob/master/README.ru.md) | [Japanese](https://github.com/TriliumNext/Notes/blob/master/README.ja.md) | [Italian](https://github.com/TriliumNext/Notes/blob/master/README.it.md)
Preliminary disccusions on the successor organization are taking place in [Trilium Next discussions](https://github.com/orgs/TriliumNext/discussions). TriliumNext Notes is a hierarchical note taking application with focus on building large personal knowledge bases.
[English](https://github.com/zadam/trilium/blob/master/README.md) | [Chinese](https://github.com/zadam/trilium/blob/master/README-ZH_CN.md) | [Russian](https://github.com/zadam/trilium/blob/master/README.ru.md) | [Japanese](https://github.com/zadam/trilium/blob/master/README.ja.md) | [Italian](https://github.com/zadam/trilium/blob/master/README.it.md) See [screenshots](https://triliumnext.github.io/Docs/Wiki/Screenshot%20tour) for quick overview:
<a href="https://triliumnext.github.io/Docs/Wiki/Screenshot%20tour"><img src="https://github.com/TriliumNext/Docs/blob/main/Wiki/images/screenshot.png?raw=true" alt="Trilium Screenshot" width="1000"></a>
Trilium Notes is a hierarchical note taking application with focus on building large personal knowledge bases. ## ⚠️ Why TriliumNext?
## Discuss with us [The original Trilium project is in maintenance mode](https://github.com/zadam/trilium/issues/4620)
Feel free to join our discussions. ## 🗭 Discuss with us
- [XMPP](https://joinjabber.org/): [xmpp:discuss@trilium.thisgreat.party?join](xmpp:discuss@trilium.thisgreat.party?join) ([web link](https://anonymous.cheogram.com/discuss@trilium.thisgreat.party)) Feel free to join our official discussions and community. We are focused on the development on Trilium, and would love to hear what features, suggestions, or issues you may have!
- [Matrix](https://matrix.org/try-matrix/): #trilium:matrix.org ([web link](https://app.element.io/#/room/#trilium:matrix.org))
The two rooms are mirrored, so you can use the protocol of your choice, from the client you prefer, on pretty much any platform under the sun! - [Matrix](https://matrix.to/#/#triliumnext:matrix.org) (For synchronous discussions)
- [Github Discussions](https://github.com/TriliumNext/Notes/discussions) (For Asynchronous discussions)
- [Wiki](https://github.com/zadam/trilium/wiki) (For common how-to questions and user guides)
See [screenshots](https://github.com/zadam/trilium/wiki/Screenshot-tour) for quick overview: The two rooms linked above are mirrored, so you can use either XMPP or Matrix, from any client you prefer, on pretty much any platform under the sun!
<a href="https://github.com/zadam/trilium/wiki/Screenshot-tour"><img src="https://raw.githubusercontent.com/wiki/zadam/trilium/images/screenshot.png" alt="Trilium Screenshot" width="1000"></a> ### Unofficial Communities
Ukraine is currently defending itself from Russian aggression, please consider [donating to Ukrainian Army or humanitarian charities](https://standforukraine.com/). [Trilium Rocks](https://discord.gg/aqdX9mXX4r)
<p float="left">
<img src="https://upload.wikimedia.org/wikipedia/commons/4/49/Flag_of_Ukraine.svg" alt="drawing" width="400"/>
<img src="https://signmyrocket.com//uploads/2b2a523cd0c0e76cdbba95a89a9636b2_1676971281.jpg" alt="Trilium Notes supports Ukraine!" width="570"/>
</p>
## 🎁 Features ## 🎁 Features
* Notes can be arranged into arbitrarily deep tree. Single note can be placed into multiple places in the tree (see [cloning](https://github.com/zadam/trilium/wiki/Cloning-notes)) * Notes can be arranged into arbitrarily deep tree. Single note can be placed into multiple places in the tree (see [cloning](https://triliumnext.github.io/Docs/Wiki/Cloning-notes))
* Rich WYSIWYG note editing including e.g. tables, images and [math](https://github.com/zadam/trilium/wiki/Text-notes#math-support) with markdown [autoformat](https://github.com/zadam/trilium/wiki/Text-notes#autoformat) * Rich WYSIWYG note editing including e.g. tables, images and [math](https://triliumnext.github.io/Docs/Wiki/Text-notes) with markdown [autoformat](https://triliumnext.github.io/Docs/Wiki/Text-notes#autoformat)
* Support for editing [notes with source code](https://github.com/zadam/trilium/wiki/Code-notes), including syntax highlighting * Support for editing [notes with source code](https://triliumnext.github.io/Docs/Wiki/Code-notes), including syntax highlighting
* Fast and easy [navigation between notes](https://github.com/zadam/trilium/wiki/Note-navigation), full text search and [note hoisting](https://github.com/zadam/trilium/wiki/Note-hoisting) * Fast and easy [navigation between notes](https://triliumnext.github.io/Docs/Wiki/Note-navigation), full text search and [note hoisting](https://triliumnext.github.io/Docs/Wiki/Note-hoisting)
* Seamless [note versioning](https://github.com/zadam/trilium/wiki/Note-revisions) * Seamless [note versioning](https://triliumnext.github.io/Docs/Wiki/Note-revisions)
* Note [attributes](https://github.com/zadam/trilium/wiki/Attributes) can be used for note organization, querying and advanced [scripting](https://github.com/zadam/trilium/wiki/Scripts) * Note [attributes](https://triliumnext.github.io/Docs/Wiki/Attributes) can be used for note organization, querying and advanced [scripting](https://triliumnext.github.io/Docs/Wiki/Scripts)
* [Synchronization](https://github.com/zadam/trilium/wiki/Synchronization) with self-hosted sync server * [Synchronization](https://triliumnext.github.io/Docs/Wiki/Synchronization) with self-hosted sync server
* there's a [3rd party service for hosting synchronisation server](https://trilium.cc/paid-hosting) * there's a [3rd party service for hosting synchronisation server](https://trilium.cc/paid-hosting)
* [Sharing](https://github.com/zadam/trilium/wiki/Sharing) (publishing) notes to public internet * [Sharing](https://triliumnext.github.io/Docs/Wiki/Sharing) (publishing) notes to public internet
* Strong [note encryption](https://github.com/zadam/trilium/wiki/Protected-notes) with per-note granularity * Strong [note encryption](https://triliumnext.github.io/Docs/Wiki/Protected-notes) with per-note granularity
* Sketching diagrams with built-in Excalidraw (note type "canvas") * Sketching diagrams with built-in Excalidraw (note type "canvas")
* [Relation maps](https://github.com/zadam/trilium/wiki/Relation-map) and [link maps](https://github.com/zadam/trilium/wiki/Link-map) for visualizing notes and their relations * [Relation maps](https://triliumnext.github.io/Docs/Wiki/Relation-map) and [link maps](https://triliumnext.github.io/Docs/Wiki/Link-map) for visualizing notes and their relations
* [Scripting](https://github.com/zadam/trilium/wiki/Scripts) - see [Advanced showcases](https://github.com/zadam/trilium/wiki/Advanced-showcases) * [Scripting](https://triliumnext.github.io/Docs/Wiki/Scripts) - see [Advanced showcases](https://triliumnext.github.io/Docs/Wiki/Advanced-showcases)
* [REST API](https://github.com/zadam/trilium/wiki/ETAPI) for automation * [REST API](https://triliumnext.github.io/Docs/Wiki/ETAPI) for automation
* Scales well in both usability and performance upwards of 100 000 notes * Scales well in both usability and performance upwards of 100 000 notes
* Touch optimized [mobile frontend](https://github.com/zadam/trilium/wiki/Mobile-frontend) for smartphones and tablets * Touch optimized [mobile frontend](https://triliumnext.github.io/Docs/Wiki/Mobile-frontend) for smartphones and tablets
* [Night theme](https://github.com/zadam/trilium/wiki/Themes) * [Night theme](https://triliumnext.github.io/Docs/Wiki/Themes)
* [Evernote](https://github.com/zadam/trilium/wiki/Evernote-import) and [Markdown import & export](https://github.com/zadam/trilium/wiki/Markdown) * [Evernote](https://triliumnext.github.io/Docs/Wiki/Evernote-import) and [Markdown import & export](https://triliumnext.github.io/Docs/Wiki/Markdown)
* [Web Clipper](https://github.com/zadam/trilium/wiki/Web-clipper) for easy saving of web content * [Web Clipper](https://triliumnext.github.io/Docs/Wiki/Web-clipper) for easy saving of web content
Check out [awesome-trilium](https://github.com/Nriver/awesome-trilium) for 3rd party themes, scripts, plugins and more. ✨ Check out the following third-party resources for more TriliumNext related goodies:
- [awesome-trilium](https://github.com/Nriver/awesome-trilium) for 3rd party themes, scripts, plugins and more.
- [TriliumRocks!](https://trilium.rocks/) for tutorials, guides, and much more.
## 🏗 Builds ## 🏗 Builds
Trilium is provided as either desktop application (Linux and Windows) or web application hosted on your server (Linux). Mac OS desktop build is available, but it is [unsupported](https://github.com/zadam/trilium/wiki/FAQ#mac-os-support). Trilium is provided as either desktop application (Linux and Windows) or web application hosted on your server (Linux). Mac OS desktop build is available, but it is [unsupported](https://triliumnext.github.io/Docs/Wiki/FAQ#mac-os-support).
* If you want to use Trilium on the desktop, download binary release for your platform from [latest release](https://github.com/zadam/trilium/releases/latest), unzip the package and run ```trilium``` executable. * If you want to use TriliumNext on the desktop, download binary release for your platform from [latest release](https://github.com/TriliumNext/Notes/releases/latest), unzip the package and run ```trilium``` executable.
* If you want to install Trilium on server, follow [this page](https://github.com/zadam/trilium/wiki/Server-installation). * If you want to install TriliumNext on your own server, follow [this page](https://triliumnext.github.io/Docs/Wiki/Server-installation).
* Currently only recent Chrome and Firefox are supported (tested) browsers. * Currently only recent versions of Chrome and Firefox are supported (tested) browsers.
Trilium is also provided as a Flatpak: TriliumNext will also provided as a Flatpak:
[<img width="240" src="https://flathub.org/assets/badges/flathub-badge-en.png">](https://flathub.org/apps/details/com.github.zadam.trilium) <img width="240" src="https://flathub.org/assets/badges/flathub-badge-en.png">
## 📝 Documentation ## 📝 Documentation
[See wiki for complete list of documentation pages.](https://github.com/zadam/trilium/wiki/) [See wiki for complete list of documentation pages.](https://triliumnext.github.io/Docs)
You can also read [Patterns of personal knowledge base](https://github.com/zadam/trilium/wiki/Patterns-of-personal-knowledge-base) to get some inspiration on how you might use Trilium. You can also read [Patterns of personal knowledge base](https://triliumnext.github.io/Docs/Wiki/Patterns-of-personal-knowledge-base) to get some inspiration on how you might use Trilium.
## 💻 Contribute ## 💻 Contribute
Use a browser based dev environment Clone locally and run
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/zadam/trilium)
Or clone locally and run
``` ```
npm install npm install
npm run start-server npm run start-server
``` ```
## 📢 Shoutouts ## 👏 Shoutouts
* [CKEditor 5](https://github.com/ckeditor/ckeditor5) - best WYSIWYG editor on the market, very interactive and listening team * [CKEditor 5](https://github.com/ckeditor/ckeditor5) - best WYSIWYG editor on the market, very interactive and listening team
* [FancyTree](https://github.com/mar10/fancytree) - very feature rich tree library without real competition. Trilium Notes would not be the same without it. * [FancyTree](https://github.com/mar10/fancytree) - very feature rich tree library without real competition. Trilium Notes would not be the same without it.
* [CodeMirror](https://github.com/codemirror/CodeMirror) - code editor with support for huge amount of languages * [CodeMirror](https://github.com/codemirror/CodeMirror) - code editor with support for huge amount of languages
* [jsPlumb](https://github.com/jsplumb/jsplumb) - visual connectivity library without competition. Used in [relation maps](https://github.com/zadam/trilium/wiki/Relation-map) and [link maps](https://github.com/zadam/trilium/wiki/Link-map) * [jsPlumb](https://github.com/jsplumb/jsplumb) - visual connectivity library without competition. Used in [relation maps](https://triliumnext.github.io/Docs/Wiki/Relation-map) and [link maps](https://triliumnext.github.io/Docs/Wiki/Link-map)
## 🤝 Support ## 🤝 Support
You can support Trilium using GitHub Sponsors, [PayPal](https://paypal.me/za4am) or Bitcoin (bitcoin:bc1qv3svjn40v89mnkre5vyvs2xw6y8phaltl385d2). You can support the original Trilium developer using GitHub Sponsors, [PayPal](https://paypal.me/za4am) or Bitcoin (bitcoin:bc1qv3svjn40v89mnkre5vyvs2xw6y8phaltl385d2).
Support for the TriliumNext organization will be possible in the near future.
## 🔑 License ## 🔑 License

Binary file not shown.

View File

@ -1,5 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if ! command -v dpkg-deb &> /dev/null; then
echo "Missing command: dpkg-deb"
exit 1
fi
if dpkg-deb 2>&1 | grep BusyBox &> /dev/null; then
echo "The dpkg-deb binary provided by BusyBox is not compatible. The Debian tool needs to be used instead."
exit 1
fi
echo "Packaging debian x64 distribution..." echo "Packaging debian x64 distribution..."
VERSION=`jq -r ".version" package.json` VERSION=`jq -r ".version" package.json`

View File

@ -5,6 +5,9 @@ SERIES=${VERSION:0:4}-latest
cat package.json | grep -v electron > server-package.json cat package.json | grep -v electron > server-package.json
echo "Compiling typescript..."
npx tsc
sudo docker build -t zadam/trilium:$VERSION --network host -t zadam/trilium:$SERIES . sudo docker build -t zadam/trilium:$VERSION --network host -t zadam/trilium:$SERIES .
if [[ $VERSION != *"beta"* ]]; then if [[ $VERSION != *"beta"* ]]; then

View File

@ -1,5 +1,25 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if ! command -v jq &> /dev/null; then
echo "Missing command: jq"
exit 1
fi
if ! command -v fakeroot &> /dev/null; then
echo "Missing command: fakeroot"
exit 1
fi
if ! command -v dpkg-deb &> /dev/null; then
echo "Missing command: dpkg-deb"
exit 1
fi
if dpkg-deb 2>&1 | grep BusyBox &> /dev/null; then
echo "The dpkg-deb binary provided by BusyBox is not compatible. The Debian tool needs to be used instead."
exit 1
fi
SRC_DIR=./dist/trilium-linux-x64-src SRC_DIR=./dist/trilium-linux-x64-src
[ "$1" != "DONTCOPY" ] && ./bin/copy-trilium.sh "$SRC_DIR" [ "$1" != "DONTCOPY" ] && ./bin/copy-trilium.sh "$SRC_DIR"

38
bin/build-mac-arm64.sh Executable file
View File

@ -0,0 +1,38 @@
#!/usr/bin/env bash
SRC_DIR=./dist/trilium-mac-arm64-src
if [ "$1" != "DONTCOPY" ]
then
./bin/copy-trilium.sh $SRC_DIR
fi
echo "Copying required mac arm64 binaries"
cp -r bin/better-sqlite3/mac-arm64-better_sqlite3.node $SRC_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node
rm -r $SRC_DIR/src/public/app-dist/*.mobile.*
echo "Packaging mac arm64 electron build"
./node_modules/.bin/electron-packager $SRC_DIR --asar --out=dist --executable-name=trilium --platform=darwin --arch=arm64 --overwrite --icon=images/app-icons/mac/icon.icns
BUILD_DIR=./dist/trilium-mac-arm64
rm -rf $BUILD_DIR
# Mac build has by default useless directory level
mv "./dist/Trilium Notes-darwin-arm64" $BUILD_DIR
cp bin/tpl/anonymize-database.sql $BUILD_DIR/
cp -r dump-db $BUILD_DIR/
rm -rf $BUILD_DIR/dump-db/node_modules
echo "Zipping mac arm64 electron distribution..."
VERSION=`jq -r ".version" package.json`
cd dist
rm trilium-mac-arm64-${VERSION}.zip
zip -r9 --symlinks trilium-mac-arm64-${VERSION}.zip trilium-mac-arm64

View File

@ -7,9 +7,9 @@ then
./bin/copy-trilium.sh $SRC_DIR ./bin/copy-trilium.sh $SRC_DIR
fi fi
echo "Copying required mac binaries" echo "Copying required mac x64 binaries"
cp -r bin/better-sqlite3/mac-better_sqlite3.node $SRC_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node cp -r bin/better-sqlite3/mac-x64-better_sqlite3.node $SRC_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node
rm -r $SRC_DIR/src/public/app-dist/*.mobile.* rm -r $SRC_DIR/src/public/app-dist/*.mobile.*

View File

@ -1,5 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if ! command -v wine &> /dev/null; then
echo "Missing command: wine"
exit 1
fi
SRC_DIR=./dist/trilium-windows-x64-src SRC_DIR=./dist/trilium-windows-x64-src
if [ "$1" != "DONTCOPY" ] if [ "$1" != "DONTCOPY" ]

View File

@ -1,5 +1,30 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if ! command -v jq &> /dev/null; then
echo "Missing command: jq"
exit 1
fi
if ! command -v fakeroot &> /dev/null; then
echo "Missing command: fakeroot"
exit 1
fi
if ! command -v dpkg-deb &> /dev/null; then
echo "Missing command: dpkg-deb"
exit 1
fi
if dpkg-deb 2>&1 | grep BusyBox &> /dev/null; then
echo "The dpkg-deb binary provided by BusyBox is not compatible. The Debian tool needs to be used instead."
exit 1
fi
if ! command -v wine &> /dev/null; then
echo "Missing command: wine"
exit 1
fi
echo "Deleting existing builds" echo "Deleting existing builds"
rm -rf dist/* rm -rf dist/*
@ -13,11 +38,15 @@ cp -r $SRC_DIR ./dist/trilium-linux-x64-src
cp -r $SRC_DIR ./dist/trilium-linux-x64-server cp -r $SRC_DIR ./dist/trilium-linux-x64-server
cp -r $SRC_DIR ./dist/trilium-windows-x64-src cp -r $SRC_DIR ./dist/trilium-windows-x64-src
cp -r $SRC_DIR ./dist/trilium-mac-x64-src cp -r $SRC_DIR ./dist/trilium-mac-x64-src
cp -r $SRC_DIR ./dist/trilium-mac-arm64-src
set -e
bin/build-win-x64.sh DONTCOPY bin/build-win-x64.sh DONTCOPY
bin/build-mac-x64.sh DONTCOPY bin/build-mac-x64.sh DONTCOPY
bin/build-mac-arm64.sh DONTCOPY
bin/build-linux-x64.sh DONTCOPY bin/build-linux-x64.sh DONTCOPY
bin/build-server.sh DONTCOPY bin/build-server.sh DONTCOPY

View File

@ -1,5 +1,5 @@
const fs = require("fs-extra"); import fs from "fs-extra";
const path = require("path"); import path from "path";
const DEST_DIR = "./dist"; const DEST_DIR = "./dist";
const DEST_DIR_SRC = path.join(DEST_DIR, "src"); const DEST_DIR_SRC = path.join(DEST_DIR, "src");
@ -15,6 +15,12 @@ async function copyNodeModuleFileOrFolder(source: string) {
} }
const copy = async () => { const copy = async () => {
for (const srcFile of fs.readdirSync("build")) {
const destFile = path.join(DEST_DIR, path.basename(srcFile));
console.log(`Copying source ${srcFile} -> ${destFile}.`);
fs.copySync(path.join("build", srcFile), destFile, { recursive: true });
}
const filesToCopy = ["config-sample.ini"]; const filesToCopy = ["config-sample.ini"];
for (const file of filesToCopy) { for (const file of filesToCopy) {
console.log(`Copying ${file}`); console.log(`Copying ${file}`);
@ -27,11 +33,11 @@ const copy = async () => {
await fs.copy(dir, path.join(DEST_DIR, dir)); await fs.copy(dir, path.join(DEST_DIR, dir));
} }
const srcDirsToCopy = ["./src/public", "./src/views"]; const srcDirsToCopy = ["./src/public", "./src/views", "./build"];
for (const dir of srcDirsToCopy) { for (const dir of srcDirsToCopy) {
console.log(`Copying ${dir}`); console.log(`Copying ${dir}`);
await fs.copy(dir, path.join(DEST_DIR_SRC, path.basename(dir))); await fs.copy(dir, path.join(DEST_DIR_SRC, path.basename(dir)));
} }
const nodeModulesFile = [ const nodeModulesFile = [
"node_modules/react/umd/react.production.min.js", "node_modules/react/umd/react.production.min.js",

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
shopt -s globstar
if [[ $# -eq 0 ]] ; then if [[ $# -eq 0 ]] ; then
echo "Missing argument of target directory" echo "Missing argument of target directory"
exit 1 exit 1
@ -9,25 +11,36 @@ if ! [[ $(which npm) ]]; then
exit 1 exit 1
fi fi
n exec 18.18.2 npm run webpack || npm run webpack # Trigger the TypeScript build
echo TypeScript build start
npx tsc
echo TypeScript build finished
# Copy the TypeScript artifacts
DIR="$1" DIR="$1"
rm -rf "$DIR" rm -rf "$DIR"
mkdir -pv "$DIR" mkdir -pv "$DIR"
echo Webpack start
npm run webpack
echo Webpack finish
echo "Copying Trilium to build directory $DIR" echo "Copying Trilium to build directory $DIR"
for d in 'images' 'libraries' 'src' 'db'; do for d in 'images' 'libraries' 'src' 'db'; do
cp -r "$d" "$DIR"/ cp -r "$d" "$DIR"/
done done
for f in 'package.json' 'package-lock.json' 'README.md' 'LICENSE' 'config-sample.ini' 'electron.js'; do
for f in 'package.json' 'package-lock.json' 'README.md' 'LICENSE' 'config-sample.ini'; do
cp "$f" "$DIR"/ cp "$f" "$DIR"/
done done
cp webpack-* "$DIR"/ # here warning because there is no 'webpack-*', but webpack.config.js only
script_dir=$(realpath $(dirname $0))
cp -Rv "$script_dir/../build/src" "$DIR"
cp "$script_dir/../build/electron.js" "$DIR"
# run in subshell (so we return to original dir) # run in subshell (so we return to original dir)
(cd $DIR && n exec 18.18.2 npm install --only=prod) (cd $DIR && npm install --only=prod)
if [[ -d "$DIR"/node_modules ]]; then if [[ -d "$DIR"/node_modules ]]; then
# cleanup of useless files in dependencies # cleanup of useless files in dependencies

View File

@ -7,6 +7,11 @@ if [[ $# -eq 0 ]] ; then
exit 1 exit 1
fi fi
if ! command -v jq &> /dev/null; then
echo "Missing command: jq"
exit 1
fi
VERSION=$1 VERSION=$1
if ! [[ ${VERSION} =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}(-.+)?$ ]] ; if ! [[ ${VERSION} =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}(-.+)?$ ]] ;
@ -22,7 +27,8 @@ fi
echo "Releasing Trilium $VERSION" echo "Releasing Trilium $VERSION"
jq '.version = "'$VERSION'"' package.json|sponge package.json jq '.version = "'$VERSION'"' package.json > package.json.tmp
mv package.json.tmp package.json
git add package.json git add package.json
@ -48,6 +54,7 @@ LINUX_X64_BUILD=trilium-linux-x64-$VERSION.tar.xz
DEBIAN_X64_BUILD=trilium_${VERSION}_amd64.deb DEBIAN_X64_BUILD=trilium_${VERSION}_amd64.deb
WINDOWS_X64_BUILD=trilium-windows-x64-$VERSION.zip WINDOWS_X64_BUILD=trilium-windows-x64-$VERSION.zip
MAC_X64_BUILD=trilium-mac-x64-$VERSION.zip MAC_X64_BUILD=trilium-mac-x64-$VERSION.zip
MAC_ARM64_BUILD=trilium-mac-arm64-$VERSION.zip
SERVER_BUILD=trilium-linux-x64-server-$VERSION.tar.xz SERVER_BUILD=trilium-linux-x64-server-$VERSION.tar.xz
echo "Creating release in GitHub" echo "Creating release in GitHub"
@ -68,4 +75,5 @@ gh release create "$TAG" \
"dist/$LINUX_X64_BUILD" \ "dist/$LINUX_X64_BUILD" \
"dist/$WINDOWS_X64_BUILD" \ "dist/$WINDOWS_X64_BUILD" \
"dist/$MAC_X64_BUILD" \ "dist/$MAC_X64_BUILD" \
"dist/$MAC_ARM64_BUILD" \
"dist/$SERVER_BUILD" "dist/$SERVER_BUILD"

17
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "trilium", "name": "trilium",
"version": "0.63.6", "version": "0.90.0-beta",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "trilium", "name": "trilium",
"version": "0.63.6", "version": "0.90.0-beta",
"hasInstallScript": true, "hasInstallScript": true,
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"dependencies": { "dependencies": {
@ -100,6 +100,7 @@
"@types/express-session": "^1.18.0", "@types/express-session": "^1.18.0",
"@types/html": "^1.0.4", "@types/html": "^1.0.4",
"@types/ini": "^4.1.0", "@types/ini": "^4.1.0",
"@types/jasmine": "^5.1.4",
"@types/jsdom": "^21.1.6", "@types/jsdom": "^21.1.6",
"@types/mime-types": "^2.1.4", "@types/mime-types": "^2.1.4",
"@types/multer": "^1.4.11", "@types/multer": "^1.4.11",
@ -1408,6 +1409,12 @@
"integrity": "sha512-mTehMtc+xtnWBBvqizcqYCktKDBH2WChvx1GU3Sfe4PysFDXiNe+1YwtpVX1MDtCa4NQrSPw2+3HmvXHY3gt1w==", "integrity": "sha512-mTehMtc+xtnWBBvqizcqYCktKDBH2WChvx1GU3Sfe4PysFDXiNe+1YwtpVX1MDtCa4NQrSPw2+3HmvXHY3gt1w==",
"dev": true "dev": true
}, },
"node_modules/@types/jasmine": {
"version": "5.1.4",
"resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-5.1.4.tgz",
"integrity": "sha512-px7OMFO/ncXxixDe1zR13V1iycqWae0MxTaw62RpFlksUi5QuNWgQJFkTQjIOvrmutJbI7Fp2Y2N1F6D2R4G6w==",
"dev": true
},
"node_modules/@types/jsdom": { "node_modules/@types/jsdom": {
"version": "21.1.6", "version": "21.1.6",
"resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-21.1.6.tgz", "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-21.1.6.tgz",
@ -14458,6 +14465,12 @@
"integrity": "sha512-mTehMtc+xtnWBBvqizcqYCktKDBH2WChvx1GU3Sfe4PysFDXiNe+1YwtpVX1MDtCa4NQrSPw2+3HmvXHY3gt1w==", "integrity": "sha512-mTehMtc+xtnWBBvqizcqYCktKDBH2WChvx1GU3Sfe4PysFDXiNe+1YwtpVX1MDtCa4NQrSPw2+3HmvXHY3gt1w==",
"dev": true "dev": true
}, },
"@types/jasmine": {
"version": "5.1.4",
"resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-5.1.4.tgz",
"integrity": "sha512-px7OMFO/ncXxixDe1zR13V1iycqWae0MxTaw62RpFlksUi5QuNWgQJFkTQjIOvrmutJbI7Fp2Y2N1F6D2R4G6w==",
"dev": true
},
"@types/jsdom": { "@types/jsdom": {
"version": "21.1.6", "version": "21.1.6",
"resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-21.1.6.tgz", "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-21.1.6.tgz",

View File

@ -121,6 +121,7 @@
"@types/express-session": "^1.18.0", "@types/express-session": "^1.18.0",
"@types/html": "^1.0.4", "@types/html": "^1.0.4",
"@types/ini": "^4.1.0", "@types/ini": "^4.1.0",
"@types/jasmine": "^5.1.4",
"@types/jsdom": "^21.1.6", "@types/jsdom": "^21.1.6",
"@types/mime-types": "^2.1.4", "@types/mime-types": "^2.1.4",
"@types/multer": "^1.4.11", "@types/multer": "^1.4.11",

View File

@ -1644,10 +1644,7 @@ class BNote extends AbstractBeccaEntity<BNote> {
position position
}); });
if (!content) { content = content || "";
throw new Error("Attempted to save an attachment with no content.");
}
attachment.setContent(content, {forceSave: true}); attachment.setContent(content, {forceSave: true});
return attachment; return attachment;
@ -1669,7 +1666,7 @@ class BNote extends AbstractBeccaEntity<BNote> {
getPojo(): NotePojo { getPojo(): NotePojo {
return { return {
noteId: this.noteId, noteId: this.noteId,
title: this.title || undefined, title: this.title,
isProtected: this.isProtected, isProtected: this.isProtected,
type: this.type, type: this.type,
mime: this.mime, mime: this.mime,

View File

@ -91,7 +91,8 @@ export interface BranchRow {
* end user. Those types should be used only for checking against, they are * end user. Those types should be used only for checking against, they are
* not for direct use. * not for direct use.
*/ */
export type NoteType = ("file" | "image" | "search" | "noteMap" | "launcher" | "doc" | "contentWidget" | "text" | "relationMap" | "render" | "canvas" | "mermaid" | "book" | "webView" | "code"); export const ALLOWED_NOTE_TYPES = [ "file", "image", "search", "noteMap", "launcher", "doc", "contentWidget", "text", "relationMap", "render", "canvas", "mermaid", "book", "webView", "code" ] as const;
export type NoteType = typeof ALLOWED_NOTE_TYPES[number];
export interface NoteRow { export interface NoteRow {
noteId: string; noteId: string;
@ -106,5 +107,5 @@ export interface NoteRow {
dateModified: string; dateModified: string;
utcDateCreated: string; utcDateCreated: string;
utcDateModified: string; utcDateModified: string;
content?: string; content?: string | Buffer;
} }

View File

@ -645,7 +645,7 @@ export default class TabManager extends Component {
const titleFragments = [ const titleFragments = [
// it helps to navigate in history if note title is included in the title // it helps to navigate in history if note title is included in the title
await activeNoteContext.getNavigationTitle(), await activeNoteContext.getNavigationTitle(),
"Trilium Notes" "TriliumNext Notes"
].filter(Boolean); ].filter(Boolean);
document.title = titleFragments.join(" - "); document.title = titleFragments.join(" - ");

View File

@ -50,10 +50,10 @@ export default class TreeContextMenu {
{ title: 'Open in a new tab <kbd>Ctrl+Click</kbd>', command: "openInTab", uiIcon: "bx bx-empty", enabled: noSelectedNotes }, { title: 'Open in a new tab <kbd>Ctrl+Click</kbd>', command: "openInTab", uiIcon: "bx bx-empty", enabled: noSelectedNotes },
{ title: 'Open in a new split', command: "openNoteInSplit", uiIcon: "bx bx-dock-right", enabled: noSelectedNotes }, { title: 'Open in a new split', command: "openNoteInSplit", uiIcon: "bx bx-dock-right", enabled: noSelectedNotes },
{ title: 'Insert note after <kbd data-command="createNoteAfter"></kbd>', command: "insertNoteAfter", uiIcon: "bx bx-plus", { title: 'Insert note after <kbd data-command="createNoteAfter"></kbd>', command: "insertNoteAfter", uiIcon: "bx bx-plus",
items: insertNoteAfterEnabled ? await noteTypesService.getNoteTypeItems("insertNoteAfter", {removeDeprecatedTypes: true}) : null, items: insertNoteAfterEnabled ? await noteTypesService.getNoteTypeItems("insertNoteAfter") : null,
enabled: insertNoteAfterEnabled && noSelectedNotes }, enabled: insertNoteAfterEnabled && noSelectedNotes },
{ title: 'Insert child note <kbd data-command="createNoteInto"></kbd>', command: "insertChildNote", uiIcon: "bx bx-plus", { title: 'Insert child note <kbd data-command="createNoteInto"></kbd>', command: "insertChildNote", uiIcon: "bx bx-plus",
items: notSearch ? await noteTypesService.getNoteTypeItems("insertChildNote", {removeDeprecatedTypes: true}) : null, items: notSearch ? await noteTypesService.getNoteTypeItems("insertChildNote") : null,
enabled: notSearch && noSelectedNotes }, enabled: notSearch && noSelectedNotes },
{ title: 'Delete <kbd data-command="deleteNotes"></kbd>', command: "deleteNotes", uiIcon: "bx bx-trash", { title: 'Delete <kbd data-command="deleteNotes"></kbd>', command: "deleteNotes", uiIcon: "bx bx-trash",
enabled: isNotRoot && !isHoisted && parentNotSearch }, enabled: isNotRoot && !isHoisted && parentNotSearch },

View File

@ -1,21 +1,19 @@
import server from "./server.js"; import server from "./server.js";
import froca from "./froca.js"; import froca from "./froca.js";
async function getNoteTypeItems(command, opts = {}) { async function getNoteTypeItems(command) {
const removeDeprecatedTypes = !!opts.removeDeprecatedTypes;
const items = [ const items = [
{ title: "Text", command: command, type: "text", uiIcon: "bx bx-note" }, { title: "Text", command: command, type: "text", uiIcon: "bx bx-note" },
{ title: "Code", command: command, type: "code", uiIcon: "bx bx-code" }, { title: "Code", command: command, type: "code", uiIcon: "bx bx-code" },
{ title: "Saved Search", command: command, type: "search", uiIcon: "bx bx-file-find" }, { title: "Saved Search", command: command, type: "search", uiIcon: "bx bx-file-find" },
{ title: "Relation Map", command: command, type: "relationMap", uiIcon: "bx bx-map-alt", deprecated: true }, { title: "Relation Map", command: command, type: "relationMap", uiIcon: "bx bx-map-alt" },
{ title: "Note Map", command: command, type: "noteMap", uiIcon: "bx bx-map-alt" }, { title: "Note Map", command: command, type: "noteMap", uiIcon: "bx bx-map-alt" },
{ title: "Render Note", command: command, type: "render", uiIcon: "bx bx-extension" }, { title: "Render Note", command: command, type: "render", uiIcon: "bx bx-extension" },
{ title: "Book", command: command, type: "book", uiIcon: "bx bx-book" }, { title: "Book", command: command, type: "book", uiIcon: "bx bx-book" },
{ title: "Mermaid Diagram", command: command, type: "mermaid", uiIcon: "bx bx-selection" }, { title: "Mermaid Diagram", command: command, type: "mermaid", uiIcon: "bx bx-selection" },
{ title: "Canvas", command: command, type: "canvas", uiIcon: "bx bx-pen" }, { title: "Canvas", command: command, type: "canvas", uiIcon: "bx bx-pen" },
{ title: "Web View", command: command, type: "webView", uiIcon: "bx bx-globe-alt" }, { title: "Web View", command: command, type: "webView", uiIcon: "bx bx-globe-alt" },
].filter(item => !removeDeprecatedTypes || !item.deprecated); ];
const templateNoteIds = await server.get("search-templates"); const templateNoteIds = await server.get("search-templates");
const templateNotes = await froca.getNotes(templateNoteIds); const templateNotes = await froca.getNotes(templateNoteIds);

View File

@ -204,7 +204,7 @@ const TPL = `
<li class="dropdown-item show-about-dialog-button"> <li class="dropdown-item show-about-dialog-button">
<span class="bx bx-empty"></span> <span class="bx bx-empty"></span>
About Trilium Notes About TriliumNext Notes
</li> </li>
<li class="dropdown-item update-to-latest-version-button" data-trigger-command="downloadLatestVersion"> <li class="dropdown-item update-to-latest-version-button" data-trigger-command="downloadLatestVersion">

View File

@ -7,7 +7,7 @@ const TPL = `
<div class="modal-dialog modal-lg" role="document"> <div class="modal-dialog modal-lg" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title mr-auto">About Trilium Notes</h5> <h5 class="modal-title mr-auto">About TriliumNext Notes</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0;"> <button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0;">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
@ -17,7 +17,7 @@ const TPL = `
<table class="table table-borderless"> <table class="table table-borderless">
<tr> <tr>
<th>Homepage:</th> <th>Homepage:</th>
<td><a href="https://github.com/zadam/trilium" class="external">https://github.com/zadam/trilium</a></td> <td><a href="https://github.com/TriliumNext/Notes" class="external">https://github.com/TriliumNext/Notes</a></td>
</tr> </tr>
<tr> <tr>
<th>App version:</th> <th>App version:</th>
@ -70,7 +70,7 @@ export default class AboutDialog extends BasicWidget {
this.$syncVersion.text(appInfo.syncVersion); this.$syncVersion.text(appInfo.syncVersion);
this.$buildDate.text(appInfo.buildDate); this.$buildDate.text(appInfo.buildDate);
this.$buildRevision.text(appInfo.buildRevision); this.$buildRevision.text(appInfo.buildRevision);
this.$buildRevision.attr('href', `https://github.com/zadam/trilium/commit/${appInfo.buildRevision}`); this.$buildRevision.attr('href', `https://github.com/TriliumNext/Notes/commit/${appInfo.buildRevision}`);
this.$dataDirectory.text(appInfo.dataDirectory); this.$dataDirectory.text(appInfo.dataDirectory);
} }

View File

@ -2,7 +2,6 @@ import libraryLoader from '../../services/library_loader.js';
import TypeWidget from './type_widget.js'; import TypeWidget from './type_widget.js';
import utils from '../../services/utils.js'; import utils from '../../services/utils.js';
import linkService from '../../services/link.js'; import linkService from '../../services/link.js';
import debounce from '../../services/debounce.js';
const TPL = ` const TPL = `
<div class="canvas-widget note-detail-canvas note-detail-printable note-detail"> <div class="canvas-widget note-detail-canvas note-detail-printable note-detail">
@ -103,8 +102,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
this.SCENE_VERSION_INITIAL = -1; // -1 indicates that it is fresh. excalidraw scene version is always >0 this.SCENE_VERSION_INITIAL = -1; // -1 indicates that it is fresh. excalidraw scene version is always >0
this.SCENE_VERSION_ERROR = -2; // -2 indicates error this.SCENE_VERSION_ERROR = -2; // -2 indicates error
// config
this.DEBOUNCE_TIME_ONCHANGEHANDLER = 750; // ms
// ensure that assets are loaded from trilium // ensure that assets are loaded from trilium
window.EXCALIDRAW_ASSET_PATH = `${window.location.origin}/node_modules/@excalidraw/excalidraw/dist/`; window.EXCALIDRAW_ASSET_PATH = `${window.location.origin}/node_modules/@excalidraw/excalidraw/dist/`;
@ -117,11 +114,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
this.$widget; this.$widget;
this.reactHandlers; // used to control react state this.reactHandlers; // used to control react state
// binds
this.createExcalidrawReactApp = this.createExcalidrawReactApp.bind(this);
this.onChangeHandler = this.onChangeHandler.bind(this);
this.isNewSceneVersion = this.isNewSceneVersion.bind(this);
this.libraryChanged = false; this.libraryChanged = false;
} }
@ -153,7 +145,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
ReactDOM.unmountComponentAtNode(renderElement); ReactDOM.unmountComponentAtNode(renderElement);
const root = ReactDOM.createRoot(renderElement); const root = ReactDOM.createRoot(renderElement);
root.render(React.createElement(this.createExcalidrawReactApp)); root.render(React.createElement(() => this.createExcalidrawReactApp()));
}); });
return this.$widget; return this.$widget;
@ -445,7 +437,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
this.saveData(); this.saveData();
}, },
onChange: debounce(this.onChangeHandler, this.DEBOUNCE_TIME_ONCHANGEHANDLER), onChange: () => this.onChangeHandler(),
viewModeEnabled: false, viewModeEnabled: false,
zenModeEnabled: false, zenModeEnabled: false,
gridModeEnabled: false, gridModeEnabled: false,

View File

@ -184,8 +184,6 @@ export default class RelationMapTypeWidget extends TypeWidget {
} }
async loadMapData() { async loadMapData() {
toastService.showMessage("Relation Map has been deprecated since Trilium 0.63 and will be removed in a future version. Migrate your content to some other note type (e.g. canvas) as soon as possible.", 5000);
this.mapData = { this.mapData = {
notes: [], notes: [],
// it is important to have this exact value here so that initial transform is the same as this // it is important to have this exact value here so that initial transform is the same as this

View File

@ -169,6 +169,8 @@ function saveAttachmentToTmpDir(req: Request) {
return saveToTmpDir(fileName, content, 'attachments', attachment.attachmentId); return saveToTmpDir(fileName, content, 'attachments', attachment.attachmentId);
} }
const createdTemporaryFiles = new Set<string>();
function saveToTmpDir(fileName: string, content: string | Buffer, entityType: string, entityId: string) { function saveToTmpDir(fileName: string, content: string | Buffer, entityType: string, entityId: string) {
const tmpObj = tmp.fileSync({ postfix: fileName }); const tmpObj = tmp.fileSync({ postfix: fileName });
@ -180,6 +182,8 @@ function saveToTmpDir(fileName: string, content: string | Buffer, entityType: st
fs.closeSync(tmpObj.fd); fs.closeSync(tmpObj.fd);
createdTemporaryFiles.add(tmpObj.name);
log.info(`Saved temporary file ${tmpObj.name}`); log.info(`Saved temporary file ${tmpObj.name}`);
if (utils.isElectron()) { if (utils.isElectron()) {
@ -203,6 +207,10 @@ function uploadModifiedFileToNote(req: Request) {
const noteId = req.params.noteId; const noteId = req.params.noteId;
const {filePath} = req.body; const {filePath} = req.body;
if (!createdTemporaryFiles.has(filePath)) {
throw new ValidationError(`File '${filePath}' is not a temporary file.`);
}
const note = becca.getNoteOrThrow(noteId); const note = becca.getNoteOrThrow(noteId);
log.info(`Updating note '${noteId}' with content from '${filePath}'`); log.info(`Updating note '${noteId}' with content from '${filePath}'`);

View File

@ -10,7 +10,7 @@ import utils = require('./utils');
const template = `[Desktop Entry] const template = `[Desktop Entry]
Type=Application Type=Application
Name=Trilium Notes Name=TriliumNext Notes
Icon=#APP_ROOT_DIR#/icon.png Icon=#APP_ROOT_DIR#/icon.png
Exec=#EXE_PATH# Exec=#EXE_PATH#
Categories=Office Categories=Office

View File

@ -1 +1 @@
export = { buildDate:"2024-03-28T07:11:39+01:00", buildRevision: "399458b52f250b22be22d980a78de0b3390d7521" }; export = { buildDate:"2024-07-14T22:32:45+03:00", buildRevision: "b811f3d399aed7e740bd8e92ef7edc7d15de7038" };

View File

@ -49,9 +49,6 @@ function importImage(file: File, parentNote: BNote, taskContext: TaskContext) {
} }
function importFile(taskContext: TaskContext, file: File, parentNote: BNote) { function importFile(taskContext: TaskContext, file: File, parentNote: BNote) {
if (typeof file.buffer !== "string") {
throw new Error("Invalid file content for text.");
}
const originalName = file.originalname; const originalName = file.originalname;
const {note} = noteService.createNewNote({ const {note} = noteService.createNewNote({

View File

@ -20,7 +20,7 @@ import BNote = require('../../becca/entities/bnote');
import NoteMeta = require('../meta/note_meta'); import NoteMeta = require('../meta/note_meta');
import AttributeMeta = require('../meta/attribute_meta'); import AttributeMeta = require('../meta/attribute_meta');
import { Stream } from 'stream'; import { Stream } from 'stream';
import { NoteType } from '../../becca/entities/rows'; import { ALLOWED_NOTE_TYPES, NoteType } from '../../becca/entities/rows';
interface MetaFile { interface MetaFile {
files: NoteMeta[] files: NoteMeta[]
@ -499,10 +499,6 @@ async function importZip(taskContext: TaskContext, fileBuffer: Buffer, importRoo
} }
} }
else { else {
if (typeof content !== "string") {
throw new Error("Incorrect content type.");
}
({note} = noteService.createNewNote({ ({note} = noteService.createNewNote({
parentNoteId: parentNoteId, parentNoteId: parentNoteId,
title: noteTitle || "", title: noteTitle || "",
@ -653,7 +649,11 @@ function resolveNoteType(type: string | undefined): NoteType {
return 'webView'; return 'webView';
} }
return "text"; if (type && (ALLOWED_NOTE_TYPES as readonly string[]).includes(type)) {
return type as NoteType;
} else {
return "text";
}
} }
export = { export = {

View File

@ -7,7 +7,7 @@ export interface NoteParams {
parentNoteId: string; parentNoteId: string;
templateNoteId?: string; templateNoteId?: string;
title: string; title: string;
content: string; content: string | Buffer;
/** text, code, file, image, search, book, relationMap, canvas, webView */ /** text, code, file, image, search, book, relationMap, canvas, webView */
type: NoteType; type: NoteType;
/** default value is derived from default mimes for type */ /** default value is derived from default mimes for type */

View File

@ -446,13 +446,17 @@ function findIncludeNoteLinks(content: string, foundLinks: FoundLink[]) {
} }
function findRelationMapLinks(content: string, foundLinks: FoundLink[]) { function findRelationMapLinks(content: string, foundLinks: FoundLink[]) {
const obj = JSON.parse(content); try {
const obj = JSON.parse(content);
for (const note of obj.notes) { for (const note of obj.notes) {
foundLinks.push({ foundLinks.push({
name: 'relationMapLink', name: 'relationMapLink',
value: note.noteId value: note.noteId
}); });
}
} catch (e: any) {
log.error("Could not scan for relation map links: " + e.message);
} }
} }

View File

@ -74,7 +74,7 @@ class NoteContentFulltextExp extends Expression {
} }
if (isProtected) { if (isProtected) {
if (!protectedSessionService.isProtectedSessionAvailable() || !content) { if (!protectedSessionService.isProtectedSessionAvailable() || !content || typeof content !== "string") {
return; return;
} }
@ -86,7 +86,7 @@ class NoteContentFulltextExp extends Expression {
} }
} }
if (!content) { if (!content || typeof content !== "string") {
return; return;
} }

View File

@ -98,7 +98,7 @@ function createTray() {
} }
tray = new Tray(getIconPath()); tray = new Tray(getIconPath());
tray.setToolTip('Trilium Notes') tray.setToolTip('TriliumNext Notes')
// Restore focus // Restore focus
tray.on('click', changeVisibility) tray.on('click', changeVisibility)
updateTrayMenu(); updateTrayMenu();

View File

@ -22,7 +22,7 @@ async function createExtraWindow(extraWindowHash: string) {
const win = new BrowserWindow({ const win = new BrowserWindow({
width: 1000, width: 1000,
height: 800, height: 800,
title: 'Trilium Notes', title: 'TriliumNext Notes',
webPreferences: { webPreferences: {
nodeIntegration: true, nodeIntegration: true,
contextIsolation: false, contextIsolation: false,
@ -60,7 +60,7 @@ async function createMainWindow(app: App) {
y: mainWindowState.y, y: mainWindowState.y,
width: mainWindowState.width, width: mainWindowState.width,
height: mainWindowState.height, height: mainWindowState.height,
title: 'Trilium Notes', title: 'TriliumNext Notes',
webPreferences: { webPreferences: {
nodeIntegration: true, nodeIntegration: true,
contextIsolation: false, contextIsolation: false,
@ -132,7 +132,7 @@ async function createSetupWindow() {
setupWindow = new BrowserWindow({ setupWindow = new BrowserWindow({
width: 800, width: 800,
height: 800, height: 800,
title: 'Trilium Notes Setup', title: 'TriliumNext Notes Setup',
icon: getIcon(), icon: getIcon(),
webPreferences: { webPreferences: {
// necessary for e.g. utils.isElectron() // necessary for e.g. utils.isElectron()

View File

@ -4,7 +4,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="shortcut icon" href="favicon.ico"> <link rel="shortcut icon" href="favicon.ico">
<link rel="manifest" crossorigin="use-credentials" href="manifest.webmanifest"> <link rel="manifest" crossorigin="use-credentials" href="manifest.webmanifest">
<title>Trilium Notes</title> <title>TriliumNext Notes</title>
</head> </head>
<body class="desktop heading-style-<%= headingStyle %>"> <body class="desktop heading-style-<%= headingStyle %>">
<noscript>Trilium requires JavaScript to be enabled.</noscript> <noscript>Trilium requires JavaScript to be enabled.</noscript>

View File

@ -5,7 +5,7 @@
<link rel="shortcut icon" href="favicon.ico"> <link rel="shortcut icon" href="favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#fff"> <meta name="theme-color" content="#fff">
<title>Trilium Notes</title> <title>TriliumNext Notes</title>
<link rel="manifest" crossorigin="use-credentials" href="manifest.webmanifest"> <link rel="manifest" crossorigin="use-credentials" href="manifest.webmanifest">
<style> <style>

View File

@ -47,7 +47,7 @@
<noscript>Trilium requires JavaScript to be enabled.</noscript> <noscript>Trilium requires JavaScript to be enabled.</noscript>
<div class="container"> <div class="container">
<div id="setup-dialog" class="col-md-12 col-lg-8 col-xl-6 mx-auto" style="padding-top: 25px; font-size: larger; display: none;"> <div id="setup-dialog" class="col-md-12 col-lg-8 col-xl-6 mx-auto" style="padding-top: 25px; font-size: larger; display: none;">
<h1>Trilium Notes setup</h1> <h1>TriliumNext Notes setup</h1>
<div class="alert alert-warning" id="alert" style="display: none;"> <div class="alert alert-warning" id="alert" style="display: none;">
</div> </div>
@ -92,7 +92,7 @@
<p>This setup needs to be initiated from the desktop instance:</p> <p>This setup needs to be initiated from the desktop instance:</p>
<ol> <ol>
<li>Open your desktop instance of Trilium Notes.</li> <li>Open your desktop instance of TriliumNext Notes.</li>
<li>From the Trilium Menu, click Options.</li> <li>From the Trilium Menu, click Options.</li>
<li>Click on Sync tab.</li> <li>Click on Sync tab.</li>
<li>Change server instance address to: <span id="current-host"></span> and click save.</li> <li>Change server instance address to: <span id="current-host"></span> and click save.</li>

View File

@ -1,20 +1,29 @@
{ {
"compilerOptions": { "compilerOptions": {
"moduleResolution": "Node", "moduleResolution": "Node",
"declaration": false, "declaration": false,
"sourceMap": true, "sourceMap": true,
"outDir": "./dist", "outDir": "./build",
"strict": true, "strict": true,
"noImplicitAny": true, "noImplicitAny": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"lib": ["ES2022"], "lib": ["ES2022"],
"downlevelIteration": true, "downlevelIteration": true,
"skipLibCheck": true "skipLibCheck": true,
}, "esModuleInterop": true
"include": ["./src/**/*.js", "./src/**/*.ts", "./*.ts", "./spec/**/*.ts", "./spec-es6/**/*.ts"], },
"exclude": ["./node_modules/**/*"], "include": [
"ts-node": { "./src/**/*.js",
"files": true "./src/**/*.ts",
}, "./*.ts",
"files": ["src/types.d.ts"] "./spec/**/*.ts",
"./spec-es6/**/*.ts"
],
"exclude": ["./node_modules/**/*"],
"ts-node": {
"files": true
},
"files": [
"src/types.d.ts"
]
} }

View File

@ -1,10 +1,10 @@
const path = require('path'); import path = require('path');
const assetPath = require('./src/services/asset_path'); import assetPath = require('./src/services/asset_path');
module.exports = { module.exports = {
mode: 'production', mode: 'production',
entry: { entry: {
setup: './src/public/app/setup.ts', setup: './src/public/app/setup.js',
mobile: './src/public/app/mobile.js', mobile: './src/public/app/mobile.js',
desktop: './src/public/app/desktop.js', desktop: './src/public/app/desktop.js',
}, },