From 6fcaab8188b88caaa3a3beb6837c989a5da3a735 Mon Sep 17 00:00:00 2001 From: jp Date: Fri, 3 Dec 2021 12:03:18 -0300 Subject: [PATCH] . --- .gitignore | 1 + run.js | 10 ++++++---- static/start.js | 7 ++++--- templates/start.html | 6 +----- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index c36ec0a..62f0acf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ data node_modules +static/*.upload.* \ No newline at end of file diff --git a/run.js b/run.js index 0bbc366..b619cd7 100644 --- a/run.js +++ b/run.js @@ -89,7 +89,9 @@ const requestListener = function (req, res) { intcode = "./data/keys/" + intcode fs.writeFileSync(intcode,body) - fs.readFile(intcode, 'utf8', function(err, data){ + + /*fs.readFile(intcode, 'utf8', function(err, data){ + if (err){ throw err; } var lines = data.split('\n') var type = lines[2] @@ -107,10 +109,10 @@ const requestListener = function (req, res) { lines = lines.join('\n') //console.log(lines) /* fs.writeFileSync(intcode, lines); */ - fs.writeFileSync(intcode+".type",type) + //fs.writeFileSync(intcode+".type",type) console.log("File uploaded to "+"\x1b[32m"+intcode.replace("./data/keys/","")+"\x1b[37m" +" Type: " + type) -}); +/*})*/; }) @@ -126,7 +128,7 @@ console.log("File uploaded to "+"\x1b[32m"+intcode.replace("./data/keys/","")+"\ res.end(data); }); - } else if(String(req.url).startsWith("/download/")){ + } else if(String(req.url).startsWith("/download/") && false){ //log(String(req.url).replace("/download/","")) let pathh = (String(req.url).replace("/download/","")) pathh = "./data/keys/" + pathh + ".type" diff --git a/static/start.js b/static/start.js index 05e8a97..5be10a1 100644 --- a/static/start.js +++ b/static/start.js @@ -1,16 +1,17 @@ window.onload = function(){ let codeplace = document.getElementById("code") -//let upbutton = document.getElementById("upb") +let upbutton = document.getElementById("upb") let dbutton = document.getElementById("downb") console.log("Script included.") -//upbutton.onclick = function(){ +upbutton.onclick = function(){ -//} +} dbutton.onclick =function(){ window.location = "/download/"+codeplace.value } + } diff --git a/templates/start.html b/templates/start.html index 413a5c9..6f3aa0f 100644 --- a/templates/start.html +++ b/templates/start.html @@ -28,11 +28,7 @@

-
- -
- -
+