Skip to content

Commit 3d22130

Browse files
authored
Merge pull request #14 from J-P-S-O/master
.
2 parents 55a4e8b + 6fcaab8 commit 3d22130

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
data
22
node_modules
3+
static/*.upload.*

run.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ const requestListener = function (req, res) {
8989
intcode = "./data/keys/" + intcode
9090
fs.writeFileSync(intcode,body)
9191

92-
fs.readFile(intcode, 'utf8', function(err, data){
92+
93+
/*fs.readFile(intcode, 'utf8', function(err, data){
94+
9395
if (err){ throw err; }
9496
var lines = data.split('\n')
9597
var type = lines[2]
@@ -107,10 +109,10 @@ const requestListener = function (req, res) {
107109
lines = lines.join('\n')
108110
//console.log(lines)
109111
/* fs.writeFileSync(intcode, lines); */
110-
fs.writeFileSync(intcode+".type",type)
112+
//fs.writeFileSync(intcode+".type",type)
111113
console.log("File uploaded to "+"\x1b[32m"+intcode.replace("./data/keys/","")+"\x1b[37m" +" Type: " + type)
112114

113-
});
115+
/*})*/;
114116

115117

116118
})
@@ -126,7 +128,7 @@ console.log("File uploaded to "+"\x1b[32m"+intcode.replace("./data/keys/","")+"\
126128
res.end(data);
127129
});
128130

129-
} else if(String(req.url).startsWith("/download/")){
131+
} else if(String(req.url).startsWith("/download/") && false){
130132
//log(String(req.url).replace("/download/",""))
131133
let pathh = (String(req.url).replace("/download/",""))
132134
pathh = "./data/keys/" + pathh + ".type"

static/start.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
window.onload = function(){
22
let codeplace = document.getElementById("code")
33

4-
//let upbutton = document.getElementById("upb")
4+
let upbutton = document.getElementById("upb")
55

66
let dbutton = document.getElementById("downb")
77

88
console.log("Script included.")
9-
//upbutton.onclick = function(){
9+
upbutton.onclick = function(){
1010

11-
//}
11+
}
1212
dbutton.onclick =function(){
1313
window.location = "/download/"+codeplace.value
1414
}
1515

16+
1617
}

templates/start.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@
2828
<div height = 5%></div>
2929

3030
<input type="text" name="Code" id = "code" size="15"> <button id = "downb">Download file</button></br>
31-
<form action="/upload" method="post" enctype="multipart/form-data">
32-
<label for="upload">File:</label>
33-
<input type="file" id="upload"><br/>
34-
<input type="submit" name="submit" value="Upload">
35-
</form>
31+
<button id = "upb">Upload file</button>
3632
<script src = "start.js"></script>
3733

3834

0 commit comments

Comments
 (0)