mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	
		
			
	
	
		
			25 lines
		
	
	
		
			584 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
		
		
			
		
	
	
			25 lines
		
	
	
		
			584 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
|  | "use strict"; | ||
|  | 
 | ||
|  | const protected_session = require('./protected_session'); | ||
|  | 
 | ||
|  | module.exports = function(req) { | ||
|  |     const browserId = req.headers['x-browser-id']; | ||
|  | 
 | ||
|  |     function isProtectedSessionAvailable() { | ||
|  |         return protected_session.isProtectedSessionAvailable(req); | ||
|  |     } | ||
|  | 
 | ||
|  |     function getDataKey() { | ||
|  |         if (!isProtectedSessionAvailable()) { | ||
|  |             throw new Error("Protected session is not available"); | ||
|  |         } | ||
|  | 
 | ||
|  |         return protected_session.getDataKey(req); | ||
|  |     } | ||
|  | 
 | ||
|  |     return { | ||
|  |         browserId, | ||
|  |         isProtectedSessionAvailable, | ||
|  |         getDataKey | ||
|  |     }; | ||
|  | }; |