Add check for deletion of default config

This commit is contained in:
Manuel
2023-01-15 22:31:46 +01:00
parent 69199bdc9c
commit 0efc9ebb55
5 changed files with 42 additions and 13 deletions

View File

@@ -136,6 +136,13 @@ function Delete(req: NextApiRequest, res: NextApiResponse<any>) {
});
}
if (slug.toLowerCase() === 'default') {
Consola.error('Rejected config deletion because default configuration can\'t be deleted');
return res.status(403).json({
message: 'Default config can\'t be deleted',
});
}
// Loop over all the files in the /data/configs directory
// Get all the configs in the /data/configs folder
// All the files that end in ".json"