24
1
Fork 0

refactored storage, style tweaks

Co-authored-by: timvisee <tim@visee.me>
This commit is contained in:
Danny Coates 2020-07-25 11:22:57 -07:00 committed by timvisee
parent abc58518ea
commit e909a3bae8
No known key found for this signature in database
GPG Key ID: B8DB720BC383E172
6 changed files with 26 additions and 71 deletions

View File

@ -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;
};

View File

@ -30,6 +30,12 @@ function password(state) {
return html`
<div class="mb-2 px-1">
<input
id="autocomplete-decoy"
class="hidden"
type="password"
value="lol"
/>
<div class="checkbox inline-block mr-3">
<input
id="add-password"

View File

@ -33,7 +33,7 @@ class Header extends Component {
alt="${this.state.translate('title')}"
src="${assets.get('icon.svg')}"
/>
<svg class="w-48 md:w-64">
<svg viewBox="66 0 340 64" class="w-48 md:w-64">
<use xlink:href="${assets.get('wordmark.svg')}#logo" />
</svg>
</a>

View File

@ -9,13 +9,11 @@ module.exports = function(trigger) {
let submitting = false;
return html`
<send-signup-dialog
class="flex flex-col lg:flex-row justify-center my-16 md:my-0 px-8 md:px-24 w-full h-full"
class="flex flex-col justify-center my-16 md:my-0 px-8 md:px-24 w-full h-full"
>
<img src="${assets.get('master-logo.svg')}" class="h-16 mt-1 mb-4" />
<section
class="flex flex-col flex-shrink-0 self-center lg:mx-6 lg:max-w-xs"
>
<h1 class="text-3xl font-bold text-center lg:text-left">
<section class="flex flex-col flex-shrink-0 self-center">
<h1 class="text-3xl font-bold text-center">
${state.translate('accountBenefitTitle')}
</h1>
<ul
@ -33,14 +31,12 @@ module.exports = function(trigger) {
<li>${state.translate('accountBenefitSync')}</li>
</ul>
</section>
<section
class="flex flex-col flex-grow m-4 md:self-center md:w-128 lg:max-w-xs"
>
<section class="flex flex-col flex-grow m-4 md:self-center md:w-128">
<form onsubmit=${submitEmail} data-no-csrf>
<input
id="email-input"
type="email"
class="hidden lg:block border rounded-lg w-full px-2 py-1 h-12 mb-3 text-lg text-grey-70 leading-loose dark:bg-grey-80 dark:text-white"
class="hidden border rounded-lg w-full px-2 py-1 h-12 mb-3 text-lg text-grey-70 leading-loose dark:bg-grey-80 dark:text-white"
placeholder=${state.translate('emailPlaceholder')}
/>
<input

View File

@ -1,61 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="svg7"
sodipodi:docname="wordmark.svg"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)">
<metadata
id="metadata13">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs11" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1874"
inkscape:window-height="1016"
id="namedview9"
showgrid="false"
inkscape:zoom="3.337544"
inkscape:cx="82.487885"
inkscape:cy="47.814478"
inkscape:window-x="1966"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg7" />
<symbol
id="logo"
viewBox="66 0 340 64">
<path
d="m 105.17,33.27 c -1.04895,-0.638175 -2.18377,-1.123082 -3.37,-1.44 -1.25,-0.34 -2.46,-0.63 -3.63,-0.88 l -3.08,-0.7 C 94.22073,30.069182 93.37751,29.78027 92.58,29.39 91.90449,29.074134 91.31719,28.596738 90.87,28 c -0.43741,-0.644047 -0.65489,-1.412243 -0.62,-2.19 -0.0406,-1.405196 0.53693,-2.75754 1.58,-3.7 1.06,-1 2.73,-1.44 5,-1.44 1.76437,-0.07198 3.51559,0.332147 5.07,1.17 1.35935,0.80694 2.51833,1.911219 3.39,3.23 l 2.79,-2.18 c -1.26761,-1.5933 -2.84201,-2.916072 -4.63,-3.89 -2.04373,-1.017745 -4.30804,-1.512526 -6.59,-1.44 -1.40785,-0.02195 -2.80876,0.201387 -4.14,0.66 -1.16063,0.399115 -2.24085,1.001871 -3.19,1.78 -0.8713,0.712445 -1.5718,1.611145 -2.05,2.63 -0.4819,1.011666 -0.72807,2.119452 -0.72,3.24 -0.05,1.231532 0.24064,2.452997 0.84,3.53 0.55827,0.895068 1.31002,1.653654 2.2,2.22 0.94422,0.612326 1.97599,1.077636 3.06,1.38 1.13,0.32 2.29,0.6 3.47,0.84 l 3.26,0.74 c 0.96945,0.22193 1.90929,0.557589 2.8,1 0.77256,0.367753 1.45522,0.900225 2,1.56 0.51019,0.701297 0.77072,1.553301 0.74,2.42 0.0438,1.566414 -0.62122,3.069031 -1.81,4.09 -1.52512,1.147855 -3.41702,1.699065 -5.32,1.55 -4.03416,0.15747 -7.83041,-1.90763 -9.89,-5.38 l -3,2.34 c 1.3876,1.880136 3.1735,3.430427 5.23,4.54 2.3855,1.197767 5.03194,1.782045 7.7,1.7 1.49114,0.02151 2.97422,-0.222285 4.38,-0.72 1.21788,-0.44929 2.33816,-1.128248 3.3,-2 0.88604,-0.797749 1.60053,-1.767412 2.1,-2.85 0.48895,-1.06318 0.74142,-2.219779 0.74,-3.39 0.0397,-1.336553 -0.30755,-2.656119 -1,-3.8 -0.62101,-0.95962 -1.44763,-1.769154 -2.42,-2.37 z m 27.51,-4.72 c -1.0207,-1.016684 -2.23916,-1.813109 -3.58,-2.34 -1.42831,-0.567565 -2.95311,-0.852828 -4.49,-0.84 -1.58532,-0.01887 -3.15769,0.287432 -4.62,0.9 -1.3691,0.572827 -2.61257,1.408599 -3.66,2.46 -2.1451,2.217513 -3.33989,5.184759 -3.33,8.27 -0.0138,1.54162 0.26439,3.071916 0.82,4.51 0.5255,1.363982 1.32922,2.603618 2.36,3.64 1.06096,1.043663 2.31862,1.866239 3.7,2.42 1.53222,0.610739 3.17082,0.909903 4.82,0.88 2.13421,0.08534 4.25095,-0.416179 6.12,-1.45 1.69947,-1.049265 3.13073,-2.480527 4.18,-4.18 l -2.88,-1.69 c -1.41279,2.768876 -4.32635,4.443291 -7.43,4.27 -1.09666,0.02103 -2.18793,-0.158593 -3.22,-0.53 -0.93382,-0.341463 -1.79784,-0.849713 -2.55,-1.5 -0.72694,-0.645531 -1.33013,-1.418157 -1.78,-2.28 -0.47812,-0.903522 -0.77374,-1.892313 -0.87,-2.91 h 19.59 v -1.52 c 0.0166,-1.555338 -0.27566,-3.098506 -0.86,-4.54 -0.54053,-1.333176 -1.33916,-2.54641 -2.35,-3.57 z m -16.28,6.67 c 0.18109,-0.958759 0.51895,-1.881119 1,-2.73 0.47186,-0.820757 1.07675,-1.557447 1.79,-2.18 0.72195,-0.61779 1.5482,-1.102022 2.44,-1.43 0.95944,-0.356614 1.97651,-0.532906 3,-0.52 4.04346,-0.224227 7.5255,2.82256 7.84,6.86 z M 158.82,28 c -0.83726,-0.883328 -1.8626,-1.566885 -3,-2 -1.25447,-0.462049 -2.58329,-0.689169 -3.92,-0.67 -1.60057,-0.03131 -3.18086,0.362037 -4.58,1.14 -1.28188,0.720594 -2.36173,1.752297 -3.14,3 v -3.65 h -3.29 V 48 h 3.37 V 35.67 c -0.0102,-1.001391 0.16968,-1.995625 0.53,-2.93 0.3373,-0.856524 0.84023,-1.638106 1.48,-2.3 0.62704,-0.649648 1.38331,-1.160636 2.22,-1.5 0.87089,-0.363534 1.8063,-0.547214 2.75,-0.54 1.87023,-0.128793 3.70135,0.578019 5,1.93 1.22147,1.441484 1.85048,3.292756 1.76,5.18 V 48 h 3.41 V 35.34 c 0.0211,-1.424123 -0.20214,-2.84132 -0.66,-4.19 -0.40985,-1.176324 -1.06809,-2.250653 -1.93,-3.15 z m 27,-12.42 v 14.1 c -0.43264,-0.685249 -0.96517,-1.302051 -1.58,-1.83 -0.60967,-0.53196 -1.28117,-0.98858 -2,-1.36 -0.73088,-0.369676 -1.5029,-0.651634 -2.3,-0.84 -0.78611,-0.187908 -1.59174,-0.281898 -2.4,-0.28 -1.50724,-0.0078 -3.00162,0.277523 -4.4,0.84 -1.34071,0.551089 -2.56038,1.35967 -3.59,2.38 -1.03697,1.047216 -1.85907,2.287165 -2.42,3.65 -1.17023,2.996466 -1.17023,6.323534 0,9.32 0.55964,1.361695 1.37424,2.603955 2.4,3.66 1.02081,1.031107 2.2428,1.841226 3.59,2.38 1.40561,0.561607 2.90636,0.846817 4.42,0.84 0.80981,-0.0026 1.6161,-0.106786 2.4,-0.31 0.79636,-0.199929 1.56783,-0.488392 2.3,-0.86 0.72123,-0.371416 1.39312,-0.831661 2,-1.37 0.61025,-0.540083 1.14205,-1.162767 1.58,-1.85 v 4 h 3.33 V 15.59 Z m -0.37,24.58 c -1.76276,4.229524 -6.6195,6.23041 -10.85,4.47 v 0 c -0.97862,-0.401365 -1.86378,-1.000551 -2.6,-1.76 -0.7522,-0.76312 -1.34086,-1.671634 -1.73,-2.67 -0.41974,-1.066531 -0.63023,-2.203893 -0.62,-3.35 -0.0103,-1.129892 0.20027,-2.250911 0.62,-3.3 0.39328,-0.993283 0.98151,-1.897738 1.73,-2.66 0.74207,-0.76001 1.62521,-1.368023 2.6,-1.79 2.07874,-0.890012 4.43126,-0.890012 6.51,0 0.98149,0.434716 1.87338,1.048526 2.63,1.81 0.74927,0.763509 1.33458,1.672102 1.72,2.67 0.41464,1.036611 0.62516,2.14355 0.62,3.26 -1.3e-4,1.141508 -0.22084,2.272237 -0.65,3.33 z"
id="path2"
inkscape:connector-curvature="0"
style="fill:currentColor"
sodipodi:nodetypes="cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" />
</symbol>
<use
xlink:href="#logo"
id="use5" />
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<symbol id="logo">
<path d="m 105.17,33.27 c -1.04895,-0.638175 -2.18377,-1.123082 -3.37,-1.44 -1.25,-0.34 -2.46,-0.63 -3.63,-0.88 l -3.08,-0.7 C 94.22073,30.069182 93.37751,29.78027 92.58,29.39 91.90449,29.074134 91.31719,28.596738 90.87,28 c -0.43741,-0.644047 -0.65489,-1.412243 -0.62,-2.19 -0.0406,-1.405196 0.53693,-2.75754 1.58,-3.7 1.06,-1 2.73,-1.44 5,-1.44 1.76437,-0.07198 3.51559,0.332147 5.07,1.17 1.35935,0.80694 2.51833,1.911219 3.39,3.23 l 2.79,-2.18 c -1.26761,-1.5933 -2.84201,-2.916072 -4.63,-3.89 -2.04373,-1.017745 -4.30804,-1.512526 -6.59,-1.44 -1.40785,-0.02195 -2.80876,0.201387 -4.14,0.66 -1.16063,0.399115 -2.24085,1.001871 -3.19,1.78 -0.8713,0.712445 -1.5718,1.611145 -2.05,2.63 -0.4819,1.011666 -0.72807,2.119452 -0.72,3.24 -0.05,1.231532 0.24064,2.452997 0.84,3.53 0.55827,0.895068 1.31002,1.653654 2.2,2.22 0.94422,0.612326 1.97599,1.077636 3.06,1.38 1.13,0.32 2.29,0.6 3.47,0.84 l 3.26,0.74 c 0.96945,0.22193 1.90929,0.557589 2.8,1 0.77256,0.367753 1.45522,0.900225 2,1.56 0.51019,0.701297 0.77072,1.553301 0.74,2.42 0.0438,1.566414 -0.62122,3.069031 -1.81,4.09 -1.52512,1.147855 -3.41702,1.699065 -5.32,1.55 -4.03416,0.15747 -7.83041,-1.90763 -9.89,-5.38 l -3,2.34 c 1.3876,1.880136 3.1735,3.430427 5.23,4.54 2.3855,1.197767 5.03194,1.782045 7.7,1.7 1.49114,0.02151 2.97422,-0.222285 4.38,-0.72 1.21788,-0.44929 2.33816,-1.128248 3.3,-2 0.88604,-0.797749 1.60053,-1.767412 2.1,-2.85 0.48895,-1.06318 0.74142,-2.219779 0.74,-3.39 0.0397,-1.336553 -0.30755,-2.656119 -1,-3.8 -0.62101,-0.95962 -1.44763,-1.769154 -2.42,-2.37 z m 27.51,-4.72 c -1.0207,-1.016684 -2.23916,-1.813109 -3.58,-2.34 -1.42831,-0.567565 -2.95311,-0.852828 -4.49,-0.84 -1.58532,-0.01887 -3.15769,0.287432 -4.62,0.9 -1.3691,0.572827 -2.61257,1.408599 -3.66,2.46 -2.1451,2.217513 -3.33989,5.184759 -3.33,8.27 -0.0138,1.54162 0.26439,3.071916 0.82,4.51 0.5255,1.363982 1.32922,2.603618 2.36,3.64 1.06096,1.043663 2.31862,1.866239 3.7,2.42 1.53222,0.610739 3.17082,0.909903 4.82,0.88 2.13421,0.08534 4.25095,-0.416179 6.12,-1.45 1.69947,-1.049265 3.13073,-2.480527 4.18,-4.18 l -2.88,-1.69 c -1.41279,2.768876 -4.32635,4.443291 -7.43,4.27 -1.09666,0.02103 -2.18793,-0.158593 -3.22,-0.53 -0.93382,-0.341463 -1.79784,-0.849713 -2.55,-1.5 -0.72694,-0.645531 -1.33013,-1.418157 -1.78,-2.28 -0.47812,-0.903522 -0.77374,-1.892313 -0.87,-2.91 h 19.59 v -1.52 c 0.0166,-1.555338 -0.27566,-3.098506 -0.86,-4.54 -0.54053,-1.333176 -1.33916,-2.54641 -2.35,-3.57 z m -16.28,6.67 c 0.18109,-0.958759 0.51895,-1.881119 1,-2.73 0.47186,-0.820757 1.07675,-1.557447 1.79,-2.18 0.72195,-0.61779 1.5482,-1.102022 2.44,-1.43 0.95944,-0.356614 1.97651,-0.532906 3,-0.52 4.04346,-0.224227 7.5255,2.82256 7.84,6.86 z M 158.82,28 c -0.83726,-0.883328 -1.8626,-1.566885 -3,-2 -1.25447,-0.462049 -2.58329,-0.689169 -3.92,-0.67 -1.60057,-0.03131 -3.18086,0.362037 -4.58,1.14 -1.28188,0.720594 -2.36173,1.752297 -3.14,3 v -3.65 h -3.29 V 48 h 3.37 V 35.67 c -0.0102,-1.001391 0.16968,-1.995625 0.53,-2.93 0.3373,-0.856524 0.84023,-1.638106 1.48,-2.3 0.62704,-0.649648 1.38331,-1.160636 2.22,-1.5 0.87089,-0.363534 1.8063,-0.547214 2.75,-0.54 1.87023,-0.128793 3.70135,0.578019 5,1.93 1.22147,1.441484 1.85048,3.292756 1.76,5.18 V 48 h 3.41 V 35.34 c 0.0211,-1.424123 -0.20214,-2.84132 -0.66,-4.19 -0.40985,-1.176324 -1.06809,-2.250653 -1.93,-3.15 z m 27,-12.42 v 14.1 c -0.43264,-0.685249 -0.96517,-1.302051 -1.58,-1.83 -0.60967,-0.53196 -1.28117,-0.98858 -2,-1.36 -0.73088,-0.369676 -1.5029,-0.651634 -2.3,-0.84 -0.78611,-0.187908 -1.59174,-0.281898 -2.4,-0.28 -1.50724,-0.0078 -3.00162,0.277523 -4.4,0.84 -1.34071,0.551089 -2.56038,1.35967 -3.59,2.38 -1.03697,1.047216 -1.85907,2.287165 -2.42,3.65 -1.17023,2.996466 -1.17023,6.323534 0,9.32 0.55964,1.361695 1.37424,2.603955 2.4,3.66 1.02081,1.031107 2.2428,1.841226 3.59,2.38 1.40561,0.561607 2.90636,0.846817 4.42,0.84 0.80981,-0.0026 1.6161,-0.106786 2.4,-0.31 0.79636,-0.199929 1.56783,-0.488392 2.3,-0.86 0.72123,-0.371416 1.39312,-0.831661 2,-1.37 0.61025,-0.540083 1.14205,-1.162767 1.58,-1.85 v 4 h 3.33 V 15.59 Z m -0.37,24.58 c -1.76276,4.229524 -6.6195,6.23041 -10.85,4.47 v 0 c -0.97862,-0.401365 -1.86378,-1.000551 -2.6,-1.76 -0.7522,-0.76312 -1.34086,-1.671634 -1.73,-2.67 -0.41974,-1.066531 -0.63023,-2.203893 -0.62,-3.35 -0.0103,-1.129892 0.20027,-2.250911 0.62,-3.3 0.39328,-0.993283 0.98151,-1.897738 1.73,-2.66 0.74207,-0.76001 1.62521,-1.368023 2.6,-1.79 2.07874,-0.890012 4.43126,-0.890012 6.51,0 0.98149,0.434716 1.87338,1.048526 2.63,1.81 0.74927,0.763509 1.33458,1.672102 1.72,2.67 0.41464,1.036611 0.62516,2.14355 0.62,3.26 -1.3e-4,1.141508 -0.22084,2.272237 -0.65,3.33 z" fill="currentColor"/>
</symbol>
<use xlink:href="#logo"/>
</svg>

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -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;