Major version update. Major bugfixes. Security vulnerabilites fixed

This commit is contained in:
2026-10-14 03:02:07 +01:00
parent 4e47bd8ce0
commit 7c095f6f16
112 changed files with 2479 additions and 1219 deletions
+12 -5
View File
@@ -1,18 +1,25 @@
import grabDBDir from "../utils/grab-db-dir";
import fs from "fs";
import _ from "lodash";
export default function grabSortedBackups({ config }) {
const { backup_dir } = grabDBDir({ config });
const backups = fs.readdirSync(backup_dir);
if (!fs.existsSync(backup_dir))
return [];
/**
* Only files named by `grabDBBackupFileName` for this database. Anything
* else in the directory is never listed (or trimmed).
*/
const backup_name_regex = new RegExp(`^${_.escapeRegExp(config.db_name)}-\\d+$`);
const backups = fs
.readdirSync(backup_dir)
.filter((b) => backup_name_regex.test(b));
/**
* Order Backups. Most recent first.
*/
const ordered_backups = backups.sort((a, b) => {
const a_date = Number(a.split("-").pop());
const b_date = Number(b.split("-").pop());
if (a_date > b_date) {
return -1;
}
return 1;
return b_date - a_date;
});
return ordered_backups;
}