This commit is contained in:
May 2023-05-09 22:30:13 -07:00
parent 7621b3ce5d
commit 6337521983

View file

@ -57,12 +57,15 @@ fileApiRoutes.post("/manage", (req,res) => {
if (!acc) return if (!acc) return
if (!req.body.target || req.body.target.length < 1) return if (!req.body.target || req.body.target.length < 1) return
let modified = 0
req.body.target.forEach((e:string) => { req.body.target.forEach((e:string) => {
if (!acc.files.includes(e)) return if (!acc.files.includes(e)) return
switch( req.body.action ) { switch( req.body.action ) {
case "delete": case "delete":
files.unlink(e) files.unlink(e)
modified++;
break; break;
case "changeFileVisibility": case "changeFileVisibility":
@ -72,8 +75,11 @@ fileApiRoutes.post("/manage", (req,res) => {
writeFile(process.cwd()+"/.data/files.json",JSON.stringify(files.files), (err) => { writeFile(process.cwd()+"/.data/files.json",JSON.stringify(files.files), (err) => {
if (err) console.log(err) if (err) console.log(err)
}) })
modified++;
break; break;
} }
}) })
res.send(`modified ${modified} files`)
}) })