From 4610a5ab9532c16b37bb33ff383e953c578937eb Mon Sep 17 00:00:00 2001 From: jp Date: Wed, 1 Dec 2021 16:02:19 -0300 Subject: [PATCH 1/3] . --- static/start.js | 5 +++++ static/uploadframe.html | 2 +- templates/start.html | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/static/start.js b/static/start.js index 2d5322e..e247257 100644 --- a/static/start.js +++ b/static/start.js @@ -12,4 +12,9 @@ dbutton.onclick =function(){ if (frame.src != "downframe.html") frame.src = "downframe.html" window.document.title = "Download something" } +frame.onload = function(){ + if (frame.src === "uploadframe.html"){ + document.getElementById("iframeid").contentWindow.code = upcode; + } +} } \ No newline at end of file diff --git a/static/uploadframe.html b/static/uploadframe.html index db967a2..7c8ac82 100644 --- a/static/uploadframe.html +++ b/static/uploadframe.html @@ -5,7 +5,7 @@ - diff --git a/templates/start.html b/templates/start.html index a1df3da..4d5d4b2 100644 --- a/templates/start.html +++ b/templates/start.html @@ -2,7 +2,7 @@ Upload something From dc6ea921e65cb5b9a9f35992759878d8c31642dd Mon Sep 17 00:00:00 2001 From: jp Date: Wed, 1 Dec 2021 16:20:38 -0300 Subject: [PATCH 2/3] . --- static/downframe.html | 0 static/start.js | 14 ++++---------- static/uploadframe.html | 13 ------------- templates/start.html | 24 +++++++++++------------- 4 files changed, 15 insertions(+), 36 deletions(-) delete mode 100644 static/downframe.html delete mode 100644 static/uploadframe.html 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 e247257..246a0a9 100644 --- a/static/start.js +++ b/static/start.js @@ -2,19 +2,13 @@ window.onload = function(){ 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" + } dbutton.onclick =function(){ - if (frame.src != "downframe.html") frame.src = "downframe.html" - window.document.title = "Download something" + } -frame.onload = function(){ - if (frame.src === "uploadframe.html"){ - document.getElementById("iframeid").contentWindow.code = upcode; - } + } -} \ No newline at end of file diff --git a/static/uploadframe.html b/static/uploadframe.html deleted file mode 100644 index 7c8ac82..0000000 --- a/static/uploadframe.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - Frame - - - - - - \ No newline at end of file diff --git a/templates/start.html b/templates/start.html index 4d5d4b2..f26008d 100644 --- a/templates/start.html +++ b/templates/start.html @@ -1,6 +1,6 @@ -Upload something +Quickload From 480ec831e38a5b8d928b4a9c7524133243fa6ae9 Mon Sep 17 00:00:00 2001 From: jp Date: Wed, 1 Dec 2021 17:31:50 -0300 Subject: [PATCH 3/3] Stuff --- run.js | 20 ++++++++++++++++++-- static/start.js | 7 ++++--- static/style.css | 6 +++--- templates/start.html | 7 +++++-- 4 files changed, 30 insertions(+), 10 deletions(-) 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/start.js b/static/start.js index 246a0a9..42837f4 100644 --- a/static/start.js +++ b/static/start.js @@ -1,12 +1,13 @@ window.onload = function(){ -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(){ } 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/templates/start.html b/templates/start.html index f26008d..1b84b03 100644 --- a/templates/start.html +++ b/templates/start.html @@ -10,7 +10,7 @@