mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Move backgrounds endpoints into separate file
This commit is contained in:
10
src/util.js
10
src/util.js
@ -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,
|
||||
};
|
||||
|
Reference in New Issue
Block a user