mirror of
https://github.com/mollersuite/monofile.git
synced 2024-11-25 15:06:26 -08:00
m
This commit is contained in:
parent
7621b3ce5d
commit
6337521983
|
@ -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`)
|
||||||
|
|
||||||
})
|
})
|
Loading…
Reference in a new issue