Skip to content

Commit 6264953

Browse files
committed
fix
1 parent 56dd22d commit 6264953

1 file changed

Lines changed: 11 additions & 15 deletions

File tree

run.js

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,21 @@ let path = require("path")
1616

1717

1818

19-
console.log("\x1b[31m WARNING: Folder \"data\" will be erased and rebuilt if you proceed \x1b[37m"
20-
+ "\n~Same will happen for all files in /static/ matching \x1b[34m *.upload.* \x1b[37m")
19+
console.log("\x1b[31m WARNING: All files in /static/ matching \x1b[34m *.upload.* \x1b[31m will be removed \x1b[37m")
2120

2221
const answer = prompt("Would you like to proceed? (S/N)")
2322
if (answer.toUpperCase() =="S"){
2423
//log("removing")
25-
if(fs.existsSync("data")){
26-
fs.rmdirSync("data",{recursive: true})
24+
if(fs.existsSync("static")){
25+
let filess = fs.readdirSync("./static")
26+
for (file in filess){
27+
28+
//console.log(String(filess[file]))
29+
if (String(filess[file]).match(/\.*\.upload\.*/)){
30+
console.log("Removing "+"\x1b[32m"+ String(filess[file]) + "\x1b[37m")
31+
fs.unlinkSync(path.join(__dirname,"static", filess[file]))
32+
}
33+
}
2734
}
2835
console.log("Done!")
2936
console.log("Now we can start the HTTP server lol")
@@ -36,18 +43,7 @@ let path = require("path")
3643
process.exit(1)
3744
}
3845

39-
let filess = fs.readdirSync("./static")
40-
for (file in filess){
41-
42-
//console.log(String(filess[file]))
43-
if (String(filess[file]).match(/\.*\.upload\.*/)){
44-
console.log("Removing "+"\x1b[32m"+ String(filess[file]) + "\x1b[37m")
45-
fs.unlinkSync(path.join(__dirname,"static", filess[file]))
46-
}
47-
}
4846

49-
fs.mkdirSync("./data");
50-
fs.mkdirSync("./data/keys")
5147

5248
const requestListener = function (req, res) {
5349
let intcode = "" + crypto.randomInt(999999);

0 commit comments

Comments
 (0)