Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions run.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
Empty file removed static/downframe.html
Empty file.
18 changes: 9 additions & 9 deletions static/start.js
Original file line number Diff line number Diff line change
@@ -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"

}

}
}
6 changes: 3 additions & 3 deletions static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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%;

Expand Down
13 changes: 0 additions & 13 deletions static/uploadframe.html

This file was deleted.

31 changes: 16 additions & 15 deletions templates/start.html
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
<html>
<head>
<title>Upload something</title>
<title>Quickload</title>
<script>
let upcode = "\\code"
let upcode = "\\code"
let downcode = "\\code2"
let size = window.innerHeight;
</script>
<script src = start.js></script>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<style>
button {
height: 100%;
.dum button {
height: 10%;
background-color: black;
color: white;
border-radius: 10%
border-radius: 10%;
vertical-align: middle;
text-align: center
};
.framediv{
vertical-align: middle;
}


</style>
<body>

<img width = 5% class = "eviloctopus" src = "favicon.ico">
<nav>
<button class="switch" id="downb">Download</button>
<button class="switch" id="upb">Upload</button>
</nav>

<div height = 5%></div>
<div id = "framediv">
<iframe id = "frame" height= 80% width= 50% src="uploadframe.html"> </iframe>
</div>

<input type="text" name="Code" size="15"> <button id = "downb">Download file</button></br>
<form action="/upload">
<input type="file" id="form" name="filename">
<input class = "dum" type="submit">
</form>

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


Expand Down