Skip to content

Commit 5812122

Browse files
authored
Merge pull request #10 from J-P-S-O/master
Master
2 parents bd2d2ed + 480ec83 commit 5812122

6 files changed

Lines changed: 46 additions & 42 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/downframe.html

Whitespace-only changes.

static/start.js

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

3-
let upbutton = document.getElementById("upb")
3+
//let upbutton = document.getElementById("upb")
4+
45
let dbutton = document.getElementById("downb")
5-
let frame = document.getElementById("frame")
6+
67
console.log("Script included.")
7-
upbutton.onclick = function(){
8-
if (frame.src != "uploadframe.html") frame.src = "uploadframe.html";
9-
window.document.title = "Upload something"
10-
}
8+
//upbutton.onclick = function(){
9+
10+
//}
1111
dbutton.onclick =function(){
12-
if (frame.src != "downframe.html") frame.src = "downframe.html"
13-
window.document.title = "Download something"
12+
13+
}
14+
1415
}
15-
}

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

static/uploadframe.html

Lines changed: 0 additions & 13 deletions
This file was deleted.

templates/start.html

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
11
<html>
22
<head>
3-
<title>Upload something</title>
3+
<title>Quickload</title>
44
<script>
5-
let upcode = "\\code"
5+
let upcode = "\\code"
66
let downcode = "\\code2"
77
let size = window.innerHeight;
88
</script>
99
<script src = start.js></script>
1010
<link rel="stylesheet" type="text/css" href="style.css" />
1111
</head>
1212
<style>
13-
button {
14-
height: 100%;
13+
.dum button {
14+
height: 10%;
1515
background-color: black;
1616
color: white;
17-
border-radius: 10%
17+
border-radius: 10%;
18+
vertical-align: middle;
19+
text-align: center
1820
};
19-
.framediv{
20-
vertical-align: middle;
21-
}
21+
2222

2323
</style>
2424
<body>
2525

2626
<img width = 5% class = "eviloctopus" src = "favicon.ico">
27-
<nav>
28-
<button class="switch" id="downb">Download</button>
29-
<button class="switch" id="upb">Upload</button>
30-
</nav>
27+
3128
<div height = 5%></div>
32-
<div id = "framediv">
33-
<iframe id = "frame" height= 80% width= 50% src="uploadframe.html"> </iframe>
34-
</div>
29+
30+
<input type="text" name="Code" size="15"> <button id = "downb">Download file</button></br>
31+
<form action="/upload">
32+
<input type="file" id="form" name="filename">
33+
<input class = "dum" type="submit">
34+
</form>
35+
3536
<script src = "start.js"></script>
3637

3738

0 commit comments

Comments
 (0)