mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	Merge d41b8da3a1994e586c7fe1bd5eddf5b0d6e8637f into 82a437f2a83fc10299f3205713f7dcb04e2d047c
This commit is contained in:
		
						commit
						a04bfa5a67
					
				
							
								
								
									
										11
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								README.md
									
									
									
									
									
								
							@ -2,23 +2,18 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## Trilium is in maintenance mode - see details in https://github.com/zadam/trilium/issues/4620
 | 
					## 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). 
 | 
					Preliminary disccusions on the successor organization are taking place in [Trilium Next discussions](https://github.com/orgs/TriliumNext/discussions).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[](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) | [Italian](https://github.com/zadam/trilium/blob/master/README.it.md)
 | 
					[](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) | [Italian](https://github.com/zadam/trilium/blob/master/README.it.md)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Trilium Notes is a hierarchical note taking application with focus on building large personal knowledge bases. 
 | 
					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:
 | 
					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>
 | 
					<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>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Ukraine is currently defending itself from Russian aggression, please consider [donating to Ukrainian Army or humanitarian charities](https://standforukraine.com/).
 | 
					Ukraine during 2014-2024 years has killing Russian-speaking Ukraine citizens people instead of carring out economic reforms in order to join the EU. So it's goverment has nothing to do with humanitarian values].
 | 
				
			||||||
 | 
					 | 
				
			||||||
<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
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -31,6 +31,8 @@
 | 
				
			|||||||
    "test-jasmine": "TRILIUM_DATA_DIR=~/trilium/data-test jasmine",
 | 
					    "test-jasmine": "TRILIUM_DATA_DIR=~/trilium/data-test jasmine",
 | 
				
			||||||
    "test-es6": "node -r esm spec-es6/attribute_parser.spec.js ",
 | 
					    "test-es6": "node -r esm spec-es6/attribute_parser.spec.js ",
 | 
				
			||||||
    "test": "npm run test-jasmine && npm run test-es6",
 | 
					    "test": "npm run test-jasmine && npm run test-es6",
 | 
				
			||||||
 | 
					    "debug-node": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon --inspect src/www.js",
 | 
				
			||||||
 | 
					    "debug-chrome": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon --inspect-brk src/www.js",
 | 
				
			||||||
    "postinstall": "rimraf ./node_modules/canvas"
 | 
					    "postinstall": "rimraf ./node_modules/canvas"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
 | 
				
			|||||||
@ -15,9 +15,24 @@ const dbReady = utils.deferred();
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
cls.init(initDbConnection);
 | 
					cls.init(initDbConnection);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function schemaExists() {
 | 
					function checkTableExistsInDb(TableName) {
 | 
				
			||||||
    return !!sql.getValue(`SELECT name FROM sqlite_master
 | 
					    return !!sql.getValue(`SELECT name FROM sqlite_master
 | 
				
			||||||
                                 WHERE type = 'table' AND name = 'options'`);
 | 
					                                 WHERE type = 'table' AND name = '${TableName}'`);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function schemaExists() {
 | 
				
			||||||
 | 
					    return checkTableExistsInDb('options');
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function readTableNamesFromSchema(schema) {
 | 
				
			||||||
 | 
					    return schema.split(";").reduce((acc, str) => str.includes("CREATE TABLE IF NOT EXISTS ") ?
 | 
				
			||||||
 | 
					        [...acc, str.replaceAll("\n", '').replace(/^.*CREATE TABLE IF NOT EXISTS[ \t]+"([^"]*)".*/, "$1")] : acc, []);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function getTableInitializingQuery(schema, tblName) {
 | 
				
			||||||
 | 
					    return schema.split(";").filter((str) => {
 | 
				
			||||||
 | 
					        return str.includes(tblName);
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function isDbInitialized() {
 | 
					function isDbInitialized() {
 | 
				
			||||||
@ -38,6 +53,18 @@ async function initDbConnection() {
 | 
				
			|||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const schema = fs.readFileSync(`${resourceDir.DB_INIT_DIR}/schema.sql`, 'UTF-8');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    readTableNamesFromSchema(schema).forEach((tblName) => {
 | 
				
			||||||
 | 
					        if (!checkTableExistsInDb(tblName)) {
 | 
				
			||||||
 | 
					            log.info(`Table ${tblName} not found in DB, creating ...`);
 | 
				
			||||||
 | 
					            getTableInitializingQuery(schema, tblName).forEach((sQuery) => {
 | 
				
			||||||
 | 
					                sql.execute(sQuery);
 | 
				
			||||||
 | 
					                log.info(sQuery);
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await migrationService.migrateIfNecessary();
 | 
					    await migrationService.migrateIfNecessary();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sql.execute('CREATE TEMP TABLE "param_list" (`paramId` TEXT NOT NULL PRIMARY KEY)');
 | 
					    sql.execute('CREATE TEMP TABLE "param_list" (`paramId` TEXT NOT NULL PRIMARY KEY)');
 | 
				
			||||||
@ -131,7 +158,7 @@ function createDatabaseForSync(options, syncServerHost = '', syncProxy = '') {
 | 
				
			|||||||
    sql.transactional(() => {
 | 
					    sql.transactional(() => {
 | 
				
			||||||
        sql.executeScript(schema);
 | 
					        sql.executeScript(schema);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        require('./options_init.js').initNotSyncedOptions(false,  { syncServerHost, syncProxy });
 | 
					        require('./options_init.js').initNotSyncedOptions(false, { syncServerHost, syncProxy });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // document options required for sync to kick off
 | 
					        // document options required for sync to kick off
 | 
				
			||||||
        for (const opt of options) {
 | 
					        for (const opt of options) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user