new reset/wipe script and delete banners and captchas properly

merge-requests/208/head
fatchan 5 years ago
parent 8da6ce3d13
commit 881bdf946e
  1. 2
      package.json
  2. 14
      wipe.js

@ -33,7 +33,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js",
"wipe": "node wipe.js"
"wipe": "node reset.js && gulp"
},
"author": "",
"license": "ISC"

@ -101,11 +101,21 @@ const Mongo = require(__dirname+'/db/db.js')
});
await readdir('uploads/img/').then(async files => {
await Promise.all(files.map(async file => {
if (file != 'spoiler.png')
unlink(path.join('uploads/img/', file));
unlink(path.join('uploads/img/', file));
}))
});
await readdir('uploads/captcha/').then(async files => {
await Promise.all(files.map(async file => {
unlink(path.join('uploads/captcha/', file));
}))
});
await readdir('uploads/banner/').then(async files => {
await Promise.all(files.map(async file => {
unlink(path.join('uploads/banner/', file));
}))
});
console.log('creating admin account: admin:changeme');
await Accounts.insertOne('admin', 'changeme', 3);
console.log('done');
process.exit(0);
})();

Loading…
Cancel
Save