From e2425cd6c9f3dcf4d155c37fd92e2263609dd866 Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Wed, 29 Jul 2020 12:35:47 -0700 Subject: [PATCH] added downloadConfirm string to noStream page --- app/ui/noStreams.js | 12 +++++++++--- server/routes/done.js | 8 +++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/ui/noStreams.js b/app/ui/noStreams.js index d31ad777..52cb7d05 100644 --- a/app/ui/noStreams.js +++ b/app/ui/noStreams.js @@ -19,9 +19,9 @@ module.exports = function(state, emit) {
- + + +

${ archive.name @@ -55,6 +55,11 @@ module.exports = function(state, emit) { value="${state.translate('copyLinkButton')}" title="${state.translate('copyLinkButton')}" type="submit" /> +

+ ${state.translate('downloadConfirmDescription')} +

`; @@ -64,6 +69,7 @@ module.exports = function(state, emit) { const choice = event.target.value; const button = event.currentTarget.nextElementSibling; let title = button.title; + console.error(choice, title); switch (choice) { case 'copy': title = state.translate('copyLinkButton'); diff --git a/server/routes/done.js b/server/routes/done.js index d33c9882..8c61a084 100644 --- a/server/routes/done.js +++ b/server/routes/done.js @@ -15,7 +15,13 @@ module.exports = async function(req, res) { agent: req.ua.browser.name || req.ua.ua.substring(0, 6) }); await storage.incrementField(id, 'dl'); - if (meta.dlToken >= meta.dlimit) { + if (meta.dl + 1 >= meta.dlimit) { + // Only dlimit number of tokens will be issued + // after which /download/token will return 403 + // however the protocol doesn't prevent one token + // from making all the downloads and assumes + // clients are well behaved. If this becomes + // a problem we can keep track of used tokens. await storage.kill(id); } res.sendStatus(200);