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", | ||||
|   "description": "Trilium Notes", | ||||
|   "version": "0.10.0-beta", | ||||
|   "version": "0.10.1-beta", | ||||
|   "license": "AGPL-3.0-only", | ||||
|   "main": "electron.js", | ||||
|   "repository": { | ||||
|   | ||||
| @@ -1,9 +1,9 @@ | ||||
| import server from './services/server.js'; | ||||
|  | ||||
| $(document).ready(() => { | ||||
|     server.get('migration').then(result => { | ||||
|         const appDbVersion = result.app_dbVersion; | ||||
|         const dbVersion = result.dbVersion; | ||||
| $(document).ready(async () => { | ||||
|     const {appDbVersion, dbVersion} = await server.get('migration'); | ||||
|  | ||||
|     console.log("HI", {appDbVersion, dbVersion}); | ||||
|  | ||||
|     if (appDbVersion === dbVersion) { | ||||
|         $("#up-to-date").show(); | ||||
| @@ -14,7 +14,6 @@ $(document).ready(() => { | ||||
|         $("#app-db-version").html(appDbVersion); | ||||
|         $("#db-version").html(dbVersion); | ||||
|     } | ||||
|     }); | ||||
| }); | ||||
|  | ||||
| $("#run-migration").click(async () => { | ||||
| @@ -38,3 +37,10 @@ $("#run-migration").click(async () => { | ||||
|         $("#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 | ||||
|         })); | ||||
|     }, 1000); | ||||
| }, 1000); | ||||
| }, 0); | ||||
|  | ||||
| export default { | ||||
|     logError, | ||||
|   | ||||
| @@ -85,8 +85,7 @@ async function ajax(url, method, data) { | ||||
|     }); | ||||
| } | ||||
|  | ||||
| setTimeout(() => { | ||||
|     if (utils.isElectron()) { | ||||
| if (utils.isElectron()) { | ||||
|     const ipc = require('electron').ipcRenderer; | ||||
|  | ||||
|     ipc.on('server-response', (event, arg) => { | ||||
| @@ -96,8 +95,7 @@ setTimeout(() => { | ||||
|  | ||||
|         delete reqResolves[arg.requestId]; | ||||
|     }); | ||||
|     } | ||||
| }, 100); | ||||
| } | ||||
|  | ||||
| export default { | ||||
|     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() { | ||||
|     return { | ||||
|         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.statusCode = statusCode; | ||||
|             return res; | ||||
|         }; | ||||
|  | ||||
|         res.send = function(obj) { | ||||
|   | ||||
| @@ -40,22 +40,22 @@ const cls = require('../services/cls'); | ||||
| const sql = require('../services/sql'); | ||||
| 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 (Array.isArray(result) && result.length > 0 && Number.isInteger(result[0])) { | ||||
|         const [statusCode, response] = result; | ||||
|  | ||||
|         res.status(statusCode).send(response); | ||||
|  | ||||
|         if (statusCode !== 200) { | ||||
|             log.info(`${method} ${path} returned ${statusCode} with response ${JSON.stringify(response)}`); | ||||
|         if (statusCode !== 200 && statusCode !== 201 && statusCode !== 204) { | ||||
|             log.info(`${req.method} ${req.originalUrl} returned ${statusCode} with response ${JSON.stringify(response)}`); | ||||
|         } | ||||
|     } | ||||
|     else if (result === undefined) { | ||||
|         res.status(204).send(); | ||||
|     } | ||||
|     else { | ||||
|         res.status(200).send(result); | ||||
|         res.send(result); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -76,7 +76,7 @@ function route(method, path, middleware, routeHandler, resultHandler) { | ||||
|             }); | ||||
|  | ||||
|             if (resultHandler) { | ||||
|                 resultHandler(res, result); | ||||
|                 resultHandler(req, res, result); | ||||
|             } | ||||
|         } | ||||
|         catch (e) { | ||||
| @@ -158,6 +158,7 @@ function register(app) { | ||||
|     apiRoute(GET, '/api/sync/labels/:labelId', syncApiRoute.getLabel); | ||||
|     apiRoute(GET, '/api/sync/api_tokens/:apiTokenId', syncApiRoute.getApiToken); | ||||
|     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_reordering', syncApiRoute.updateNoteReordering); | ||||
|     apiRoute(PUT, '/api/sync/options', syncApiRoute.updateOption); | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| const scriptService = require('./script'); | ||||
| const repository = require('./repository'); | ||||
| const cls = require('./cls'); | ||||
| const sqlInit = require('./sql_init'); | ||||
|  | ||||
| async function runNotesWithLabel(runAttrValue) { | ||||
|     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 messagingService = require('./services/messaging'); | ||||
| const utils = require('./services/utils'); | ||||
| const sql = require('./services/sql'); | ||||
| const sqlInit = require('./services/sql_init'); | ||||
|  | ||||
| const port = normalizePort(config['Network']['port'] || '3000'); | ||||
| app.set('port', port); | ||||
| @@ -56,7 +54,7 @@ httpServer.listen(port); | ||||
| httpServer.on('error', onError); | ||||
| httpServer.on('listening', onListening); | ||||
|  | ||||
| sqlInit.dbReady.then(() => messagingService.init(httpServer, sessionParser)); | ||||
| messagingService.init(httpServer, sessionParser); | ||||
|  | ||||
| if (utils.isElectron()) { | ||||
|     const electronRouting = require('./routes/electron'); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user