Move backgrounds endpoints into separate file

This commit is contained in:
valadaptive
2023-12-07 15:21:19 -05:00
parent 2367f4f38f
commit 32c86c1e95
3 changed files with 107 additions and 91 deletions

View File

@ -336,6 +336,15 @@ function removeOldBackups(prefix) {
}
}
function getImages(path) {
return fs
.readdirSync(path)
.filter(file => {
const type = mime.lookup(file);
return type && type.startsWith('image/');
})
.sort(Intl.Collator().compare);
}
module.exports = {
getConfig,
@ -355,4 +364,5 @@ module.exports = {
removeFileExtension,
generateTimestamp,
removeOldBackups,
getImages,
};