diff --git a/run.js b/run.js index 5655b77..8fd6426 100644 --- a/run.js +++ b/run.js @@ -5,7 +5,7 @@ let fs = require("fs") let log = console.log; let http = require("http") let crypto = require("crypto") - +let {parse} = require("url") if (fs.existsSync("data")) { console.log("\x1b[31m WARNING: Folder \"data\" will be erased and rebuilt if you proceed \x1b[37m") const answer = prompt("Would you like to proceed? (S/N)") @@ -28,7 +28,10 @@ fs.mkdirSync("./data"); fs.mkdirSync("./data/keys") const requestListener = function (req, res) { - if (req.url!=="/favicon.ico") log(req.url) + if (req.url!=="/favicon.ico") { + log( String(new Date) + " => " + String(req.url)) + + } if (req.url === "/test"){ fs.readFile("templates/rick.html", function (err,data) { if (err) { @@ -57,6 +60,19 @@ const requestListener = function (req, res) { res.writeHead(200); res.end(data); }); + }else if(String(req.url).split("?")[0]==="/upload"){ + + let body = ""; + req.on("data",(chunk)=>{ + body += chunk + + }) + req.on("end",()=>{ + res.writeHead(200, { "Content-Type": "text/plain" }); + res.end("Success"); + fs.writeFileSync("./data/run.txt",body) + }) + }else if(req.url.includes("/../")) { fs.readFile("templates/500.html", function (err,data) { if (err) { diff --git a/static/downframe.html b/static/downframe.html deleted file mode 100644 index e69de29..0000000 diff --git a/static/start.js b/static/start.js index 2d5322e..42837f4 100644 --- a/static/start.js +++ b/static/start.js @@ -1,15 +1,15 @@ window.onload = function(){ -let upbutton = document.getElementById("upb") +//let upbutton = document.getElementById("upb") + let dbutton = document.getElementById("downb") -let frame = document.getElementById("frame") + console.log("Script included.") -upbutton.onclick = function(){ - if (frame.src != "uploadframe.html") frame.src = "uploadframe.html"; - window.document.title = "Upload something" -} +//upbutton.onclick = function(){ + +//} dbutton.onclick =function(){ - if (frame.src != "downframe.html") frame.src = "downframe.html" - window.document.title = "Download something" + +} + } -} \ No newline at end of file diff --git a/static/style.css b/static/style.css index 3712167..7005f97 100644 --- a/static/style.css +++ b/static/style.css @@ -2,14 +2,14 @@ nav { position: fixed; top: 0%; - height: 10%; + height: 50%; width: 100%; text-align: center; vertical-align: top; }; .eviloctopus { - height: 10%; - text-align:left; + height: 100%; + text-align:center; position: fixed; top: 0%; diff --git a/static/uploadframe.html b/static/uploadframe.html deleted file mode 100644 index db967a2..0000000 --- a/static/uploadframe.html +++ /dev/null @@ -1,13 +0,0 @@ - -
-