Merge branch 'advplyr:master' into dewyer/add-custom-metadata-provider

This commit is contained in:
FlyinPancake 2024-01-13 01:08:23 +01:00 committed by GitHub
commit 6ef4944d89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 764 additions and 309 deletions

View file

@ -324,35 +324,6 @@ class ApiRouter {
this.router.delete('/custom-metadata-providers/admin/:id', MiscController.deleteCustomMetadataProviders.bind(this))
}
async getDirectories(dir, relpath, excludedDirs, level = 0) {
try {
const paths = await fs.readdir(dir)
let dirs = await Promise.all(paths.map(async dirname => {
const fullPath = Path.join(dir, dirname)
const path = Path.join(relpath, dirname)
const isDir = (await fs.lstat(fullPath)).isDirectory()
if (isDir && !excludedDirs.includes(path) && dirname !== 'node_modules') {
return {
path,
dirname,
fullPath,
level,
dirs: level < 4 ? (await this.getDirectories(fullPath, path, excludedDirs, level + 1)) : []
}
} else {
return false
}
}))
dirs = dirs.filter(d => d)
return dirs
} catch (error) {
Logger.error('Failed to readdir', dir, error)
return []
}
}
//
// Helper Methods
//