From e909a3bae8ea0085110a4d94a7096aba6b90d8a9 Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Sat, 25 Jul 2020 11:22:57 -0700 Subject: [PATCH] refactored storage, style tweaks Co-authored-by: timvisee --- app/routes.js | 5 ++- app/ui/archiveTile.js | 6 ++++ app/ui/header.js | 2 +- app/ui/signupDialog.js | 14 +++------ assets/wordmark.svg | 65 +++------------------------------------ server/routes/download.js | 5 +++ 6 files changed, 26 insertions(+), 71 deletions(-) diff --git a/app/routes.js b/app/routes.js index 1ba8d412..175ac0c2 100644 --- a/app/routes.js +++ b/app/routes.js @@ -13,7 +13,10 @@ module.exports = function(app = choo({ hash: true })) { app.route('/oauth', function(state, emit) { emit('authenticate', state.query.code, state.query.state); }); - app.route('/login', body(require('./ui/home'))); + app.route('/login', function(state, emit) { + emit('replaceState', '/'); + setTimeout(() => emit('render')); + }); app.route('*', body(require('./ui/notFound'))); return app; }; diff --git a/app/ui/archiveTile.js b/app/ui/archiveTile.js index f643553d..50c1e5bc 100644 --- a/app/ui/archiveTile.js +++ b/app/ui/archiveTile.js @@ -30,6 +30,12 @@ function password(state) { return html`
+
- + diff --git a/app/ui/signupDialog.js b/app/ui/signupDialog.js index 970150a6..01be324f 100644 --- a/app/ui/signupDialog.js +++ b/app/ui/signupDialog.js @@ -9,13 +9,11 @@ module.exports = function(trigger) { let submitting = false; return html` -
-

+
+

${state.translate('accountBenefitTitle')}

    ${state.translate('accountBenefitSync')}
-
+
- - - - - image/svg+xml - - - - - - - - + + + diff --git a/server/routes/download.js b/server/routes/download.js index a17c52b7..7fe0035b 100644 --- a/server/routes/download.js +++ b/server/routes/download.js @@ -7,6 +7,7 @@ module.exports = async function(req, res) { const id = req.params.id; try { const meta = req.meta; + const contentLength = await storage.length(id); const fileStream = await storage.get(id); let cancelled = false; @@ -15,6 +16,10 @@ module.exports = async function(req, res) { fileStream.destroy(); }); + res.writeHead(200, { + 'Content-Type': 'application/octet-stream', + 'Content-Length': contentLength + }); fileStream.pipe(res).on('finish', async () => { if (cancelled) { return;