Skip to content

Commit

Permalink
Merge branch 'master' into excali-17-2
Browse files Browse the repository at this point in the history
  • Loading branch information
zadam committed Mar 6, 2024
2 parents 8199073 + 36357bd commit 6fad5f2
Show file tree
Hide file tree
Showing 56 changed files with 2,867 additions and 2,396 deletions.
403 changes: 199 additions & 204 deletions .eslintrc.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

13 changes: 0 additions & 13 deletions .prettierrc.js

This file was deleted.

1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
]
}
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.js.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

Expand All @@ -658,4 +658,4 @@ specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.js.gnu.org/licenses/>.
<http://www.gnu.org/licenses/>.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# Trilium Notes

## Trilium is in maintenance mode - see details in https://github.com/zadam/trilium/issues/4620

Preliminary disccusions on the successor organization are taking place in [Trilium Next discussions](https://github.com/orgs/TriliumNext/discussions).

[![Join the chat at https://gitter.im/trilium-notes/Lobby](https://badges.gitter.im/trilium-notes/Lobby.svg)](https://gitter.im/trilium-notes/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [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)

Trilium Notes is a hierarchical note taking application with focus on building large personal knowledge bases. See [screenshots](https://github.com/zadam/trilium/wiki/Screenshot-tour) for quick overview:
Trilium Notes is a hierarchical note taking application with focus on building large personal knowledge bases.

See [screenshots](https://github.com/zadam/trilium/wiki/Screenshot-tour) for quick overview:

<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>

Expand Down
46 changes: 17 additions & 29 deletions bin/build-linux-x64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,37 @@

SRC_DIR=./dist/trilium-linux-x64-src

if [ "$1" != "DONTCOPY" ]
then
./bin/copy-trilium.sh $SRC_DIR
fi
[ "$1" != "DONTCOPY" ] && ./bin/copy-trilium.sh "$SRC_DIR"

rm -r $SRC_DIR/src/public/app-dist/*.mobile.*
rm -r "$SRC_DIR"/src/public/app-dist/*.mobile.*

echo "Copying required linux-x64 binaries"

cp -r bin/better-sqlite3/linux-desktop-better_sqlite3.node $SRC_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node
cp -r bin/better-sqlite3/linux-desktop-better_sqlite3.node "$SRC_DIR"/node_modules/better-sqlite3/build/Release/better_sqlite3.node

echo "Packaging linux x64 electron build"

./node_modules/.bin/electron-packager $SRC_DIR --asar --out=dist --executable-name=trilium --platform=linux --arch=x64 --overwrite
./node_modules/.bin/electron-packager "$SRC_DIR" --asar --out=dist --executable-name=trilium --platform=linux --arch=x64 --overwrite

BUILD_DIR=./dist/trilium-linux-x64
rm -rf $BUILD_DIR

mv "./dist/Trilium Notes-linux-x64" $BUILD_DIR

cp images/app-icons/png/128x128.png $BUILD_DIR/icon.png
rm -rf "$BUILD_DIR"

cp bin/tpl/anonymize-database.sql $BUILD_DIR/
mv "./dist/Trilium Notes-linux-x64" "$BUILD_DIR"

cp -r dump-db $BUILD_DIR/
rm -rf $BUILD_DIR/dump-db/node_modules
cp images/app-icons/png/128x128.png "$BUILD_DIR"/icon.png
cp bin/tpl/anonymize-database.sql "$BUILD_DIR"/

cp bin/tpl/trilium-portable.sh $BUILD_DIR/
chmod 755 $BUILD_DIR/trilium-portable.sh
cp -r dump-db "$BUILD_DIR"/
rm -rf "$BUILD_DIR"/dump-db/node_modules

cp bin/tpl/trilium-safe-mode.sh $BUILD_DIR/
chmod 755 $BUILD_DIR/trilium-safe-mode.sh

cp bin/tpl/trilium-no-cert-check.sh $BUILD_DIR/
chmod 755 $BUILD_DIR/trilium-no-cert-check.sh
for f in 'trilium-portable' 'trilium-safe-mode' 'trilium-no-cert-check'; do
cp bin/tpl/"$f".sh "$BUILD_DIR"/
chmod 755 "$BUILD_DIR"/"$f".sh
done

echo "Packaging linux x64 electron distribution..."
VERSION=`jq -r ".version" package.json`

cd dist

tar cJf trilium-linux-x64-${VERSION}.tar.xz trilium-linux-x64

cd ..
pushd dist
tar cJf "trilium-linux-x64-${VERSION}.tar.xz" trilium-linux-x64
popd

bin/build-debian.sh
56 changes: 29 additions & 27 deletions bin/copy-trilium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,49 @@ if [[ $# -eq 0 ]] ; then
echo "Missing argument of target directory"
exit 1
fi
if ! [[ $(which npm) ]]; then
echo "Missing npm"
exit 1
fi

n exec 18.18.2 npm run webpack
n exec 18.18.2 npm run webpack || npm run webpack

DIR=$1
DIR="$1"

rm -rf $DIR
mkdir $DIR
rm -rf "$DIR"
mkdir -pv "$DIR"

echo "Copying Trilium to build directory $DIR"

cp -r images $DIR/
cp -r libraries $DIR/
cp -r src $DIR/
cp -r db $DIR/
cp -r package.json $DIR/
cp -r package-lock.json $DIR/
cp -r README.md $DIR/
cp -r LICENSE $DIR/
cp -r config-sample.ini $DIR/
cp -r electron.js $DIR/
cp webpack-* $DIR/
for d in 'images' 'libraries' 'src' 'db'; do
cp -r "$d" "$DIR"/
done
for f in 'package.json' 'package-lock.json' 'README.md' 'LICENSE' 'config-sample.ini' 'electron.js'; do
cp "$f" "$DIR"/
done
cp webpack-* "$DIR"/ # here warning because there is no 'webpack-*', but webpack.config.js only

# run in subshell (so we return to original dir)
(cd $DIR && n exec 18.18.2 npm install --only=prod)

if [[ -d "$DIR"/node_modules ]]; then
# cleanup of useless files in dependencies
rm -r $DIR/node_modules/image-q/demo
rm -r $DIR/node_modules/better-sqlite3/Release
rm -r $DIR/node_modules/better-sqlite3/deps/sqlite3.tar.gz
rm -r $DIR/node_modules/@jimp/plugin-print/fonts
rm -r $DIR/node_modules/jimp/browser
rm -r $DIR/node_modules/jimp/fonts
for d in 'image-q/demo' 'better-sqlite3/Release' 'better-sqlite3/deps/sqlite3.tar.gz' '@jimp/plugin-print/fonts' 'jimp/browser' 'jimp/fonts'; do
[[ -e "$DIR"/node_modules/"$d" ]] && rm -rv "$DIR"/node_modules/"$d"
done

# delete all tests (there are often large images as test file for jimp etc.)
find $DIR/node_modules -name test -exec rm -rf {} \;
find $DIR/node_modules -name docs -exec rm -rf {} \;
find $DIR/node_modules -name demo -exec rm -rf {} \;
for d in 'test' 'docs' 'demo'; do
find "$DIR"/node_modules -name "$d" -exec rm -rf {} \;
done
fi

find $DIR/libraries -name "*.map" -type f -delete

cp $DIR/src/public/app/share.js $DIR/src/public/app-dist/
cp -r $DIR/src/public/app/doc_notes $DIR/src/public/app-dist/
d="$DIR"/src/public
[[ -d "$d"/app-dist ]] || mkdir -pv "$d"/app-dist
cp "$d"/app/share.js "$d"/app-dist/
cp -r "$d"/app/doc_notes "$d"/app-dist/

rm -rf $DIR/src/public/app
rm -rf "$d"/app
unset f d DIR
3 changes: 3 additions & 0 deletions db/migrations/0215__content_structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ CREATE TABLE IF NOT EXISTS "blobs" (

ALTER TABLE notes ADD blobId TEXT DEFAULT NULL;
ALTER TABLE note_revisions ADD blobId TEXT DEFAULT NULL;

CREATE INDEX IF NOT EXISTS IDX_notes_blobId on notes (blobId);
CREATE INDEX IF NOT EXISTS IDX_note_revisions_blobId on note_revisions (blobId);
1 change: 1 addition & 0 deletions db/migrations/0218__rename_note_revision_to_revision.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ CREATE INDEX `IDX_revisions_utcDateCreated` ON `revisions` (`utcDateCreated`);
CREATE INDEX `IDX_revisions_utcDateLastEdited` ON `revisions` (`utcDateLastEdited`);
CREATE INDEX `IDX_revisions_dateCreated` ON `revisions` (`dateCreated`);
CREATE INDEX `IDX_revisions_dateLastEdited` ON `revisions` (`dateLastEdited`);
CREATE INDEX IF NOT EXISTS IDX_revisions_blobId on revisions (blobId);

UPDATE entity_changes SET entityName = 'revisions' WHERE entityName = 'note_revisions';
2 changes: 2 additions & 0 deletions db/migrations/0219__attachments.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ CREATE INDEX IDX_attachments_ownerId_role

CREATE INDEX IDX_attachments_utcDateScheduledForErasureSince
on attachments (utcDateScheduledForErasureSince);

CREATE INDEX IF NOT EXISTS IDX_attachments_blobId on attachments (blobId);
17 changes: 17 additions & 0 deletions db/migrations/0228__fix_blobIds.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- + is normally replaced by X and / by Y, but this can temporarily cause UNIQUE key exception
-- this might create blob duplicates, but cleanup will eventually take care of it

UPDATE blobs SET blobId = REPLACE(blobId, '+', 'A');
UPDATE blobs SET blobId = REPLACE(blobId, '/', 'B');

UPDATE notes SET blobId = REPLACE(blobId, '+', 'A');
UPDATE notes SET blobId = REPLACE(blobId, '/', 'B');

UPDATE attachments SET blobId = REPLACE(blobId, '+', 'A');
UPDATE attachments SET blobId = REPLACE(blobId, '/', 'B');

UPDATE revisions SET blobId = REPLACE(blobId, '+', 'A');
UPDATE revisions SET blobId = REPLACE(blobId, '/', 'B');

UPDATE entity_changes SET entityId = REPLACE(entityId, '+', 'A') WHERE entityName = 'blobs';
UPDATE entity_changes SET entityId = REPLACE(entityId, '/', 'B') WHERE entityName = 'blobs';
Loading

0 comments on commit 6fad5f2

Please sign in to comment.