mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	Compare commits
	
		
			6 Commits
		
	
	
		
			v0.10.0-be
			...
			v0.10.1-be
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 867d794e17 | ||
|  | fdd8458336 | ||
|  | a0bec22e96 | ||
|  | 5aeb5cd214 | ||
|  | e827ddffb9 | ||
|  | 98f80998b9 | 
| @@ -1,7 +1,7 @@ | |||||||
| { | { | ||||||
|   "name": "trilium", |   "name": "trilium", | ||||||
|   "description": "Trilium Notes", |   "description": "Trilium Notes", | ||||||
|   "version": "0.10.0-beta", |   "version": "0.10.1-beta", | ||||||
|   "license": "AGPL-3.0-only", |   "license": "AGPL-3.0-only", | ||||||
|   "main": "electron.js", |   "main": "electron.js", | ||||||
|   "repository": { |   "repository": { | ||||||
|   | |||||||
| @@ -1,20 +1,19 @@ | |||||||
| import server from './services/server.js'; | import server from './services/server.js'; | ||||||
|  |  | ||||||
| $(document).ready(() => { | $(document).ready(async () => { | ||||||
|     server.get('migration').then(result => { |     const {appDbVersion, dbVersion} = await server.get('migration'); | ||||||
|         const appDbVersion = result.app_dbVersion; |  | ||||||
|         const dbVersion = result.dbVersion; |  | ||||||
|  |  | ||||||
|         if (appDbVersion === dbVersion) { |     console.log("HI", {appDbVersion, dbVersion}); | ||||||
|             $("#up-to-date").show(); |  | ||||||
|         } |  | ||||||
|         else { |  | ||||||
|             $("#need-to-migrate").show(); |  | ||||||
|  |  | ||||||
|             $("#app-db-version").html(appDbVersion); |     if (appDbVersion === dbVersion) { | ||||||
|             $("#db-version").html(dbVersion); |         $("#up-to-date").show(); | ||||||
|         } |     } | ||||||
|     }); |     else { | ||||||
|  |         $("#need-to-migrate").show(); | ||||||
|  |  | ||||||
|  |         $("#app-db-version").html(appDbVersion); | ||||||
|  |         $("#db-version").html(dbVersion); | ||||||
|  |     } | ||||||
| }); | }); | ||||||
|  |  | ||||||
| $("#run-migration").click(async () => { | $("#run-migration").click(async () => { | ||||||
| @@ -37,4 +36,11 @@ $("#run-migration").click(async () => { | |||||||
|  |  | ||||||
|         $("#migration-table").append(row); |         $("#migration-table").append(row); | ||||||
|     } |     } | ||||||
|  | }); | ||||||
|  |  | ||||||
|  | // copy of this shortcut to be able to debug migration problems | ||||||
|  | $(document).bind('keydown', 'ctrl+shift+i', () => { | ||||||
|  |     require('electron').remote.getCurrentWindow().toggleDevTools(); | ||||||
|  |  | ||||||
|  |     return false; | ||||||
| }); | }); | ||||||
| @@ -100,7 +100,7 @@ setTimeout(() => { | |||||||
|             lastSyncId: lastSyncId |             lastSyncId: lastSyncId | ||||||
|         })); |         })); | ||||||
|     }, 1000); |     }, 1000); | ||||||
| }, 1000); | }, 0); | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|     logError, |     logError, | ||||||
|   | |||||||
| @@ -85,19 +85,17 @@ async function ajax(url, method, data) { | |||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
| setTimeout(() => { | if (utils.isElectron()) { | ||||||
|     if (utils.isElectron()) { |     const ipc = require('electron').ipcRenderer; | ||||||
|         const ipc = require('electron').ipcRenderer; |  | ||||||
|  |  | ||||||
|         ipc.on('server-response', (event, arg) => { |     ipc.on('server-response', (event, arg) => { | ||||||
|             console.log(utils.now(), "Response #" + arg.requestId + ": " + arg.statusCode); |         console.log(utils.now(), "Response #" + arg.requestId + ": " + arg.statusCode); | ||||||
|  |  | ||||||
|             reqResolves[arg.requestId](arg.body); |         reqResolves[arg.requestId](arg.body); | ||||||
|  |  | ||||||
|             delete reqResolves[arg.requestId]; |         delete reqResolves[arg.requestId]; | ||||||
|         }); |     }); | ||||||
|     } | } | ||||||
| }, 100); |  | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|     get, |     get, | ||||||
|   | |||||||
							
								
								
									
										7
									
								
								src/public/libraries/jquery.min.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								src/public/libraries/jquery.min.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -7,7 +7,7 @@ const appInfo = require('../../services/app_info'); | |||||||
| async function getMigrationInfo() { | async function getMigrationInfo() { | ||||||
|     return { |     return { | ||||||
|         dbVersion: parseInt(await optionService.getOption('dbVersion')), |         dbVersion: parseInt(await optionService.getOption('dbVersion')), | ||||||
|         app_dbVersion: appInfo.dbVersion |         appDbVersion: appInfo.dbVersion | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -19,6 +19,7 @@ function init(app) { | |||||||
|  |  | ||||||
|         res.status = function(statusCode) { |         res.status = function(statusCode) { | ||||||
|             res.statusCode = statusCode; |             res.statusCode = statusCode; | ||||||
|  |             return res; | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
|         res.send = function(obj) { |         res.send = function(obj) { | ||||||
|   | |||||||
| @@ -40,22 +40,22 @@ const cls = require('../services/cls'); | |||||||
| const sql = require('../services/sql'); | const sql = require('../services/sql'); | ||||||
| const protectedSessionService = require('../services/protected_session'); | const protectedSessionService = require('../services/protected_session'); | ||||||
|  |  | ||||||
| function apiResultHandler(res, result) { | function apiResultHandler(req, res, result) { | ||||||
|     // if it's an array and first element is integer then we consider this to be [statusCode, response] format |     // if it's an array and first element is integer then we consider this to be [statusCode, response] format | ||||||
|     if (Array.isArray(result) && result.length > 0 && Number.isInteger(result[0])) { |     if (Array.isArray(result) && result.length > 0 && Number.isInteger(result[0])) { | ||||||
|         const [statusCode, response] = result; |         const [statusCode, response] = result; | ||||||
|  |  | ||||||
|         res.status(statusCode).send(response); |         res.status(statusCode).send(response); | ||||||
|  |  | ||||||
|         if (statusCode !== 200) { |         if (statusCode !== 200 && statusCode !== 201 && statusCode !== 204) { | ||||||
|             log.info(`${method} ${path} returned ${statusCode} with response ${JSON.stringify(response)}`); |             log.info(`${req.method} ${req.originalUrl} returned ${statusCode} with response ${JSON.stringify(response)}`); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     else if (result === undefined) { |     else if (result === undefined) { | ||||||
|         res.status(204).send(); |         res.status(204).send(); | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|         res.status(200).send(result); |         res.send(result); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -76,7 +76,7 @@ function route(method, path, middleware, routeHandler, resultHandler) { | |||||||
|             }); |             }); | ||||||
|  |  | ||||||
|             if (resultHandler) { |             if (resultHandler) { | ||||||
|                 resultHandler(res, result); |                 resultHandler(req, res, result); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         catch (e) { |         catch (e) { | ||||||
| @@ -158,6 +158,7 @@ function register(app) { | |||||||
|     apiRoute(GET, '/api/sync/labels/:labelId', syncApiRoute.getLabel); |     apiRoute(GET, '/api/sync/labels/:labelId', syncApiRoute.getLabel); | ||||||
|     apiRoute(GET, '/api/sync/api_tokens/:apiTokenId', syncApiRoute.getApiToken); |     apiRoute(GET, '/api/sync/api_tokens/:apiTokenId', syncApiRoute.getApiToken); | ||||||
|     apiRoute(PUT, '/api/sync/notes', syncApiRoute.updateNote); |     apiRoute(PUT, '/api/sync/notes', syncApiRoute.updateNote); | ||||||
|  |     apiRoute(PUT, '/api/sync/branches', syncApiRoute.updateBranch); | ||||||
|     apiRoute(PUT, '/api/sync/note_revisions', syncApiRoute.updateNoteRevision); |     apiRoute(PUT, '/api/sync/note_revisions', syncApiRoute.updateNoteRevision); | ||||||
|     apiRoute(PUT, '/api/sync/note_reordering', syncApiRoute.updateNoteReordering); |     apiRoute(PUT, '/api/sync/note_reordering', syncApiRoute.updateNoteReordering); | ||||||
|     apiRoute(PUT, '/api/sync/options', syncApiRoute.updateOption); |     apiRoute(PUT, '/api/sync/options', syncApiRoute.updateOption); | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| const scriptService = require('./script'); | const scriptService = require('./script'); | ||||||
| const repository = require('./repository'); | const repository = require('./repository'); | ||||||
| const cls = require('./cls'); | const cls = require('./cls'); | ||||||
|  | const sqlInit = require('./sql_init'); | ||||||
|  |  | ||||||
| async function runNotesWithLabel(runAttrValue) { | async function runNotesWithLabel(runAttrValue) { | ||||||
|     const notes = await repository.getEntities(` |     const notes = await repository.getEntities(` | ||||||
| @@ -19,8 +20,10 @@ async function runNotesWithLabel(runAttrValue) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| setTimeout(cls.wrap(() => runNotesWithLabel('backendStartup')), 10 * 1000); | sqlInit.dbReady.then(() => { | ||||||
|  |     setTimeout(cls.wrap(() => runNotesWithLabel('backendStartup')), 10 * 1000); | ||||||
|  |  | ||||||
| setInterval(cls.wrap(() => runNotesWithLabel('hourly')), 3600 * 1000); |     setInterval(cls.wrap(() => runNotesWithLabel('hourly')), 3600 * 1000); | ||||||
|  |  | ||||||
| setInterval(cls.wrap(() => runNotesWithLabel('daily')), 24 * 3600 * 1000); |     setInterval(cls.wrap(() => runNotesWithLabel('daily')), 24 * 3600 * 1000); | ||||||
|  | }); | ||||||
							
								
								
									
										4
									
								
								src/www
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								src/www
									
									
									
									
									
								
							| @@ -18,8 +18,6 @@ const log = require('./services/log'); | |||||||
| const appInfo = require('./services/app_info'); | const appInfo = require('./services/app_info'); | ||||||
| const messagingService = require('./services/messaging'); | const messagingService = require('./services/messaging'); | ||||||
| const utils = require('./services/utils'); | const utils = require('./services/utils'); | ||||||
| const sql = require('./services/sql'); |  | ||||||
| const sqlInit = require('./services/sql_init'); |  | ||||||
|  |  | ||||||
| const port = normalizePort(config['Network']['port'] || '3000'); | const port = normalizePort(config['Network']['port'] || '3000'); | ||||||
| app.set('port', port); | app.set('port', port); | ||||||
| @@ -56,7 +54,7 @@ httpServer.listen(port); | |||||||
| httpServer.on('error', onError); | httpServer.on('error', onError); | ||||||
| httpServer.on('listening', onListening); | httpServer.on('listening', onListening); | ||||||
|  |  | ||||||
| sqlInit.dbReady.then(() => messagingService.init(httpServer, sessionParser)); | messagingService.init(httpServer, sessionParser); | ||||||
|  |  | ||||||
| if (utils.isElectron()) { | if (utils.isElectron()) { | ||||||
|     const electronRouting = require('./routes/electron'); |     const electronRouting = require('./routes/electron'); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user