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