Compare commits

...

21 Commits

Author SHA1 Message Date
azivner
1a9a49b739 release 0.28.3 2019-01-22 23:01:32 +01:00
azivner
2ac560c56e text note should change its icon after having new note inserted into, fixes #361 2019-01-22 21:21:44 +01:00
azivner
c23387c0fb make search dialog more responsive in narrow sidebar, fixes #367 2019-01-22 20:54:00 +01:00
azivner
0ff250fe15 font sizes were not created for new documents - fix plus migration for existing ones 2019-01-22 20:34:45 +01:00
azivner
52b1e58b26 make tree selection more visually consistent 2019-01-22 20:23:54 +01:00
azivner
484715e440 fix icon in desktop linux build, fixes #372 2019-01-22 19:49:33 +01:00
azivner
9d42c3d802 release 0.28.2 2019-01-21 22:55:12 +01:00
azivner
c654172d33 auto fixer for "undeleted branch of deleted note" consistency check 2019-01-21 22:51:49 +01:00
azivner
e17b26c883 revert consistency checks refactoring for now 2019-01-21 22:46:27 +01:00
azivner
24d02d9cf5 fix in task manager script to not error out so much on deletion 2019-01-21 22:05:37 +01:00
azivner
7208a311ac check that note is not deleted before creating a branch 2019-01-21 21:55:40 +01:00
azivner
ad7355372b issue template 2019-01-21 19:55:07 +01:00
azivner
f18b5babad uncommented issue template 2019-01-20 16:47:49 +01:00
azivner
9831ec0ca9 added issue template 2019-01-20 16:46:56 +01:00
azivner
596544eca3 fix setNoteToParent API method, closes #360 2019-01-20 16:33:09 +01:00
azivner
1f853024ee more autofixers WIP 2019-01-19 09:57:51 +01:00
azivner
0308b13460 expose app info on the backend script api #345 2019-01-18 23:57:08 +01:00
azivner
06b8a82f70 refactoring of consistency checks + some auto fixers 2019-01-18 19:32:59 +01:00
azivner
91ca07929d before we clone the note we must make sure it's not deleted 2019-01-17 23:24:59 +01:00
azivner
afabaa5fdb workaround for hidden last line on mobile 2019-01-17 21:13:53 +01:00
azivner
a6fd3fa77c release 0.28.1-beta 2019-01-17 00:03:17 +01:00
19 changed files with 95 additions and 24 deletions

View File

@@ -11,6 +11,8 @@ cp -r bin/deps/linux-x64/sqlite/* node_modules/sqlite3/lib/binding/
mv "./dist/Trilium Notes-linux-x64" $BUILD_DIR
cp src/public/images/app-icons/png/128x128.png $BUILD_DIR/icon.png
# removing software WebGL binaries because they are pretty huge and not necessary
rm -r $BUILD_DIR/swiftshader

Binary file not shown.

View File

@@ -0,0 +1,11 @@
INSERT INTO options (name, value, dateCreated, dateModified, isSynced)
SELECT 'mainFontSize', '100', '2019-01-13T18:31:00.874Z', '2019-01-13T18:31:00.874Z', 0
WHERE NOT EXISTS (SELECT 1 FROM options WHERE name = 'mainFontSize');
INSERT INTO options (name, value, dateCreated, dateModified, isSynced)
SELECT 'treeFontSize', '100', '2019-01-13T18:31:00.874Z', '2019-01-13T18:31:00.874Z', 0
WHERE NOT EXISTS (SELECT 1 FROM options WHERE name = 'treeFontSize');
INSERT INTO options (name, value, dateCreated, dateModified, isSynced)
SELECT 'detailFontSize', '110', '2019-01-13T18:31:00.874Z', '2019-01-13T18:31:00.874Z', 0
WHERE NOT EXISTS (SELECT 1 FROM options WHERE name = 'detailFontSize');

5
issue_template.md Normal file
View File

@@ -0,0 +1,5 @@
For bug reports, please mention **version of the application** and include **log files** from following location:
* `/home/[user]/.local/share/trilium-data/log` for Linux
* `C:\Users\[user]\AppData\Roaming\trilium-data\log` for Windows Vista and up
* `/Users/[user]/Library/Application Support/trilium-data/log` for Mac OS

View File

@@ -2,7 +2,7 @@
"name": "trilium",
"productName": "Trilium Notes",
"description": "Trilium Notes",
"version": "0.28.1-beta",
"version": "0.28.3",
"license": "AGPL-3.0-only",
"main": "electron.js",
"bin": {

View File

@@ -160,7 +160,7 @@ async function createPromotedAttributeRow(definitionAttr, valueAttr) {
$input.autocomplete({
appendTo: document.querySelector('body'),
hint: false,
autoselect: true,
autoselect: false,
openOnFocus: true,
minLength: 0,
tabAutocomplete: false

View File

@@ -623,7 +623,10 @@ async function createNote(node, parentNoteId, target, isProtected, saveSelection
await node.getLastChild().setActive(true);
const parentNoteEntity = await treeCache.getNote(node.data.noteId);
node.folder = true;
node.icon = await treeBuilder.getIcon(parentNoteEntity); // icon might change into folder
node.renderTitle();
}
else {

View File

@@ -44,7 +44,8 @@ html, body {
position: relative;
overflow: auto;
flex-direction: column;
height: 100%;
/* for some reason detail overflows a little bit so we subtract few pixels */
height: calc(100% - 25px);
/* large left padding is necessary for ckeditor gutter in detail-only (smartphone) layout */
padding-left: 35px;
}

View File

@@ -260,7 +260,7 @@ span.fancytree-active.fancytree-focused .fancytree-title {
border-radius: 3px;
}
span.fancytree-active:not(.fancytree-focused) .fancytree-title {
span.fancytree-active:not(.fancytree-focused) .fancytree-title, span.fancytree-selected .fancytree-title {
color: var(--hover-item-text-color) !important;
background-color: var(--hover-item-background-color) !important;
border-color: #ddd !important;

View File

@@ -1,7 +1,7 @@
"use strict";
const path = require('path');
const {APP_PNG_ICON_DIR, ELECTRON_APP_ROOT_DIR} = require("./resource_dir");
const {ELECTRON_APP_ROOT_DIR} = require("./resource_dir");
const log = require("./log");
const os = require('os');
const fs = require('fs');
@@ -11,7 +11,7 @@ const utils = require('./utils');
const template = `[Desktop Entry]
Type=Application
Name=Trilium Notes
Icon=#APP_PNG_ICON_DIR#/128x128.png
Icon=#APP_ROOT_DIR#/icon.png
Exec=#EXE_PATH#
Categories=Office
Terminal=false
@@ -50,7 +50,7 @@ function installLocalAppIcon() {
function getDesktopFileContent() {
return template
.replace("#APP_PNG_ICON_DIR#", escapePath(APP_PNG_ICON_DIR))
.replace("#APP_ROOT_DIR#", escapePath(ELECTRON_APP_ROOT_DIR))
.replace("#EXE_PATH#", escapePath(getExePath()));
}

View File

@@ -4,7 +4,7 @@ const build = require('./build');
const packageJson = require('../../package');
const {TRILIUM_DATA_DIR} = require('./data_dir');
const APP_DB_VERSION = 123;
const APP_DB_VERSION = 124;
const SYNC_VERSION = 4;
module.exports = {

View File

@@ -11,6 +11,7 @@ const repository = require('./repository');
const axios = require('axios');
const cloningService = require('./cloning');
const messagingService = require('./messaging');
const appInfo = require('./app_info');
/**
* This is the main backend API interface for scripts. It's published in the local "api" object.
@@ -234,6 +235,11 @@ function BackendScriptApi(startNote, currentNote, originEntity) {
* @returns {Promise<void>}
*/
this.refreshTree = () => messagingService.sendMessageToAllClients({ type: 'refresh-tree' });
/**
* @return {{syncVersion, appVersion, buildRevision, dbVersion, dataDirectory, buildDate}|*} - object representing basic info about running Trilium version
*/
this.getAppInfo = () => appInfo
}
module.exports = BackendScriptApi;

View File

@@ -1 +1 @@
module.exports = { buildDate:"2019-01-16T23:58:10+01:00", buildRevision: "299bbff2f45299afc1402fed875f92bf6dec168d" };
module.exports = { buildDate:"2019-01-22T23:01:32+01:00", buildRevision: "2ac560c56e2d347fccc0ad51b8d62999408a7f74" };

View File

@@ -8,6 +8,10 @@ const repository = require('./repository');
const Branch = require('../entities/branch');
async function cloneNoteToParent(noteId, parentNoteId, prefix) {
if (await isNoteDeleted(noteId) || await isNoteDeleted(parentNoteId)) {
return { success: false, message: 'Note is deleted.' };
}
const validationResult = await treeService.validateParentChild(parentNoteId, noteId);
if (!validationResult.success) {
@@ -27,6 +31,10 @@ async function cloneNoteToParent(noteId, parentNoteId, prefix) {
}
async function ensureNoteIsPresentInParent(noteId, parentNoteId, prefix) {
if (await isNoteDeleted(noteId) || await isNoteDeleted(parentNoteId)) {
return { success: false, message: 'Note is deleted.' };
}
const validationResult = await treeService.validateParentChild(parentNoteId, noteId);
if (!validationResult.success) {
@@ -61,6 +69,10 @@ async function toggleNoteInParent(present, noteId, parentNoteId, prefix) {
async function cloneNoteAfter(noteId, afterBranchId) {
const afterNote = await treeService.getBranch(afterBranchId);
if (await isNoteDeleted(noteId) || await isNoteDeleted(afterNote.parentNoteId)) {
return { success: false, message: 'Note is deleted.' };
}
const validationResult = await treeService.validateParentChild(afterNote.parentNoteId, noteId);
if (!validationResult.result) {
@@ -84,6 +96,12 @@ async function cloneNoteAfter(noteId, afterBranchId) {
return { success: true };
}
async function isNoteDeleted(noteId) {
const note = await repository.getNote(noteId);
return note.isDeleted;
}
module.exports = {
cloneNoteToParent,
ensureNoteIsPresentInParent,

View File

@@ -101,6 +101,26 @@ async function fixEmptyRelationTargets(errorList) {
}
}
async function fixUndeletedBranches() {
const undeletedBranches = await sql.getRows(`
SELECT
branchId, noteId
FROM
branches
JOIN notes USING(noteId)
WHERE
notes.isDeleted = 1
AND branches.isDeleted = 0`);
for (const {branchId, noteId} of undeletedBranches) {
const branch = await repository.getBranch(branchId);
branch.isDeleted = true;
await branch.save();
log.info(`Branch ${branchId} has been deleted since associated note ${noteId} is deleted.`);
}
}
async function runAllChecks() {
const errorList = [];
@@ -125,16 +145,7 @@ async function runAllChecks() {
notes.noteId IS NULL`,
"Missing notes records for following branch ID > note ID", errorList);
await runCheck(`
SELECT
branchId
FROM
branches
JOIN notes USING(noteId)
WHERE
notes.isDeleted = 1
AND branches.isDeleted = 0`,
"Branch is not deleted even though main note is deleted for following branch IDs", errorList);
await fixUndeletedBranches();
await runCheck(`
SELECT

View File

@@ -49,6 +49,10 @@ async function initNotSyncedOptions(initialized, startNotePath = 'root', syncSer
await optionService.createOption('syncServerTimeout', 5000, false);
await optionService.createOption('syncProxy', syncProxy, false);
await optionService.createOption('mainFontSize', '100', false);
await optionService.createOption('treeFontSize', '100', false);
await optionService.createOption('detailFontSize', '110', false);
await optionService.createOption('initialized', initialized ? 'true' : 'false', false);
}

View File

@@ -7,7 +7,6 @@ const RESOURCE_DIR = path.resolve(__dirname, "../..");
// where "trilium" executable is
const ELECTRON_APP_ROOT_DIR = path.resolve(RESOURCE_DIR, "../..");
const DB_INIT_DIR = path.resolve(RESOURCE_DIR, "db");
const APP_PNG_ICON_DIR = path.resolve(RESOURCE_DIR, "src/public/images/app-icons/png");
if (!fs.existsSync(DB_INIT_DIR)) {
log.error("Could not find DB initialization directory: " + DB_INIT_DIR);
@@ -25,6 +24,5 @@ module.exports = {
RESOURCE_DIR,
MIGRATIONS_DIR,
DB_INIT_DIR,
ELECTRON_APP_ROOT_DIR,
APP_PNG_ICON_DIR
ELECTRON_APP_ROOT_DIR
};

View File

@@ -111,6 +111,12 @@ async function sortNotesAlphabetically(parentNoteId) {
}
async function setNoteToParent(noteId, prefix, parentNoteId) {
const parentNote = await repository.getNote(parentNoteId);
if (parentNote && parentNote.isDeleted) {
throw new Error(`Cannot move note to deleted parent note ${parentNoteId}`);
}
// case where there might be more such branches is ignored. It's expected there should be just one
const branch = await repository.getEntity("SELECT * FROM branches WHERE isDeleted = 0 AND noteId = ? AND prefix = ?", [noteId, prefix]);
@@ -126,6 +132,12 @@ async function setNoteToParent(noteId, prefix, parentNoteId) {
await branch.save();
}
else if (parentNoteId) {
const note = await repository.getNote(noteId);
if (note.isDeleted) {
throw new Error(`Cannot create a branch for ${noteId} which is deleted.`);
}
await new Branch({
noteId: noteId,
parentNoteId: parentNoteId,

View File

@@ -75,8 +75,8 @@
<input type="file" id="import-upload" style="display: none" />
<div id="search-box">
<div style="display: flex; align-items: center;">
<input name="search-text" placeholder="Search text, labels" style="flex-grow: 100; margin-left: 5px; margin-right: 5px;" autocomplete="off">
<div style="display: flex; align-items: center; flex-wrap: wrap;">
<input name="search-text" placeholder="Search text, labels" style="flex-grow: 100; margin-left: 5px; margin-right: 5px; flex-basis: 5em; min-width: 0;" autocomplete="off">
<button id="do-search-button" class="btn btn-sm icon-button jam jam-search" title="Search (enter)"></button>
&nbsp;