Skip to content

Commit 480ec83

Browse files
committed
Stuff
1 parent dc6ea92 commit 480ec83

4 files changed

Lines changed: 30 additions & 10 deletions

File tree

run.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let fs = require("fs")
55
let log = console.log;
66
let http = require("http")
77
let crypto = require("crypto")
8-
8+
let {parse} = require("url")
99
if (fs.existsSync("data")) {
1010
console.log("\x1b[31m WARNING: Folder \"data\" will be erased and rebuilt if you proceed \x1b[37m")
1111
const answer = prompt("Would you like to proceed? (S/N)")
@@ -28,7 +28,10 @@ fs.mkdirSync("./data");
2828
fs.mkdirSync("./data/keys")
2929

3030
const requestListener = function (req, res) {
31-
if (req.url!=="/favicon.ico") log(req.url)
31+
if (req.url!=="/favicon.ico") {
32+
log( String(new Date) + " => " + String(req.url))
33+
34+
}
3235
if (req.url === "/test"){
3336
fs.readFile("templates/rick.html", function (err,data) {
3437
if (err) {
@@ -57,6 +60,19 @@ const requestListener = function (req, res) {
5760
res.writeHead(200);
5861
res.end(data);
5962
});
63+
}else if(String(req.url).split("?")[0]==="/upload"){
64+
65+
let body = "";
66+
req.on("data",(chunk)=>{
67+
body += chunk
68+
69+
})
70+
req.on("end",()=>{
71+
res.writeHead(200, { "Content-Type": "text/plain" });
72+
res.end("Success");
73+
fs.writeFileSync("./data/run.txt",body)
74+
})
75+
6076
}else if(req.url.includes("/../")) {
6177
fs.readFile("templates/500.html", function (err,data) {
6278
if (err) {

static/start.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
window.onload = function(){
22

3-
let upbutton = document.getElementById("upb")
3+
//let upbutton = document.getElementById("upb")
4+
45
let dbutton = document.getElementById("downb")
56

67
console.log("Script included.")
7-
upbutton.onclick = function(){
8+
//upbutton.onclick = function(){
89

9-
}
10+
//}
1011
dbutton.onclick =function(){
1112

1213
}

static/style.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ nav {
22

33
position: fixed;
44
top: 0%;
5-
height: 10%;
5+
height: 50%;
66
width: 100%;
77
text-align: center;
88
vertical-align: top;
99
};
1010
.eviloctopus {
11-
height: 10%;
12-
text-align:left;
11+
height: 100%;
12+
text-align:center;
1313
position: fixed;
1414
top: 0%;
1515

templates/start.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<link rel="stylesheet" type="text/css" href="style.css" />
1111
</head>
1212
<style>
13-
button {
13+
.dum button {
1414
height: 10%;
1515
background-color: black;
1616
color: white;
@@ -28,7 +28,10 @@
2828
<div height = 5%></div>
2929

3030
<input type="text" name="Code" size="15"> <button id = "downb">Download file</button></br>
31-
<button id = "upb">Upload file</button>
31+
<form action="/upload">
32+
<input type="file" id="form" name="filename">
33+
<input class = "dum" type="submit">
34+
</form>
3235

3336
<script src = "start.js"></script>
3437

0 commit comments

Comments
 (0)