-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Added a UI for the uploader end, made stylistic changes, implemented deleting #28
Conversation
…to double quotes, added progress indicator
…d and displayed on DOM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, just a couple nits before we merge 👍
|
||
app.get('/download/:id', function(req, res) { | ||
res.sendFile(path.join(__dirname + '/public/download.html')); | ||
app.get("/download/:id", function(req, res) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can either do #29 now or in a follow up PR.
app.js
Outdated
|
||
client.hset(id, "filename", filename); | ||
client.hset(id, "expiration", 0); | ||
client.hset(id, "delete", uuid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using hmset
(m for multi) will set all these values in one command to redis
app.js
Outdated
let id = req.params.id; | ||
client.hset(id, "filename", filename, redis.print); | ||
client.hset(id, "expiration", 0, redis.print); | ||
let uuid = Math.floor(Math.random() * 10000000).toString() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use crypto.randomBytes(4).toString('hex')
here
app.js
Outdated
client.hset(id, "delete", uuid); | ||
|
||
// delete the file off the server in 24 hours | ||
setTimeout(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not ideal to have a bunch of timeout callbacks hanging around like this. We'll need to find another way to do this before launch. Maybe we can rely on expiring them in S3, otherwise a separate process from the server to do the cleanup would be ok.
return iv; | ||
} | ||
|
||
function returnBindedLI(a_element, name, link, li) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ui code here is fine for now, but eventually we'll want to refactor both upload and download to return objects that emit their own events so we can decouple them from the ui.
nit: I noticed all the changes to double quotes -- I assume this is because of the proposed eslint rule |
@abhinadduri let's add eslint asap after this |
No description provided.