mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-31 18:37:00 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			27 lines
		
	
	
		
			879 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			879 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| const Logger = require('../Logger')
 | |
| const Path = require('path')
 | |
| 
 | |
| class FileSystemController {
 | |
|   constructor() { }
 | |
| 
 | |
|   async getPaths(req, res) {
 | |
|     var excludedDirs = ['node_modules', 'client', 'server', '.git', 'static', 'build', 'dist', 'metadata', 'config', 'sys', 'proc'].map(dirname => {
 | |
|       return Path.sep + dirname
 | |
|     })
 | |
| 
 | |
|     // Do not include existing mapped library paths in response
 | |
|     this.db.libraries.forEach(lib => {
 | |
|       lib.folders.forEach((folder) => {
 | |
|         var dir = folder.fullPath
 | |
|         if (dir.includes(global.appRoot)) dir = dir.replace(global.appRoot, '')
 | |
|         excludedDirs.push(dir)
 | |
|       })
 | |
|     })
 | |
| 
 | |
|     Logger.debug(`[Server] get file system paths, excluded: ${excludedDirs.join(', ')}`)
 | |
|     res.json({
 | |
|       directories: await this.getDirectories(global.appRoot, '/', excludedDirs)
 | |
|     })
 | |
|   }
 | |
| }
 | |
| module.exports = new FileSystemController() |