mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 04:51:31 +08:00 
			
		
		
		
	moved protected session expiration scheduling #2855
This commit is contained in:
		
							parent
							
								
									c24c807921
								
							
						
					
					
						commit
						37eb16b2f3
					
				| @ -3,7 +3,6 @@ | |||||||
| const log = require('./log'); | const log = require('./log'); | ||||||
| const dataEncryptionService = require('./data_encryption'); | const dataEncryptionService = require('./data_encryption'); | ||||||
| const options = require("./options"); | const options = require("./options"); | ||||||
| const sqlInit = require("./sql_init"); |  | ||||||
| 
 | 
 | ||||||
| let dataKey = null; | let dataKey = null; | ||||||
| 
 | 
 | ||||||
| @ -64,8 +63,7 @@ function touchProtectedSession() { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| sqlInit.dbReady.then(() => { | function checkProtectedSessionExpiration() { | ||||||
|     setInterval(() => { |  | ||||||
|     const protectedSessionTimeout = options.getOptionInt('protectedSessionTimeout'); |     const protectedSessionTimeout = options.getOptionInt('protectedSessionTimeout'); | ||||||
|     if (isProtectedSessionAvailable() |     if (isProtectedSessionAvailable() | ||||||
|         && lastProtectedSessionOperationDate |         && lastProtectedSessionOperationDate | ||||||
| @ -73,11 +71,11 @@ sqlInit.dbReady.then(() => { | |||||||
| 
 | 
 | ||||||
|         resetDataKey(); |         resetDataKey(); | ||||||
| 
 | 
 | ||||||
|  |         log.info("Expiring protected session"); | ||||||
|  | 
 | ||||||
|         require('./ws').reloadFrontend(); |         require('./ws').reloadFrontend(); | ||||||
|     } |     } | ||||||
|     }, 30000); | } | ||||||
| }); |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| module.exports = { | module.exports = { | ||||||
|     setDataKey, |     setDataKey, | ||||||
| @ -87,5 +85,6 @@ module.exports = { | |||||||
|     decrypt, |     decrypt, | ||||||
|     decryptString, |     decryptString, | ||||||
|     decryptNotes, |     decryptNotes, | ||||||
|     touchProtectedSession |     touchProtectedSession, | ||||||
|  |     checkProtectedSessionExpiration | ||||||
| }; | }; | ||||||
|  | |||||||
| @ -6,6 +6,7 @@ const log = require('./log'); | |||||||
| const sql = require("./sql"); | const sql = require("./sql"); | ||||||
| const becca = require("../becca/becca"); | const becca = require("../becca/becca"); | ||||||
| const specialNotesService = require("../services/special_notes"); | const specialNotesService = require("../services/special_notes"); | ||||||
|  | const protectedSessionService = require("../services/protected_session"); | ||||||
| 
 | 
 | ||||||
| function getRunAtHours(note) { | function getRunAtHours(note) { | ||||||
|     try { |     try { | ||||||
| @ -59,4 +60,6 @@ sqlInit.dbReady.then(() => { | |||||||
| 
 | 
 | ||||||
|         setTimeout(cls.wrap(() => specialNotesService.createMissingSpecialNotes()), 10 * 1000); |         setTimeout(cls.wrap(() => specialNotesService.createMissingSpecialNotes()), 10 * 1000); | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     setInterval(() => protectedSessionService.checkProtectedSessionExpiration(), 30000); | ||||||
| }); | }); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam