From 059613490db9be904791686c49851ec1cc095774 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 26 Jul 2022 21:06:01 -0700 Subject: register endpoint --- package.json | 7 +- pnpm-lock.yaml | 430 ++++++++++------------------------ src/components/RegisterOrLogin.svelte | 17 +- src/lib/socket.js | 29 ++- src/lib/store.js | 1 - src/lib/utils.js | 8 +- src/routes/invoice.svelte | 2 + src/routes/login.js | 12 +- src/routes/register.js | 6 + src/routes/register.svelte | 1 - 10 files changed, 161 insertions(+), 352 deletions(-) create mode 100644 src/routes/register.js diff --git a/package.json b/package.json index 2801ff01..6d3ad58a 100644 --- a/package.json +++ b/package.json @@ -14,14 +14,13 @@ "@sveltejs/adapter-auto": "next", "@sveltejs/kit": "next", "autoprefixer": "^10.4.7", - "got": "^12.2.0", "postcss": "^8.4.14", - "prettier": "^2.6.2", + "prettier": "^2.7.1", "prettier-plugin-svelte": "^2.7.0", - "svelte": "^3.44.0", + "svelte": "^3.49.0", "svelte-preprocess": "^4.10.7", "tailwindcss": "^3.1.6", - "vite": "^3.0.0" + "vite": "^3.0.3" }, "type": "module" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d92f3395..72a53df0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,27 +4,25 @@ specifiers: '@sveltejs/adapter-auto': next '@sveltejs/kit': next autoprefixer: ^10.4.7 - got: ^12.2.0 postcss: ^8.4.14 - prettier: ^2.6.2 + prettier: ^2.7.1 prettier-plugin-svelte: ^2.7.0 - svelte: ^3.44.0 + svelte: ^3.49.0 svelte-preprocess: ^4.10.7 tailwindcss: ^3.1.6 - vite: ^3.0.0 + vite: ^3.0.3 devDependencies: - '@sveltejs/adapter-auto': 1.0.0-next.63 - '@sveltejs/kit': 1.0.0-next.394_svelte@3.49.0+vite@3.0.2 + '@sveltejs/adapter-auto': 1.0.0-next.64 + '@sveltejs/kit': 1.0.0-next.396_svelte@3.49.0+vite@3.0.3 autoprefixer: 10.4.7_postcss@8.4.14 - got: 12.2.0 postcss: 8.4.14 prettier: 2.7.1 prettier-plugin-svelte: 2.7.0_o3ioganyptcsrh6x4hnxvjkpqi svelte: 3.49.0 svelte-preprocess: 4.10.7_nxvsp6sjiltnatqa6jdm4mr6zu tailwindcss: 3.1.6 - vite: 3.0.2 + vite: 3.0.3 packages: @@ -83,68 +81,63 @@ packages: picomatch: 2.3.1 dev: true - /@sindresorhus/is/5.3.0: - resolution: {integrity: sha512-CX6t4SYQ37lzxicAqsBtxA3OseeoVrh9cSJ5PFYam0GksYlupRfy1A+Q4aYD3zvcfECLc0zO2u+ZnR2UYKvCrw==} - engines: {node: '>=14.16'} - dev: true - - /@sveltejs/adapter-auto/1.0.0-next.63: - resolution: {integrity: sha512-9KguXwROEJMyyoKrsizAilVSmtfWxEDn2Hbxk44SP8Kj5cgN7tFCxzbL2kmmqyV1CO1tOh5iNC2oWbyTfikXmw==} + /@sveltejs/adapter-auto/1.0.0-next.64: + resolution: {integrity: sha512-Q8DwcS6wl1GovzS9JJzaD/WL/Lfk1ur4nAF1HtmsUvZDpsPBVDqnK2AhYU4G3oFNiuHstrjAogMy5th8ptSFGw==} dependencies: - '@sveltejs/adapter-cloudflare': 1.0.0-next.30 - '@sveltejs/adapter-netlify': 1.0.0-next.70 - '@sveltejs/adapter-vercel': 1.0.0-next.65 + '@sveltejs/adapter-cloudflare': 1.0.0-next.31 + '@sveltejs/adapter-netlify': 1.0.0-next.71 + '@sveltejs/adapter-vercel': 1.0.0-next.66 transitivePeerDependencies: - encoding - supports-color dev: true - /@sveltejs/adapter-cloudflare/1.0.0-next.30: - resolution: {integrity: sha512-jIclgb58n3Uoo8TTudXSa7wmLP7Rn/ESLQS+zOUe0xsti5DG/eDhELTnSvkoSa2lJY21ym5rej/GSERRyeuBVw==} + /@sveltejs/adapter-cloudflare/1.0.0-next.31: + resolution: {integrity: sha512-HhEFZP72GJ8AZGgFECKIiayDcLaAWi65pI0AnBfiNhCifYSlH/mPNWNVD4AWRDnXnH6XU+FLwhGDnIDwytTyYg==} dependencies: '@cloudflare/workers-types': 3.14.1 - esbuild: 0.14.49 + esbuild: 0.14.50 worktop: 0.8.0-next.14 dev: true - /@sveltejs/adapter-netlify/1.0.0-next.70: - resolution: {integrity: sha512-lIXY6KIgIFBz4+mdvilx9Ny8oFV7T2iVTKLirJayoI/SqPWGAcxklvWvjGfS4QT8rS9pWKDaKRUQM4M/gl8LlA==} + /@sveltejs/adapter-netlify/1.0.0-next.71: + resolution: {integrity: sha512-la1CGtWO1xul1L3zEoFAoc4EX2uxZjrZcOMS3tkKB8drxhbQsNbnTE6fmSSMFiZXhxaikczrBgQwqIaDkLTmZg==} dependencies: '@iarna/toml': 2.2.5 - esbuild: 0.14.49 - set-cookie-parser: 2.5.0 + esbuild: 0.14.50 + set-cookie-parser: 2.5.1 tiny-glob: 0.2.9 dev: true - /@sveltejs/adapter-vercel/1.0.0-next.65: - resolution: {integrity: sha512-RV3HL7Ic7pGgIoBSHPwN1pBX96Km1X683oHImPHAKX9h/WOvJZ3bY5+IWNRcR8tx9rPB5gfMRg+msvPSBr3RVw==} + /@sveltejs/adapter-vercel/1.0.0-next.66: + resolution: {integrity: sha512-s3Hcxu9nCG/rR3C3cFbdQGjTa5W4K2kRcc6S5Xefx7itbrw+4v3KpO8ZPB6qM55XDwVxuG7260NMHVI6MUGmSA==} dependencies: - '@vercel/nft': 0.20.1 - esbuild: 0.14.49 + '@vercel/nft': 0.21.0 + esbuild: 0.14.50 transitivePeerDependencies: - encoding - supports-color dev: true - /@sveltejs/kit/1.0.0-next.394_svelte@3.49.0+vite@3.0.2: - resolution: {integrity: sha512-YfRNSKdbvihHFvmQodaMlChcyf9dfU36FwK8WYQF5jqEmiRajLBb/ooU6RqPA0Z6j5okJHDSYBwxW8TP+nc+gg==} + /@sveltejs/kit/1.0.0-next.396_svelte@3.49.0+vite@3.0.3: + resolution: {integrity: sha512-bKFpuzp9QxPkOIOEIeNeedvxEMORNqBPxUmoJXDP/Se7MrSfcxYiamjBcKrG+bgGNWmV39nD3EvUox+CXno/Ig==} engines: {node: '>=16.9'} hasBin: true peerDependencies: svelte: ^3.44.0 vite: ^3.0.0 dependencies: - '@sveltejs/vite-plugin-svelte': 1.0.1_svelte@3.49.0+vite@3.0.2 + '@sveltejs/vite-plugin-svelte': 1.0.1_svelte@3.49.0+vite@3.0.3 chokidar: 3.5.3 sade: 1.8.1 svelte: 3.49.0 - vite: 3.0.2 + vite: 3.0.3 transitivePeerDependencies: - diff-match-patch - supports-color dev: true - /@sveltejs/vite-plugin-svelte/1.0.1_svelte@3.49.0+vite@3.0.2: + /@sveltejs/vite-plugin-svelte/1.0.1_svelte@3.49.0+vite@3.0.3: resolution: {integrity: sha512-PorCgUounn0VXcpeJu+hOweZODKmGuLHsLomwqSj+p26IwjjGffmYQfVHtiTWq+NqaUuuHWWG7vPge6UFw4Aeg==} engines: {node: ^14.18.0 || >= 16} peerDependencies: @@ -162,67 +155,32 @@ packages: magic-string: 0.26.2 svelte: 3.49.0 svelte-hmr: 0.14.12_svelte@3.49.0 - vite: 3.0.2 + vite: 3.0.3 transitivePeerDependencies: - supports-color dev: true - /@szmarczak/http-timer/5.0.1: - resolution: {integrity: sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==} - engines: {node: '>=14.16'} - dependencies: - defer-to-connect: 2.0.1 - dev: true - - /@types/cacheable-request/6.0.2: - resolution: {integrity: sha512-B3xVo+dlKM6nnKTcmm5ZtY/OL8bOAOd2Olee9M1zft65ox50OzjEHW91sDiU9j6cvW8Ejg1/Qkf4xd2kugApUA==} - dependencies: - '@types/http-cache-semantics': 4.0.1 - '@types/keyv': 3.1.4 - '@types/node': 18.0.6 - '@types/responselike': 1.0.0 - dev: true - - /@types/http-cache-semantics/4.0.1: - resolution: {integrity: sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==} - dev: true - - /@types/json-buffer/3.0.0: - resolution: {integrity: sha512-3YP80IxxFJB4b5tYC2SUPwkg0XQLiu0nWvhRgEatgjf+29IcWO9X1k8xRv5DGssJ/lCrjYTjQPcobJr2yWIVuQ==} - dev: true - - /@types/keyv/3.1.4: - resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==} - dependencies: - '@types/node': 18.0.6 - dev: true - - /@types/node/18.0.6: - resolution: {integrity: sha512-/xUq6H2aQm261exT6iZTMifUySEt4GR5KX8eYyY+C4MSNPqSh9oNIP7tz2GLKTlFaiBbgZNxffoR3CVRG+cljw==} + /@types/node/18.6.1: + resolution: {integrity: sha512-z+2vB6yDt1fNwKOeGbckpmirO+VBDuQqecXkgeIqDlaOtmKn6hPR/viQ8cxCfqLU4fTlvM3+YjM367TukWdxpg==} dev: true /@types/pug/2.0.6: resolution: {integrity: sha512-SnHmG9wN1UVmagJOnyo/qkk0Z7gejYxOYYmaAwr5u2yFYfsupN3sg10kyzN8Hep/2zbHxCnsumxOoRIRMBwKCg==} dev: true - /@types/responselike/1.0.0: - resolution: {integrity: sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==} - dependencies: - '@types/node': 18.0.6 - dev: true - /@types/sass/1.43.1: resolution: {integrity: sha512-BPdoIt1lfJ6B7rw35ncdwBZrAssjcwzI5LByIrYs+tpXlj/CAkuVdRsgZDdP4lq5EjyWzwxZCqAoFyHKFwp32g==} dependencies: - '@types/node': 18.0.6 + '@types/node': 18.6.1 dev: true - /@vercel/nft/0.20.1: - resolution: {integrity: sha512-hSLcr64KHOkcNiTAlv154K4p4faEFBwYIi2eIgu1QCDhB1qyQYvFuEhtw3eaapNjA4/7x/2jcclfCAjILua/ag==} + /@vercel/nft/0.21.0: + resolution: {integrity: sha512-hFCAETfI5cG8l5iAiLhMC2bReC5K7SIybzrxGorv+eGspIbIFsVw7Vg85GovXm/LxA08pIDrAlrhR6GN36XB/Q==} hasBin: true dependencies: '@mapbox/node-pre-gyp': 1.0.9 - acorn: 8.7.1 + acorn: 8.8.0 + async-sema: 3.1.1 bindings: 1.5.0 estree-walker: 2.0.2 glob: 7.2.3 @@ -259,8 +217,8 @@ packages: hasBin: true dev: true - /acorn/8.7.1: - resolution: {integrity: sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==} + /acorn/8.8.0: + resolution: {integrity: sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==} engines: {node: '>=0.4.0'} hasBin: true dev: true @@ -303,6 +261,10 @@ packages: resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==} dev: true + /async-sema/3.1.1: + resolution: {integrity: sha512-tLRNUXati5MFePdAk8dw7Qt7DpxPB60ofAgn8WRhW6a2rcimZnYBP9oxHiv0OHy+Wz7kPMG+t4LGdt31+4EmGg==} + dev: true + /autoprefixer/10.4.7_postcss@8.4.14: resolution: {integrity: sha512-ypHju4Y2Oav95SipEcCcI5J7CGPuvz8oat7sUtYj3ClK44bldfvtvcxK6IEK++7rqB7YchDGzweZIBG+SD0ZAA==} engines: {node: ^10 || ^12 || >=14} @@ -311,7 +273,7 @@ packages: postcss: ^8.1.0 dependencies: browserslist: 4.21.2 - caniuse-lite: 1.0.30001367 + caniuse-lite: 1.0.30001370 fraction.js: 4.2.0 normalize-range: 0.1.2 picocolors: 1.0.0 @@ -353,8 +315,8 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001367 - electron-to-chromium: 1.4.195 + caniuse-lite: 1.0.30001370 + electron-to-chromium: 1.4.202 node-releases: 2.0.6 update-browserslist-db: 1.0.5_browserslist@4.21.2 dev: true @@ -363,31 +325,13 @@ packages: resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==} dev: true - /cacheable-lookup/6.0.4: - resolution: {integrity: sha512-mbcDEZCkv2CZF4G01kr8eBd/5agkt9oCqz75tJMSIsquvRZ2sL6Hi5zGVKi/0OSC9oO1GHfJ2AV0ZIOY9vye0A==} - engines: {node: '>=10.6.0'} - dev: true - - /cacheable-request/7.0.2: - resolution: {integrity: sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==} - engines: {node: '>=8'} - dependencies: - clone-response: 1.0.3 - get-stream: 5.2.0 - http-cache-semantics: 4.1.0 - keyv: 4.3.3 - lowercase-keys: 2.0.0 - normalize-url: 6.1.0 - responselike: 2.0.1 - dev: true - /camelcase-css/2.0.1: resolution: {integrity: sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==} engines: {node: '>= 6'} dev: true - /caniuse-lite/1.0.30001367: - resolution: {integrity: sha512-XDgbeOHfifWV3GEES2B8rtsrADx4Jf+juKX2SICJcaUhjYBO3bR96kvEIHa15VU6ohtOhBZuPGGYGbXMRn0NCw==} + /caniuse-lite/1.0.30001370: + resolution: {integrity: sha512-3PDmaP56wz/qz7G508xzjx8C+MC2qEm4SYhSEzC9IBROo+dGXFWRuaXkWti0A9tuI00g+toiriVqxtWMgl350g==} dev: true /chokidar/3.5.3: @@ -410,12 +354,6 @@ packages: engines: {node: '>=10'} dev: true - /clone-response/1.0.3: - resolution: {integrity: sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==} - dependencies: - mimic-response: 1.0.1 - dev: true - /color-name/1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} dev: true @@ -425,14 +363,6 @@ packages: hasBin: true dev: true - /compress-brotli/1.3.8: - resolution: {integrity: sha512-lVcQsjhxhIXsuupfy9fmZUFtAIdBmXA7EGY6GBdgZ++qkM9zG4YFT8iU7FoBxzryNDMOpD1HIFHUSX4D87oqhQ==} - engines: {node: '>= 12'} - dependencies: - '@types/json-buffer': 3.0.0 - json-buffer: 3.0.1 - dev: true - /concat-map/0.0.1: resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} dev: true @@ -459,23 +389,11 @@ packages: ms: 2.1.2 dev: true - /decompress-response/6.0.0: - resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==} - engines: {node: '>=10'} - dependencies: - mimic-response: 3.1.0 - dev: true - /deepmerge/4.2.2: resolution: {integrity: sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==} engines: {node: '>=0.10.0'} dev: true - /defer-to-connect/2.0.1: - resolution: {integrity: sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==} - engines: {node: '>=10'} - dev: true - /defined/1.0.0: resolution: {integrity: sha512-Y2caI5+ZwS5c3RiNDJ6u53VhQHv+hHKwhkI1iHvceKUHw9Df6EK2zRLfjejRgMuCuxK7PfSWIMwWecceVvThjQ==} dev: true @@ -512,26 +430,20 @@ packages: resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==} dev: true - /electron-to-chromium/1.4.195: - resolution: {integrity: sha512-vefjEh0sk871xNmR5whJf9TEngX+KTKS3hOHpjoMpauKkwlGwtMz1H8IaIjAT/GNnX0TbGwAdmVoXCAzXf+PPg==} + /electron-to-chromium/1.4.202: + resolution: {integrity: sha512-JYsK2ex9lmQD27kj19fhXYxzFJ/phLAkLKHv49A5UY6kMRV2xED3qMMLg/voW/+0AR6wMiI+VxlmK9NDtdxlPA==} dev: true /emoji-regex/8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} dev: true - /end-of-stream/1.4.4: - resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==} - dependencies: - once: 1.4.0 - dev: true - /es6-promise/3.3.1: resolution: {integrity: sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==} dev: true - /esbuild-android-64/0.14.49: - resolution: {integrity: sha512-vYsdOTD+yi+kquhBiFWl3tyxnj2qZJsl4tAqwhT90ktUdnyTizgle7TjNx6Ar1bN7wcwWqZ9QInfdk2WVagSww==} + /esbuild-android-64/0.14.50: + resolution: {integrity: sha512-H7iUEm7gUJHzidsBlFPGF6FTExazcgXL/46xxLo6i6bMtPim6ZmXyTccS8yOMpy6HAC6dPZ/JCQqrkkin69n6Q==} engines: {node: '>=12'} cpu: [x64] os: [android] @@ -539,8 +451,8 @@ packages: dev: true optional: true - /esbuild-android-arm64/0.14.49: - resolution: {integrity: sha512-g2HGr/hjOXCgSsvQZ1nK4nW/ei8JUx04Li74qub9qWrStlysaVmadRyTVuW32FGIpLQyc5sUjjZopj49eGGM2g==} + /esbuild-android-arm64/0.14.50: + resolution: {integrity: sha512-NFaoqEwa+OYfoYVpQWDMdKII7wZZkAjtJFo1WdnBeCYlYikvUhTnf2aPwPu5qEAw/ie1NYK0yn3cafwP+kP+OQ==} engines: {node: '>=12'} cpu: [arm64] os: [android] @@ -548,8 +460,8 @@ packages: dev: true optional: true - /esbuild-darwin-64/0.14.49: - resolution: {integrity: sha512-3rvqnBCtX9ywso5fCHixt2GBCUsogNp9DjGmvbBohh31Ces34BVzFltMSxJpacNki96+WIcX5s/vum+ckXiLYg==} + /esbuild-darwin-64/0.14.50: + resolution: {integrity: sha512-gDQsCvGnZiJv9cfdO48QqxkRV8oKAXgR2CGp7TdIpccwFdJMHf8hyIJhMW/05b/HJjET/26Us27Jx91BFfEVSA==} engines: {node: '>=12'} cpu: [x64] os: [darwin] @@ -557,8 +469,8 @@ packages: dev: true optional: true - /esbuild-darwin-arm64/0.14.49: - resolution: {integrity: sha512-XMaqDxO846srnGlUSJnwbijV29MTKUATmOLyQSfswbK/2X5Uv28M9tTLUJcKKxzoo9lnkYPsx2o8EJcTYwCs/A==} + /esbuild-darwin-arm64/0.14.50: + resolution: {integrity: sha512-36nNs5OjKIb/Q50Sgp8+rYW/PqirRiFN0NFc9hEvgPzNJxeJedktXwzfJSln4EcRFRh5Vz4IlqFRScp+aiBBzA==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] @@ -566,8 +478,8 @@ packages: dev: true optional: true - /esbuild-freebsd-64/0.14.49: - resolution: {integrity: sha512-NJ5Q6AjV879mOHFri+5lZLTp5XsO2hQ+KSJYLbfY9DgCu8s6/Zl2prWXVANYTeCDLlrIlNNYw8y34xqyLDKOmQ==} + /esbuild-freebsd-64/0.14.50: + resolution: {integrity: sha512-/1pHHCUem8e/R86/uR+4v5diI2CtBdiWKiqGuPa9b/0x3Nwdh5AOH7lj+8823C6uX1e0ufwkSLkS+aFZiBCWxA==} engines: {node: '>=12'} cpu: [x64] os: [freebsd] @@ -575,8 +487,8 @@ packages: dev: true optional: true - /esbuild-freebsd-arm64/0.14.49: - resolution: {integrity: sha512-lFLtgXnAc3eXYqj5koPlBZvEbBSOSUbWO3gyY/0+4lBdRqELyz4bAuamHvmvHW5swJYL7kngzIZw6kdu25KGOA==} + /esbuild-freebsd-arm64/0.14.50: + resolution: {integrity: sha512-iKwUVMQztnPZe5pUYHdMkRc9aSpvoV1mkuHlCoPtxZA3V+Kg/ptpzkcSY+fKd0kuom+l6Rc93k0UPVkP7xoqrw==} engines: {node: '>=12'} cpu: [arm64] os: [freebsd] @@ -584,8 +496,8 @@ packages: dev: true optional: true - /esbuild-linux-32/0.14.49: - resolution: {integrity: sha512-zTTH4gr2Kb8u4QcOpTDVn7Z8q7QEIvFl/+vHrI3cF6XOJS7iEI1FWslTo3uofB2+mn6sIJEQD9PrNZKoAAMDiA==} + /esbuild-linux-32/0.14.50: + resolution: {integrity: sha512-sWUwvf3uz7dFOpLzYuih+WQ7dRycrBWHCdoXJ4I4XdMxEHCECd8b7a9N9u7FzT6XR2gHPk9EzvchQUtiEMRwqw==} engines: {node: '>=12'} cpu: [ia32] os: [linux] @@ -593,8 +505,8 @@ packages: dev: true optional: true - /esbuild-linux-64/0.14.49: - resolution: {integrity: sha512-hYmzRIDzFfLrB5c1SknkxzM8LdEUOusp6M2TnuQZJLRtxTgyPnZZVtyMeCLki0wKgYPXkFsAVhi8vzo2mBNeTg==} + /esbuild-linux-64/0.14.50: + resolution: {integrity: sha512-u0PQxPhaeI629t4Y3EEcQ0wmWG+tC/LpP2K7yDFvwuPq0jSQ8SIN+ARNYfRjGW15O2we3XJvklbGV0wRuUCPig==} engines: {node: '>=12'} cpu: [x64] os: [linux] @@ -602,8 +514,8 @@ packages: dev: true optional: true - /esbuild-linux-arm/0.14.49: - resolution: {integrity: sha512-iE3e+ZVv1Qz1Sy0gifIsarJMQ89Rpm9mtLSRtG3AH0FPgAzQ5Z5oU6vYzhc/3gSPi2UxdCOfRhw2onXuFw/0lg==} + /esbuild-linux-arm/0.14.50: + resolution: {integrity: sha512-VALZq13bhmFJYFE/mLEb+9A0w5vo8z+YDVOWeaf9vOTrSC31RohRIwtxXBnVJ7YKLYfEMzcgFYf+OFln3Y0cWg==} engines: {node: '>=12'} cpu: [arm] os: [linux] @@ -611,8 +523,8 @@ packages: dev: true optional: true - /esbuild-linux-arm64/0.14.49: - resolution: {integrity: sha512-KLQ+WpeuY+7bxukxLz5VgkAAVQxUv67Ft4DmHIPIW+2w3ObBPQhqNoeQUHxopoW/aiOn3m99NSmSV+bs4BSsdA==} + /esbuild-linux-arm64/0.14.50: + resolution: {integrity: sha512-ZyfoNgsTftD7Rp5S7La5auomKdNeB3Ck+kSKXC4pp96VnHyYGjHHXWIlcbH8i+efRn9brszo1/Thl1qn8RqmhQ==} engines: {node: '>=12'} cpu: [arm64] os: [linux] @@ -620,8 +532,8 @@ packages: dev: true optional: true - /esbuild-linux-mips64le/0.14.49: - resolution: {integrity: sha512-n+rGODfm8RSum5pFIqFQVQpYBw+AztL8s6o9kfx7tjfK0yIGF6tm5HlG6aRjodiiKkH2xAiIM+U4xtQVZYU4rA==} + /esbuild-linux-mips64le/0.14.50: + resolution: {integrity: sha512-ygo31Vxn/WrmjKCHkBoutOlFG5yM9J2UhzHb0oWD9O61dGg+Hzjz9hjf5cmM7FBhAzdpOdEWHIrVOg2YAi6rTw==} engines: {node: '>=12'} cpu: [mips64el] os: [linux] @@ -629,8 +541,8 @@ packages: dev: true optional: true - /esbuild-linux-ppc64le/0.14.49: - resolution: {integrity: sha512-WP9zR4HX6iCBmMFH+XHHng2LmdoIeUmBpL4aL2TR8ruzXyT4dWrJ5BSbT8iNo6THN8lod6GOmYDLq/dgZLalGw==} + /esbuild-linux-ppc64le/0.14.50: + resolution: {integrity: sha512-xWCKU5UaiTUT6Wz/O7GKP9KWdfbsb7vhfgQzRfX4ahh5NZV4ozZ4+SdzYG8WxetsLy84UzLX3Pi++xpVn1OkFQ==} engines: {node: '>=12'} cpu: [ppc64] os: [linux] @@ -638,8 +550,8 @@ packages: dev: true optional: true - /esbuild-linux-riscv64/0.14.49: - resolution: {integrity: sha512-h66ORBz+Dg+1KgLvzTVQEA1LX4XBd1SK0Fgbhhw4akpG/YkN8pS6OzYI/7SGENiN6ao5hETRDSkVcvU9NRtkMQ==} + /esbuild-linux-riscv64/0.14.50: + resolution: {integrity: sha512-0+dsneSEihZTopoO9B6Z6K4j3uI7EdxBP7YSF5rTwUgCID+wHD3vM1gGT0m+pjCW+NOacU9kH/WE9N686FHAJg==} engines: {node: '>=12'} cpu: [riscv64] os: [linux] @@ -647,8 +559,8 @@ packages: dev: true optional: true - /esbuild-linux-s390x/0.14.49: - resolution: {integrity: sha512-DhrUoFVWD+XmKO1y7e4kNCqQHPs6twz6VV6Uezl/XHYGzM60rBewBF5jlZjG0nCk5W/Xy6y1xWeopkrhFFM0sQ==} + /esbuild-linux-s390x/0.14.50: + resolution: {integrity: sha512-tVjqcu8o0P9H4StwbIhL1sQYm5mWATlodKB6dpEZFkcyTI8kfIGWiWcrGmkNGH2i1kBUOsdlBafPxR3nzp3TDA==} engines: {node: '>=12'} cpu: [s390x] os: [linux] @@ -656,8 +568,8 @@ packages: dev: true optional: true - /esbuild-netbsd-64/0.14.49: - resolution: {integrity: sha512-BXaUwFOfCy2T+hABtiPUIpWjAeWK9P8O41gR4Pg73hpzoygVGnj0nI3YK4SJhe52ELgtdgWP/ckIkbn2XaTxjQ==} + /esbuild-netbsd-64/0.14.50: + resolution: {integrity: sha512-0R/glfqAQ2q6MHDf7YJw/TulibugjizBxyPvZIcorH0Mb7vSimdHy0XF5uCba5CKt+r4wjax1mvO9lZ4jiAhEg==} engines: {node: '>=12'} cpu: [x64] os: [netbsd] @@ -665,8 +577,8 @@ packages: dev: true optional: true - /esbuild-openbsd-64/0.14.49: - resolution: {integrity: sha512-lP06UQeLDGmVPw9Rg437Btu6J9/BmyhdoefnQ4gDEJTtJvKtQaUcOQrhjTq455ouZN4EHFH1h28WOJVANK41kA==} + /esbuild-openbsd-64/0.14.50: + resolution: {integrity: sha512-7PAtmrR5mDOFubXIkuxYQ4bdNS6XCK8AIIHUiZxq1kL8cFIH5731jPcXQ4JNy/wbj1C9sZ8rzD8BIM80Tqk29w==} engines: {node: '>=12'} cpu: [x64] os: [openbsd] @@ -674,8 +586,8 @@ packages: dev: true optional: true - /esbuild-sunos-64/0.14.49: - resolution: {integrity: sha512-4c8Zowp+V3zIWje329BeLbGh6XI9c/rqARNaj5yPHdC61pHI9UNdDxT3rePPJeWcEZVKjkiAS6AP6kiITp7FSw==} + /esbuild-sunos-64/0.14.50: + resolution: {integrity: sha512-gBxNY/wyptvD7PkHIYcq7se6SQEXcSC8Y7mE0FJB+CGgssEWf6vBPfTTZ2b6BWKnmaP6P6qb7s/KRIV5T2PxsQ==} engines: {node: '>=12'} cpu: [x64] os: [sunos] @@ -683,8 +595,8 @@ packages: dev: true optional: true - /esbuild-windows-32/0.14.49: - resolution: {integrity: sha512-q7Rb+J9yHTeKr9QTPDYkqfkEj8/kcKz9lOabDuvEXpXuIcosWCJgo5Z7h/L4r7rbtTH4a8U2FGKb6s1eeOHmJA==} + /esbuild-windows-32/0.14.50: + resolution: {integrity: sha512-MOOe6J9cqe/iW1qbIVYSAqzJFh0p2LBLhVUIWdMVnNUNjvg2/4QNX4oT4IzgDeldU+Bym9/Tn6+DxvUHJXL5Zw==} engines: {node: '>=12'} cpu: [ia32] os: [win32] @@ -692,8 +604,8 @@ packages: dev: true optional: true - /esbuild-windows-64/0.14.49: - resolution: {integrity: sha512-+Cme7Ongv0UIUTniPqfTX6mJ8Deo7VXw9xN0yJEN1lQMHDppTNmKwAM3oGbD/Vqff+07K2gN0WfNkMohmG+dVw==} + /esbuild-windows-64/0.14.50: + resolution: {integrity: sha512-r/qE5Ex3w1jjGv/JlpPoWB365ldkppUlnizhMxJgojp907ZF1PgLTuW207kgzZcSCXyquL9qJkMsY+MRtaZ5yQ==} engines: {node: '>=12'} cpu: [x64] os: [win32] @@ -701,8 +613,8 @@ packages: dev: true optional: true - /esbuild-windows-arm64/0.14.49: - resolution: {integrity: sha512-v+HYNAXzuANrCbbLFJ5nmO3m5y2PGZWLe3uloAkLt87aXiO2mZr3BTmacZdjwNkNEHuH3bNtN8cak+mzVjVPfA==} + /esbuild-windows-arm64/0.14.50: + resolution: {integrity: sha512-EMS4lQnsIe12ZyAinOINx7eq2mjpDdhGZZWDwPZE/yUTN9cnc2Ze/xUTYIAyaJqrqQda3LnDpADKpvLvol6ENQ==} engines: {node: '>=12'} cpu: [arm64] os: [win32] @@ -710,32 +622,32 @@ packages: dev: true optional: true - /esbuild/0.14.49: - resolution: {integrity: sha512-/TlVHhOaq7Yz8N1OJrjqM3Auzo5wjvHFLk+T8pIue+fhnhIMpfAzsG6PLVMbFveVxqD2WOp3QHei+52IMUNmCw==} + /esbuild/0.14.50: + resolution: {integrity: sha512-SbC3k35Ih2IC6trhbMYW7hYeGdjPKf9atTKwBUHqMCYFZZ9z8zhuvfnZihsnJypl74FjiAKjBRqFkBkAd0rS/w==} engines: {node: '>=12'} hasBin: true requiresBuild: true optionalDependencies: - esbuild-android-64: 0.14.49 - esbuild-android-arm64: 0.14.49 - esbuild-darwin-64: 0.14.49 - esbuild-darwin-arm64: 0.14.49 - esbuild-freebsd-64: 0.14.49 - esbuild-freebsd-arm64: 0.14.49 - esbuild-linux-32: 0.14.49 - esbuild-linux-64: 0.14.49 - esbuild-linux-arm: 0.14.49 - esbuild-linux-arm64: 0.14.49 - esbuild-linux-mips64le: 0.14.49 - esbuild-linux-ppc64le: 0.14.49 - esbuild-linux-riscv64: 0.14.49 - esbuild-linux-s390x: 0.14.49 - esbuild-netbsd-64: 0.14.49 - esbuild-openbsd-64: 0.14.49 - esbuild-sunos-64: 0.14.49 - esbuild-windows-32: 0.14.49 - esbuild-windows-64: 0.14.49 - esbuild-windows-arm64: 0.14.49 + esbuild-android-64: 0.14.50 + esbuild-android-arm64: 0.14.50 + esbuild-darwin-64: 0.14.50 + esbuild-darwin-arm64: 0.14.50 + esbuild-freebsd-64: 0.14.50 + esbuild-freebsd-arm64: 0.14.50 + esbuild-linux-32: 0.14.50 + esbuild-linux-64: 0.14.50 + esbuild-linux-arm: 0.14.50 + esbuild-linux-arm64: 0.14.50 + esbuild-linux-mips64le: 0.14.50 + esbuild-linux-ppc64le: 0.14.50 + esbuild-linux-riscv64: 0.14.50 + esbuild-linux-s390x: 0.14.50 + esbuild-netbsd-64: 0.14.50 + esbuild-openbsd-64: 0.14.50 + esbuild-sunos-64: 0.14.50 + esbuild-windows-32: 0.14.50 + esbuild-windows-64: 0.14.50 + esbuild-windows-arm64: 0.14.50 dev: true /escalade/3.1.1: @@ -779,11 +691,6 @@ packages: to-regex-range: 5.0.1 dev: true - /form-data-encoder/2.0.1: - resolution: {integrity: sha512-Oy+P9w5mnO4TWXVgUiQvggNKPI9/ummcSt5usuIV6HkaLKigwzPpoenhEqmGmx3zHqm6ZLJ+CR/99N8JLinaEw==} - engines: {node: '>= 14.17'} - dev: true - /fraction.js/4.2.0: resolution: {integrity: sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==} dev: true @@ -826,18 +733,6 @@ packages: wide-align: 1.1.5 dev: true - /get-stream/5.2.0: - resolution: {integrity: sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==} - engines: {node: '>=8'} - dependencies: - pump: 3.0.0 - dev: true - - /get-stream/6.0.1: - resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} - engines: {node: '>=10'} - dev: true - /glob-parent/5.1.2: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} @@ -871,25 +766,6 @@ packages: resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==} dev: true - /got/12.2.0: - resolution: {integrity: sha512-A81ll5Z8wzeCmSdIlWVMDWFKDo82v2nmOaMZDQNHKGInNqDBcle+CSb6BBiZcn/Aiefz/kSpo520WBKi9QAO/A==} - engines: {node: '>=14.16'} - dependencies: - '@sindresorhus/is': 5.3.0 - '@szmarczak/http-timer': 5.0.1 - '@types/cacheable-request': 6.0.2 - '@types/responselike': 1.0.0 - cacheable-lookup: 6.0.4 - cacheable-request: 7.0.2 - decompress-response: 6.0.0 - form-data-encoder: 2.0.1 - get-stream: 6.0.1 - http2-wrapper: 2.1.11 - lowercase-keys: 3.0.0 - p-cancelable: 3.0.0 - responselike: 2.0.1 - dev: true - /graceful-fs/4.2.10: resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==} dev: true @@ -905,18 +781,6 @@ packages: function-bind: 1.1.1 dev: true - /http-cache-semantics/4.1.0: - resolution: {integrity: sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==} - dev: true - - /http2-wrapper/2.1.11: - resolution: {integrity: sha512-aNAk5JzLturWEUiuhAN73Jcbq96R7rTitAoXV54FYMatvihnpD2+6PUgU4ce3D/m5VDbw+F5CsyKSF176ptitQ==} - engines: {node: '>=10.19.0'} - dependencies: - quick-lru: 5.1.1 - resolve-alpn: 1.2.1 - dev: true - /https-proxy-agent/5.0.1: resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} engines: {node: '>= 6'} @@ -973,17 +837,6 @@ packages: engines: {node: '>=0.12.0'} dev: true - /json-buffer/3.0.1: - resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} - dev: true - - /keyv/4.3.3: - resolution: {integrity: sha512-AcysI17RvakTh8ir03+a3zJr5r0ovnAH/XTXei/4HIv3bL2K/jzvgivLK9UuI/JbU1aJjM3NSAnVvVVd3n+4DQ==} - dependencies: - compress-brotli: 1.3.8 - json-buffer: 3.0.1 - dev: true - /kleur/4.1.5: resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==} engines: {node: '>=6'} @@ -994,16 +847,6 @@ packages: engines: {node: '>=10'} dev: true - /lowercase-keys/2.0.0: - resolution: {integrity: sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==} - engines: {node: '>=8'} - dev: true - - /lowercase-keys/3.0.0: - resolution: {integrity: sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dev: true - /lru-cache/6.0.0: resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} engines: {node: '>=10'} @@ -1044,16 +887,6 @@ packages: picomatch: 2.3.1 dev: true - /mimic-response/1.0.1: - resolution: {integrity: sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==} - engines: {node: '>=4'} - dev: true - - /mimic-response/3.1.0: - resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==} - engines: {node: '>=10'} - dev: true - /min-indent/1.0.1: resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==} engines: {node: '>=4'} @@ -1156,11 +989,6 @@ packages: engines: {node: '>=0.10.0'} dev: true - /normalize-url/6.1.0: - resolution: {integrity: sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==} - engines: {node: '>=10'} - dev: true - /npmlog/5.0.1: resolution: {integrity: sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==} dependencies: @@ -1186,11 +1014,6 @@ packages: wrappy: 1.0.2 dev: true - /p-cancelable/3.0.0: - resolution: {integrity: sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw==} - engines: {node: '>=12.20'} - dev: true - /path-is-absolute/1.0.1: resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} engines: {node: '>=0.10.0'} @@ -1300,13 +1123,6 @@ packages: hasBin: true dev: true - /pump/3.0.0: - resolution: {integrity: sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==} - dependencies: - end-of-stream: 1.4.4 - once: 1.4.0 - dev: true - /queue-microtask/1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} dev: true @@ -1343,10 +1159,6 @@ packages: engines: {node: '>=8'} dev: true - /resolve-alpn/1.2.1: - resolution: {integrity: sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==} - dev: true - /resolve-from/5.0.0: resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} engines: {node: '>=8'} @@ -1361,12 +1173,6 @@ packages: supports-preserve-symlinks-flag: 1.0.0 dev: true - /responselike/2.0.1: - resolution: {integrity: sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==} - dependencies: - lowercase-keys: 2.0.0 - dev: true - /reusify/1.0.4: resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} @@ -1392,8 +1198,8 @@ packages: estree-walker: 0.6.1 dev: true - /rollup/2.77.0: - resolution: {integrity: sha512-vL8xjY4yOQEw79DvyXLijhnhh+R/O9zpF/LEgkCebZFtb6ELeN9H3/2T0r8+mp+fFTBHZ5qGpOpW2ela2zRt3g==} + /rollup/2.77.1: + resolution: {integrity: sha512-GhutNJrvTYD6s1moo+kyq7lD9DeR5HDyXo4bDFlDSkepC9kVKY+KK/NSZFzCmeXeia3kEzVuToQmHRdugyZHxw==} engines: {node: '>=10.0.0'} hasBin: true optionalDependencies: @@ -1443,8 +1249,8 @@ packages: resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} dev: true - /set-cookie-parser/2.5.0: - resolution: {integrity: sha512-cHMAtSXilfyBePduZEBVPTCftTQWz6ehWJD5YNUg4mqvRosrrjKbo4WS8JkB0/RxonMoohHm7cOGH60mDkRQ9w==} + /set-cookie-parser/2.5.1: + resolution: {integrity: sha512-1jeBGaKNGdEq4FgIrORu/N570dwoPYio8lSoYLWmX7sQ//0JY08Xh9o5pBcgmHQ/MbsYp/aZnOe1s1lIsbLprQ==} dev: true /signal-exit/3.0.7: @@ -1645,8 +1451,8 @@ packages: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} dev: true - /vite/3.0.2: - resolution: {integrity: sha512-TAqydxW/w0U5AoL5AsD9DApTvGb2iNbGs3sN4u2VdT1GFkQVUfgUldt+t08TZgi23uIauh1TUOQJALduo9GXqw==} + /vite/3.0.3: + resolution: {integrity: sha512-sDIpIcl3mv1NUaSzZwiXGEy1ZoWwwC2vkxUHY6yiDacR6zf//ZFuBJrozO62gedpE43pmxnLATNR5IYUdAEkMQ==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true peerDependencies: @@ -1664,10 +1470,10 @@ packages: terser: optional: true dependencies: - esbuild: 0.14.49 + esbuild: 0.14.50 postcss: 8.4.14 resolve: 1.22.1 - rollup: 2.77.0 + rollup: 2.77.1 optionalDependencies: fsevents: 2.3.2 dev: true diff --git a/src/components/RegisterOrLogin.svelte b/src/components/RegisterOrLogin.svelte index 7cc41709..12d7b8b7 100644 --- a/src/components/RegisterOrLogin.svelte +++ b/src/components/RegisterOrLogin.svelte @@ -2,7 +2,7 @@ import { Icon } from '$comp'; import { post } from '$lib/utils'; import { token } from '$lib/store'; - import { connect } from '$lib/socket'; + import { auth } from '$lib/socket'; import { goto } from '$app/navigation'; export let page; @@ -16,14 +16,13 @@ 'Sign in': '/login' }[page]; - let submit = () => - post(url, { username, password }).then((r) => - r.json().then((r) => { - $token = r.token; - connect(); - goto('/receive'); - }) - ); + let submit = async () => { + let r = await post(url, { username, password }); + if (!r.token) r = await post('/login', { username, password }); + $token = r.token; + auth(); + goto('/receive'); + };
diff --git a/src/lib/socket.js b/src/lib/socket.js index efc2651b..9d0c472e 100644 --- a/src/lib/socket.js +++ b/src/lib/socket.js @@ -1,8 +1,17 @@ -import { get } from "svelte/store"; -import { rate, user, token, ws } from '$lib/store'; +import { get } from 'svelte/store'; +import { rate, user, token } from '$lib/store'; let interval, socket; +export const auth = () => { + let t = get(token); + if (t) send('login', t); +}; + +export const send = (type, data) => { + socket?.readyState === 1 && socket.send(JSON.stringify({ type, data })); +}; + export const messages = (data) => ({ rate() { rate.set(data); @@ -12,9 +21,7 @@ export const messages = (data) => ({ console.log(data); }, - connected() { - socket.send(JSON.stringify({ type: 'login', data: { token: get(token) } })); - }, + connected: auth, login() { user.set(data); @@ -29,18 +36,14 @@ let currentReconnectDelay = initialReconnectDelay; export function connect() { clearInterval(interval); - if (socket) socket.close(); + if (socket) return auth(); + socket = new WebSocket('ws://localhost:3119/ws'); socket.addEventListener('open', onWebsocketOpen); socket.addEventListener('close', onWebsocketClose); socket.addEventListener('message', onWebsocketMessage); - interval = setInterval( - () => socket.readyState === 1 && socket.send(JSON.stringify({ type: 'heartbeat' })), - 5000 - ); - - ws.set(socket); + interval = setInterval(() => send('heartbeat'), 5000); } function onWebsocketMessage(msg) { @@ -53,7 +56,7 @@ function onWebsocketOpen() { } function onWebsocketClose() { - ws.set(null); + socket = null; setTimeout(() => { reconnectToWebsocket(); }, currentReconnectDelay + Math.floor(Math.random() * 3000)); diff --git a/src/lib/store.js b/src/lib/store.js index 3963f55a..94b7fffd 100644 --- a/src/lib/store.js +++ b/src/lib/store.js @@ -3,4 +3,3 @@ import { writable } from 'svelte/store'; export const rate = writable(); export const user = writable(); export const token = writable(); -export const ws = writable(); diff --git a/src/lib/utils.js b/src/lib/utils.js index 595d2dd8..b1bc24ec 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -1,10 +1,14 @@ +import { browser } from "$app/env"; + export function scroll(section) { section.scrollIntoView({ behavior: 'smooth' }); } +const base = browser ? "" : import.meta.env.VITE_COINOS_URL; + export const post = (url, body) => - fetch(url, { + fetch(base + url, { method: 'POST', body: JSON.stringify(body), headers: { 'accept': 'application/json', 'content-type': 'application/json' } - }); + }).then(r => r.json); diff --git a/src/routes/invoice.svelte b/src/routes/invoice.svelte index b8f9e54b..eedb2494 100644 --- a/src/routes/invoice.svelte +++ b/src/routes/invoice.svelte @@ -6,6 +6,7 @@ QR code +{#if $user} {text} @@ -16,3 +17,4 @@ QR code {#each $user.payments as p} {p.amount}
{/each} +{/if} diff --git a/src/routes/login.js b/src/routes/login.js index e8c74365..771de9e1 100644 --- a/src/routes/login.js +++ b/src/routes/login.js @@ -1,13 +1,5 @@ -import got from 'got'; +import { post } from '$lib/utils'; export async function POST({ request }) { - let json = await request.json(); - - let body = await got - .post('http://localhost:3119/login', { - json - }) - .json(); - - return { body }; + return { body: await post('/login', await request.json()) }; } diff --git a/src/routes/register.js b/src/routes/register.js new file mode 100644 index 00000000..9f79f94e --- /dev/null +++ b/src/routes/register.js @@ -0,0 +1,6 @@ +import { post } from '$lib/utils'; + +export async function POST({ request }) { + let user = await request.json(); + return { body: await post('/register', { user }) }; +} diff --git a/src/routes/register.svelte b/src/routes/register.svelte index 60a81ced..69ec5fd2 100644 --- a/src/routes/register.svelte +++ b/src/routes/register.svelte @@ -1,6 +1,5 @@ -- cgit v1.2.3 From 80cf7e9b77dcc4cbcf7711eb63a218c3aec07ec6 Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Wed, 27 Jul 2022 00:00:43 -0600 Subject: hook up receive page and more adjustments --- .env | 1 + src/components/AppHeader.svelte | 4 +- src/lib/socket.js | 3 +- src/lib/store.js | 1 + src/routes/invoice.js | 3 +- src/routes/invoice.svelte | 23 +++-- src/routes/receive.svelte | 194 +++++++++++++++++++++++++++++----------- static/icons/info.svg | 3 + 8 files changed, 161 insertions(+), 71 deletions(-) create mode 100644 static/icons/info.svg diff --git a/.env b/.env index cdf37b2a..be4e208d 100644 --- a/.env +++ b/.env @@ -1 +1,2 @@ VITE_COINOS_URL=http://localhost:3119 +VITE_COINOS_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImJvYiIsImlhdCI6MTY1ODg1NTM4Mn0.typE3V7Jb29S3aXGKd81RaazR6I4CBG_oW5WAY3avr4 diff --git a/src/components/AppHeader.svelte b/src/components/AppHeader.svelte index 9998a4f6..bbe2e05e 100644 --- a/src/components/AppHeader.svelte +++ b/src/components/AppHeader.svelte @@ -14,10 +14,10 @@ >
- import { rate, user } from '$lib/store'; - import { onMount } from 'svelte'; + import { rate, user, invoiceAmount } from '$lib/store'; export let text; -QR code - -{text} - -{$rate} - -{$user?.username} - -{#each $user.payments as p} - {p.amount}
-{/each} +{#if $user} + {text} + {$invoiceAmount} + {$rate} + {$user.username} + {#each $user.payments as p} + {p.amount}
+ {/each} +{/if} diff --git a/src/routes/receive.svelte b/src/routes/receive.svelte index 73d3cc06..8cc49de2 100644 --- a/src/routes/receive.svelte +++ b/src/routes/receive.svelte @@ -2,74 +2,162 @@ // in the future we will want to allow users to set their fiat currency in the settings import { AppHeader, Icon } from '$comp'; import { goto } from '$app/navigation'; + import { invoiceAmount, rate } from '$lib/store'; let useFiat = true; let amountFiat = 0; let amountSats = 0; + let message = ''; + + $: $invoiceAmount = parseInt(amountSats === 0 ? amountFiat / ($rate / 100000000) : amountSats); + $: amountSatsFormatted = new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format( + amountSats + ); + + $: amountFiatConverted = new Intl.NumberFormat('en-US', { + style: 'currency', + currency: 'USD' + }).format(amountSats * ($rate / 100000000)); + + $: amountSatsConverted = new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format( + amountFiat / ($rate / 100000000) + ); const numPad = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '0', '<']; + + const handleInput = (value) => { + if (message) { + message = ''; + } + if (useFiat) { + if (amountFiat === 0 && value !== '.' && value !== '<' && value !== '0') { + amountFiat = value; + } else if (amountFiat === 0 && value === '.') { + amountFiat = '0.'; + } else if (amountFiat !== 0 && amountFiat.includes('.') && value === '.') { + return; + } else if (value === '<') { + if (amountFiat !== 0) { + amountFiat = amountFiat.slice(0, amountFiat.length - 1); + if (amountFiat.length === 0) { + amountFiat = 0; + } + } + } else if (value !== '.' && value !== '<' && parseInt(amountFiat + value) > $rate) { + message = 'Please enter an amount less than 1 bitcoin.'; + } else if (amountFiat !== 0 && amountFiat.match(/\.../)) { + return; + } else { + amountFiat = amountFiat + value; + } + } else { + if (value === '.') { + return; + } else if (amountSats === 0 && value !== '<' && value !== '0') { + amountSats = value; + } else if (value === '<') { + if (amountSats !== 0) { + amountSats = amountSats.slice(0, amountSats.length - 1); + if (amountSats.length === 0) { + amountSats = 0; + } + } + } else if (value !== '<' && parseInt(amountSats + value) > 100000000) { + message = 'Please enter an amount less than 1 bitcoin.'; + } else { + amountSats = amountSats + value; + } + } + }; -
-
- -
-
- {useFiat ? `$${amountFiat}` : amountSats}{useFiat ? 'CAD' : 'SATS'} +
+ +
+
+ {useFiat ? `$${amountFiat}` : amountSatsFormatted}{useFiat ? 'USD' : 'SATS'} +
+ {useFiat ? `${amountSatsConverted} SATS` : `${amountFiatConverted} USD`} +
- {useFiat ? `${amountSats} SATS` : `$${amountFiat} CAD`} -
- -
- {#each numPad as value} - {#if value === '<'} - - {:else} - - {/if} - {/each} -
+ + + + + {:else} + + {/if} + {/each} +
- -
- - + +
+ + +
-
+{/if} diff --git a/static/icons/info.svg b/static/icons/info.svg new file mode 100644 index 00000000..80f33b37 --- /dev/null +++ b/static/icons/info.svg @@ -0,0 +1,3 @@ + + + -- cgit v1.2.3 From aaa704f6cd760268ba5221c812b4f5a4df32bac3 Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Wed, 27 Jul 2022 00:06:41 -0600 Subject: format --- src/lib/utils.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/utils.js b/src/lib/utils.js index b1bc24ec..5b1bba7f 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -1,14 +1,14 @@ -import { browser } from "$app/env"; +import { browser } from '$app/env'; export function scroll(section) { section.scrollIntoView({ behavior: 'smooth' }); } -const base = browser ? "" : import.meta.env.VITE_COINOS_URL; +const base = browser ? '' : import.meta.env.VITE_COINOS_URL; export const post = (url, body) => fetch(base + url, { method: 'POST', body: JSON.stringify(body), - headers: { 'accept': 'application/json', 'content-type': 'application/json' } - }).then(r => r.json); + headers: { accept: 'application/json', 'content-type': 'application/json' } + }).then((r) => r.json); -- cgit v1.2.3 From 3681ed8458d68fa41cda01ad769546872be3c900 Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Wed, 27 Jul 2022 00:27:22 -0600 Subject: add loading skeleton to receive page --- src/routes/receive.svelte | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/routes/receive.svelte b/src/routes/receive.svelte index 8cc49de2..a67b0787 100644 --- a/src/routes/receive.svelte +++ b/src/routes/receive.svelte @@ -160,4 +160,10 @@
+{:else} +
+
+
{/if} -- cgit v1.2.3 From cf7278f54bac6b0dc048df41d92e1cdcf18c2840 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 26 Jul 2022 23:37:03 -0700 Subject: forgot password link --- src/components/RegisterOrLogin.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/RegisterOrLogin.svelte b/src/components/RegisterOrLogin.svelte index 12d7b8b7..db577911 100644 --- a/src/components/RegisterOrLogin.svelte +++ b/src/components/RegisterOrLogin.svelte @@ -77,7 +77,7 @@

{:else} {/if} -- cgit v1.2.3 From cd9e850f9e15e890727026942d646d59f526fe4e Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 26 Jul 2022 23:37:18 -0700 Subject: fix invoice endpoint --- src/lib/socket.js | 1 + src/lib/utils.js | 2 +- src/routes/invoice.js | 15 +++------------ 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/lib/socket.js b/src/lib/socket.js index 9d0c472e..90238c23 100644 --- a/src/lib/socket.js +++ b/src/lib/socket.js @@ -24,6 +24,7 @@ export const messages = (data) => ({ connected: auth, login() { + console.log("OY", data) user.set(data); } }); diff --git a/src/lib/utils.js b/src/lib/utils.js index 5b1bba7f..c17b0a98 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -11,4 +11,4 @@ export const post = (url, body) => method: 'POST', body: JSON.stringify(body), headers: { accept: 'application/json', 'content-type': 'application/json' } - }).then((r) => r.json); + }).then((r) => r.json()); diff --git a/src/routes/invoice.js b/src/routes/invoice.js index 147da2b7..4b3327f6 100644 --- a/src/routes/invoice.js +++ b/src/routes/invoice.js @@ -1,21 +1,12 @@ -import got from 'got'; +import { post } from '$lib/utils'; import { invoiceAmount } from '$lib/store'; const username = 'bob', network = 'lightning'; export async function GET({ params }) { - let text = await got - .post('http://localhost:3119/lightning/invoice', { - json: { amount: invoiceAmount } - }) - .text(); - - await got - .post('http://localhost:3119/invoice', { - json: { invoice: { text, network }, user: { username } } - }) - .json(); + let { text } = await post('/lightning/invoice', { amount: invoiceAmount }); + await post('/invoice', { invoice: { text, network }, user: { username } }); return { body: { text } }; } -- cgit v1.2.3 From bcb252eb0b52f64449dad295595fdaa5e80cb5dc Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Thu, 28 Jul 2022 22:17:58 -0600 Subject: final adjustments for numpad --- src/components/RegisterOrLogin.svelte | 4 +++- src/lib/socket.js | 2 +- src/routes/receive.svelte | 10 ++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/components/RegisterOrLogin.svelte b/src/components/RegisterOrLogin.svelte index db577911..6cae8b5a 100644 --- a/src/components/RegisterOrLogin.svelte +++ b/src/components/RegisterOrLogin.svelte @@ -77,7 +77,9 @@

{:else} {/if} diff --git a/src/lib/socket.js b/src/lib/socket.js index 90238c23..087addf9 100644 --- a/src/lib/socket.js +++ b/src/lib/socket.js @@ -24,7 +24,7 @@ export const messages = (data) => ({ connected: auth, login() { - console.log("OY", data) + console.log('OY', data); user.set(data); } }); diff --git a/src/routes/receive.svelte b/src/routes/receive.svelte index a67b0787..338bc06c 100644 --- a/src/routes/receive.svelte +++ b/src/routes/receive.svelte @@ -32,6 +32,8 @@ if (useFiat) { if (amountFiat === 0 && value !== '.' && value !== '<' && value !== '0') { amountFiat = value; + } else if ((amountFiat === 0 || amountFiat === '0') && value === '0') { + return; } else if (amountFiat === 0 && value === '.') { amountFiat = '0.'; } else if (amountFiat !== 0 && amountFiat.includes('.') && value === '.') { @@ -41,6 +43,7 @@ amountFiat = amountFiat.slice(0, amountFiat.length - 1); if (amountFiat.length === 0) { amountFiat = 0; + amountSats = 0; } } } else if (value !== '.' && value !== '<' && parseInt(amountFiat + value) > $rate) { @@ -92,7 +95,10 @@ if (useFiat) { amountSats = (amountFiat / ($rate / 100000000)).toFixed(0).toString(); } else { - amountFiat = (amountSats * ($rate / 100000000)).toFixed(2).toString(); + amountFiat = + (amountSats * ($rate / 100000000)).toFixed(2) > 0.0 + ? (amountSats * ($rate / 100000000)).toFixed(2).toString() + : 0; } useFiat = !useFiat; }}>
{/if} -- cgit v1.2.3 From 49e7185efd45add123e0dbfcab077772b5ff22f6 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 28 Jul 2022 21:22:25 -0700 Subject: save token in cookie --- package.json | 1 + pnpm-lock.yaml | 7 +++++++ src/components/RegisterOrLogin.svelte | 4 +++- src/hooks/index.js | 16 ++++++++++++++++ src/lib/socket.js | 1 - src/lib/store.js | 18 ++++++++++++++++-- src/routes/__layout.svelte | 4 ++++ src/routes/login.js | 21 ++++++++++++++++++++- 8 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 src/hooks/index.js diff --git a/package.json b/package.json index 6d3ad58a..23bb6cb6 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "@sveltejs/adapter-auto": "next", "@sveltejs/kit": "next", "autoprefixer": "^10.4.7", + "cookie": "^0.5.0", "postcss": "^8.4.14", "prettier": "^2.7.1", "prettier-plugin-svelte": "^2.7.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 72a53df0..9c34207f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,7 @@ specifiers: '@sveltejs/adapter-auto': next '@sveltejs/kit': next autoprefixer: ^10.4.7 + cookie: ^0.5.0 postcss: ^8.4.14 prettier: ^2.7.1 prettier-plugin-svelte: ^2.7.0 @@ -16,6 +17,7 @@ devDependencies: '@sveltejs/adapter-auto': 1.0.0-next.64 '@sveltejs/kit': 1.0.0-next.396_svelte@3.49.0+vite@3.0.3 autoprefixer: 10.4.7_postcss@8.4.14 + cookie: 0.5.0 postcss: 8.4.14 prettier: 2.7.1 prettier-plugin-svelte: 2.7.0_o3ioganyptcsrh6x4hnxvjkpqi @@ -371,6 +373,11 @@ packages: resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==} dev: true + /cookie/0.5.0: + resolution: {integrity: sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==} + engines: {node: '>= 0.6'} + dev: true + /cssesc/3.0.0: resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==} engines: {node: '>=4'} diff --git a/src/components/RegisterOrLogin.svelte b/src/components/RegisterOrLogin.svelte index 6cae8b5a..2334741d 100644 --- a/src/components/RegisterOrLogin.svelte +++ b/src/components/RegisterOrLogin.svelte @@ -7,7 +7,7 @@ export let page; - let username, password; + let username = "bob", password = "pw"; let revealPassword = false; @@ -20,6 +20,7 @@ let r = await post(url, { username, password }); if (!r.token) r = await post('/login', { username, password }); $token = r.token; + console.log("new token", r.token) auth(); goto('/receive'); }; @@ -42,6 +43,7 @@ required class="bg-primary p-4 rounded-2xl w-full" bind:value={username} + autofocus />
diff --git a/src/hooks/index.js b/src/hooks/index.js new file mode 100644 index 00000000..21e56052 --- /dev/null +++ b/src/hooks/index.js @@ -0,0 +1,16 @@ +import cookie from "cookie"; +export async function handle({ event, resolve }) { + let { request: { headers }, + } = event; + + const cookies = cookie.parse(headers.get("cookie") || ""); + let { token } = cookies; + event.locals = { token }; + + return resolve(event); +} + + +export const getSession = ({ locals: { token } }) => { + return { token }; +}; diff --git a/src/lib/socket.js b/src/lib/socket.js index 087addf9..9d0c472e 100644 --- a/src/lib/socket.js +++ b/src/lib/socket.js @@ -24,7 +24,6 @@ export const messages = (data) => ({ connected: auth, login() { - console.log('OY', data); user.set(data); } }); diff --git a/src/lib/store.js b/src/lib/store.js index 7b510748..62232f9d 100644 --- a/src/lib/store.js +++ b/src/lib/store.js @@ -1,6 +1,20 @@ -import { writable } from 'svelte/store'; +import { get, writable } from 'svelte/store'; +import { browser } from '$app/env'; + +const persisted = (k, i) => { + let s = writable( + browser && sessionStorage.getItem(k) && sessionStorage.getItem(k) !== 'undefined' + ? JSON.parse(sessionStorage.getItem(k)) + : i + ); + + s.subscribe((v) => browser && sessionStorage.setItem(k, JSON.stringify(v)) + ); + + return s; +}; export const rate = writable(); export const user = writable(); export const invoiceAmount = writable(); -export const token = writable(); +export const token = persisted('token'); diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index f5576edd..1af9679a 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -2,7 +2,11 @@ import '../app.css'; import { onMount } from 'svelte'; import { connect } from '$lib/socket'; + import { token } from "$lib/store"; + import { session } from "$app/stores"; + import { browser } from "$app/env"; + browser && ($token ||= $session.token); onMount(connect); diff --git a/src/routes/login.js b/src/routes/login.js index 771de9e1..db1fbb6c 100644 --- a/src/routes/login.js +++ b/src/routes/login.js @@ -1,5 +1,24 @@ import { post } from '$lib/utils'; +import cookie from 'cookie'; + +let maxAge = 30 * 24 * 60 * 60; export async function POST({ request }) { - return { body: await post('/login', await request.json()) }; + let body = await post('/login', await request.json()); + + let expires = new Date(); + expires.setSeconds(expires.getSeconds() + maxAge); + + return { + body, + headers: { + 'set-cookie': cookie.serialize('token', body.token, { + httpOnly: true, + maxAge, + sameSite: 'lax', + path: '/', + expires + }) + } + }; } -- cgit v1.2.3 From a038ce9711f8ae5945eba073c82aa2aeb2bcf5c3 Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Fri, 29 Jul 2022 21:29:18 -0600 Subject: start hooking up invoice screen --- package.json | 1 + pnpm-lock.yaml | 18 ++- src/components/RegisterOrLogin.svelte | 7 +- src/hooks/index.js | 18 +-- src/lib/store.js | 4 +- src/routes/__layout.svelte | 8 +- src/routes/invoice.svelte | 253 ++++++++++++++++++++++++++++++++-- src/routes/receive.svelte | 22 +-- static/icons/arrow-left.svg | 3 + static/images/invoice.svg | 4 + tailwind.config.cjs | 3 +- 11 files changed, 298 insertions(+), 43 deletions(-) create mode 100644 static/icons/arrow-left.svg create mode 100644 static/images/invoice.svg diff --git a/package.json b/package.json index 23bb6cb6..d4312d1c 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "postcss": "^8.4.14", "prettier": "^2.7.1", "prettier-plugin-svelte": "^2.7.0", + "qr-code-styling": "1.6.0-rc.1", "svelte": "^3.49.0", "svelte-preprocess": "^4.10.7", "tailwindcss": "^3.1.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9c34207f..69b6d84e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,7 @@ specifiers: postcss: ^8.4.14 prettier: ^2.7.1 prettier-plugin-svelte: ^2.7.0 + qr-code-styling: 1.6.0-rc.1 svelte: ^3.49.0 svelte-preprocess: ^4.10.7 tailwindcss: ^3.1.6 @@ -15,12 +16,13 @@ specifiers: devDependencies: '@sveltejs/adapter-auto': 1.0.0-next.64 - '@sveltejs/kit': 1.0.0-next.396_svelte@3.49.0+vite@3.0.3 + '@sveltejs/kit': 1.0.0-next.398_svelte@3.49.0+vite@3.0.3 autoprefixer: 10.4.7_postcss@8.4.14 cookie: 0.5.0 postcss: 8.4.14 prettier: 2.7.1 prettier-plugin-svelte: 2.7.0_o3ioganyptcsrh6x4hnxvjkpqi + qr-code-styling: 1.6.0-rc.1 svelte: 3.49.0 svelte-preprocess: 4.10.7_nxvsp6sjiltnatqa6jdm4mr6zu tailwindcss: 3.1.6 @@ -121,8 +123,8 @@ packages: - supports-color dev: true - /@sveltejs/kit/1.0.0-next.396_svelte@3.49.0+vite@3.0.3: - resolution: {integrity: sha512-bKFpuzp9QxPkOIOEIeNeedvxEMORNqBPxUmoJXDP/Se7MrSfcxYiamjBcKrG+bgGNWmV39nD3EvUox+CXno/Ig==} + /@sveltejs/kit/1.0.0-next.398_svelte@3.49.0+vite@3.0.3: + resolution: {integrity: sha512-ONjHoRurnFUe+0lv0P9rZQpDuuJy4Cr/lDneoG+lkOR5/7gcvd03TlVdxLz1ZQAWPbgovm/PpshOvIUeC4n62A==} engines: {node: '>=16.9'} hasBin: true peerDependencies: @@ -1130,6 +1132,16 @@ packages: hasBin: true dev: true + /qr-code-styling/1.6.0-rc.1: + resolution: {integrity: sha512-ModRIiW6oUnsP18QzrRYZSc/CFKFKIdj7pUs57AEVH20ajlglRpN3HukjHk0UbNMTlKGuaYl7Gt6/O5Gg2NU2Q==} + dependencies: + qrcode-generator: 1.4.4 + dev: true + + /qrcode-generator/1.4.4: + resolution: {integrity: sha512-HM7yY8O2ilqhmULxGMpcHSF1EhJJ9yBj8gvDEuZ6M+KGJ0YY2hKpnXvRD+hZPLrDVck3ExIGhmPtSdcjC+guuw==} + dev: true + /queue-microtask/1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} dev: true diff --git a/src/components/RegisterOrLogin.svelte b/src/components/RegisterOrLogin.svelte index 2334741d..15be60cf 100644 --- a/src/components/RegisterOrLogin.svelte +++ b/src/components/RegisterOrLogin.svelte @@ -7,7 +7,8 @@ export let page; - let username = "bob", password = "pw"; + let username = 'bob', + password = 'pw'; let revealPassword = false; @@ -20,7 +21,7 @@ let r = await post(url, { username, password }); if (!r.token) r = await post('/login', { username, password }); $token = r.token; - console.log("new token", r.token) + console.log('new token', r.token); auth(); goto('/receive'); }; @@ -43,7 +44,7 @@ required class="bg-primary p-4 rounded-2xl w-full" bind:value={username} - autofocus + autofocus /> diff --git a/src/hooks/index.js b/src/hooks/index.js index 21e56052..6a9c8ec5 100644 --- a/src/hooks/index.js +++ b/src/hooks/index.js @@ -1,16 +1,16 @@ -import cookie from "cookie"; +import cookie from 'cookie'; export async function handle({ event, resolve }) { - let { request: { headers }, - } = event; + let { + request: { headers } + } = event; - const cookies = cookie.parse(headers.get("cookie") || ""); - let { token } = cookies; - event.locals = { token }; + const cookies = cookie.parse(headers.get('cookie') || ''); + let { token } = cookies; + event.locals = { token }; - return resolve(event); + return resolve(event); } - export const getSession = ({ locals: { token } }) => { - return { token }; + return { token }; }; diff --git a/src/lib/store.js b/src/lib/store.js index 62232f9d..6f4a9515 100644 --- a/src/lib/store.js +++ b/src/lib/store.js @@ -8,8 +8,7 @@ const persisted = (k, i) => { : i ); - s.subscribe((v) => browser && sessionStorage.setItem(k, JSON.stringify(v)) - ); + s.subscribe((v) => browser && sessionStorage.setItem(k, JSON.stringify(v))); return s; }; @@ -17,4 +16,5 @@ const persisted = (k, i) => { export const rate = writable(); export const user = writable(); export const invoiceAmount = writable(); +export const invoiceAmountFiat = writable(); export const token = persisted('token'); diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index 1af9679a..6562db18 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -2,11 +2,11 @@ import '../app.css'; import { onMount } from 'svelte'; import { connect } from '$lib/socket'; - import { token } from "$lib/store"; - import { session } from "$app/stores"; - import { browser } from "$app/env"; + import { token } from '$lib/store'; + import { session } from '$app/stores'; + import { browser } from '$app/env'; - browser && ($token ||= $session.token); + browser && ($token ||= $session.token); onMount(connect); diff --git a/src/routes/invoice.svelte b/src/routes/invoice.svelte index 567aefbb..6dce84fe 100644 --- a/src/routes/invoice.svelte +++ b/src/routes/invoice.svelte @@ -1,15 +1,248 @@ -{#if $user} - {text} - {$invoiceAmount} - {$rate} - {$user.username} - {#each $user.payments as p} - {p.amount}
- {/each} -{/if} + + +
+
+ {#if $invoiceAmount && $invoiceAmountFiat && $rate && text} + +
+

Add a tip?

+ +
+ {tipAmountFormatted}{`(${tipAmountSats} SATS)`} + {tipPercent}% +
+ + { + customTipAmount = ''; + tipPercent = e.target.value; + }} + /> + +
+ {#each tipAmounts as amount} + + {/each} + +
+ $ + handleCustomTipAmount(e)} + class="bg-primary rounded-2xl py-3 px-10 font-semibold mt-2 mr-1 w-full md:w-auto" + placeholder="Other" + /> + +
+
+
+ +
+ + +
+ Scan to pay insert name here + +
+ +
+
+ Invoice + {invoiceAmountFiatFormatted} + {`(${invoiceAmountFormatted} SATS)`} +
+ +
+ Tip + {tipAmountFormatted} + {`(${tipAmountSats} SATS)`} +
+ +
+ Total + {totalAmountFormatted} + {`(${totalAmountSats} SATS)`} +
+
+
+ {:else} +
+
+
+ {/if} +
+
+ + diff --git a/src/routes/receive.svelte b/src/routes/receive.svelte index 338bc06c..095a2ba3 100644 --- a/src/routes/receive.svelte +++ b/src/routes/receive.svelte @@ -2,7 +2,7 @@ // in the future we will want to allow users to set their fiat currency in the settings import { AppHeader, Icon } from '$comp'; import { goto } from '$app/navigation'; - import { invoiceAmount, rate } from '$lib/store'; + import { invoiceAmount, invoiceAmountFiat, rate } from '$lib/store'; let useFiat = true; let amountFiat = 0; @@ -10,6 +10,9 @@ let message = ''; $: $invoiceAmount = parseInt(amountSats === 0 ? amountFiat / ($rate / 100000000) : amountSats); + $: $invoiceAmountFiat = parseInt( + amountFiat === 0 ? amountSats * ($rate / 100000000) : amountFiat + ); $: amountSatsFormatted = new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format( amountSats ); @@ -63,6 +66,7 @@ amountSats = amountSats.slice(0, amountSats.length - 1); if (amountSats.length === 0) { amountSats = 0; + amountFiat = 0; } } } else if (value !== '<' && parseInt(amountSats + value) > 100000000) { @@ -77,8 +81,8 @@ -{#if $rate} -
+
+ {#if $rate}
@@ -165,11 +169,7 @@ >
-
-{:else} -
-
-
-{/if} + {:else} +
+ {/if} +
diff --git a/static/icons/arrow-left.svg b/static/icons/arrow-left.svg new file mode 100644 index 00000000..64ded577 --- /dev/null +++ b/static/icons/arrow-left.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/images/invoice.svg b/static/images/invoice.svg new file mode 100644 index 00000000..4c9cbce9 --- /dev/null +++ b/static/images/invoice.svg @@ -0,0 +1,4 @@ + + + + diff --git a/tailwind.config.cjs b/tailwind.config.cjs index 86d5d1cf..4be763a3 100644 --- a/tailwind.config.cjs +++ b/tailwind.config.cjs @@ -6,7 +6,8 @@ module.exports = { colors: { primary: '#F5F7FA', secondary: '#858A92', - gradient: '#C3CFE2' + gradient: '#C3CFE2', + lightgrey: '#eaecef' } } }, -- cgit v1.2.3 From b972aa21389c20ab9da1a627612bbc1dafeec366 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 29 Jul 2022 23:40:59 -0700 Subject: dynamic qr lib import and invoice amount param --- src/routes/invoice.js | 12 -- src/routes/invoice.svelte | 248 ------------------------------------ src/routes/invoice/[amount].js | 14 +++ src/routes/invoice/[amount].svelte | 252 +++++++++++++++++++++++++++++++++++++ src/routes/receive.svelte | 2 +- 5 files changed, 267 insertions(+), 261 deletions(-) delete mode 100644 src/routes/invoice.js delete mode 100644 src/routes/invoice.svelte create mode 100644 src/routes/invoice/[amount].js create mode 100644 src/routes/invoice/[amount].svelte diff --git a/src/routes/invoice.js b/src/routes/invoice.js deleted file mode 100644 index 4b3327f6..00000000 --- a/src/routes/invoice.js +++ /dev/null @@ -1,12 +0,0 @@ -import { post } from '$lib/utils'; -import { invoiceAmount } from '$lib/store'; - -const username = 'bob', - network = 'lightning'; - -export async function GET({ params }) { - let { text } = await post('/lightning/invoice', { amount: invoiceAmount }); - await post('/invoice', { invoice: { text, network }, user: { username } }); - - return { body: { text } }; -} diff --git a/src/routes/invoice.svelte b/src/routes/invoice.svelte deleted file mode 100644 index 6dce84fe..00000000 --- a/src/routes/invoice.svelte +++ /dev/null @@ -1,248 +0,0 @@ - - - - -
-
- {#if $invoiceAmount && $invoiceAmountFiat && $rate && text} - -
-

Add a tip?

- -
- {tipAmountFormatted}{`(${tipAmountSats} SATS)`} - {tipPercent}% -
- - { - customTipAmount = ''; - tipPercent = e.target.value; - }} - /> - -
- {#each tipAmounts as amount} - - {/each} - -
- $ - handleCustomTipAmount(e)} - class="bg-primary rounded-2xl py-3 px-10 font-semibold mt-2 mr-1 w-full md:w-auto" - placeholder="Other" - /> - -
-
-
- -
- - -
- Scan to pay insert name here - -
- -
-
- Invoice - {invoiceAmountFiatFormatted} - {`(${invoiceAmountFormatted} SATS)`} -
- -
- Tip - {tipAmountFormatted} - {`(${tipAmountSats} SATS)`} -
- -
- Total - {totalAmountFormatted} - {`(${totalAmountSats} SATS)`} -
-
-
- {:else} -
-
-
- {/if} -
-
- - diff --git a/src/routes/invoice/[amount].js b/src/routes/invoice/[amount].js new file mode 100644 index 00000000..f75a1672 --- /dev/null +++ b/src/routes/invoice/[amount].js @@ -0,0 +1,14 @@ +import { post } from '$lib/utils'; + +const username = 'bob', + network = 'lightning'; + +export async function GET({ params }) { + let { amount } = params; + console.log("AMT", amount); + let { text } = await post('/lightning/invoice', { amount }); + console.log("TXT", text); + await post('/invoice', { invoice: { text, network }, user: { username } }); + + return { body: { amount, text } }; +} diff --git a/src/routes/invoice/[amount].svelte b/src/routes/invoice/[amount].svelte new file mode 100644 index 00000000..dd6ed7fa --- /dev/null +++ b/src/routes/invoice/[amount].svelte @@ -0,0 +1,252 @@ + + + + +
+
+ {#if $invoiceAmount && $invoiceAmountFiat && $rate && text} + +
+

Add a tip?

+ +
+ {tipAmountFormatted}{`(${tipAmountSats} SATS)`} + {tipPercent}% +
+ + { + customTipAmount = ''; + tipPercent = e.target.value; + }} + /> + +
+ {#each tipAmounts as amount} + + {/each} + +
+ $ + handleCustomTipAmount(e)} + class="bg-primary rounded-2xl py-3 px-10 font-semibold mt-2 mr-1 w-full md:w-auto" + placeholder="Other" + /> + +
+
+
+ +
+ + +
+ Scan to pay insert name here + +
+ +
+
+ Invoice + {invoiceAmountFiatFormatted} + {`(${invoiceAmountFormatted} SATS)`} +
+ +
+ Tip + {tipAmountFormatted} + {`(${tipAmountSats} SATS)`} +
+ +
+ Total + {totalAmountFormatted} + {`(${totalAmountSats} SATS)`} +
+
+
+ {:else} +
+
+
+ {/if} +
+
+ + diff --git a/src/routes/receive.svelte b/src/routes/receive.svelte index 095a2ba3..ff156783 100644 --- a/src/routes/receive.svelte +++ b/src/routes/receive.svelte @@ -160,7 +160,7 @@ 0 ? 'opacity-50' : 'opacity-100'}" - on:click={() => goto('/invoice')} + on:click={() => goto(`/invoice/${$invoiceAmount}`)} disabled={$invoiceAmount === 0}> Show QR {$user.username} Date: Sat, 30 Jul 2022 06:52:55 -0600 Subject: add 404 and error page, redirect to login if trying to access w/o user --- src/components/AppHeader.svelte | 4 +- src/routes/[...path].svelte | 16 +++ src/routes/__error.svelte | 16 +++ src/routes/invoice/[amount].svelte | 232 +++++++++++++++++++------------------ src/routes/receive.svelte | 184 +++++++++++++++-------------- static/icons/error.svg | 3 + static/icons/info.svg | 2 +- static/icons/question.svg | 3 + 8 files changed, 256 insertions(+), 204 deletions(-) create mode 100644 src/routes/[...path].svelte create mode 100644 src/routes/__error.svelte create mode 100644 static/icons/error.svg create mode 100644 static/icons/question.svg diff --git a/src/components/AppHeader.svelte b/src/components/AppHeader.svelte index 3f8e7e87..6376e27f 100644 --- a/src/components/AppHeader.svelte +++ b/src/components/AppHeader.svelte @@ -1,7 +1,7 @@ @@ -15,7 +15,7 @@ > + import { Icon } from '$comp'; + + +
+
+ + + + + + +

404

+

Page not found.

+
+
diff --git a/src/routes/__error.svelte b/src/routes/__error.svelte new file mode 100644 index 00000000..6cdeeac7 --- /dev/null +++ b/src/routes/__error.svelte @@ -0,0 +1,16 @@ + + +
+
+ + + + + + +

Error

+

Please try again or contact support.

+
+
diff --git a/src/routes/invoice/[amount].svelte b/src/routes/invoice/[amount].svelte index 4c1ec199..2cf16e37 100644 --- a/src/routes/invoice/[amount].svelte +++ b/src/routes/invoice/[amount].svelte @@ -8,6 +8,10 @@ export let text; export let amount; + if (!$user && typeof window !== 'undefined') { + window.location = '/login'; + } + let tipPercent = 0; const setRate = ($invoiceAmountFiat / $invoiceAmount) * 100000000; @@ -83,131 +87,133 @@ }); - - -
-
- {#if $invoiceAmount && $invoiceAmountFiat && $rate && text} - -
-

Add a tip?

- -
- {tipAmountFormatted}{`(${tipAmountSats} SATS)`} - {tipPercent}% -
- - { - customTipAmount = ''; - tipPercent = e.target.value; - }} - /> - -
- {#each tipAmounts as amount} - goto('/receive')}> + + + +
+
+ {#if $invoiceAmount && $invoiceAmountFiat && $rate && text} + +
+

Add a tip?

+ +
+ {tipAmountFormatted}{`(${tipAmountSats} SATS)`} - {/each} + {tipPercent}% +
-
- $ - handleCustomTipAmount(e)} - class="bg-primary rounded-2xl py-3 px-10 font-semibold mt-2 mr-1 w-full md:w-auto" - placeholder="Other" - /> - + { + customTipAmount = ''; + tipPercent = e.target.value; + }} + /> + +
+ {#each tipAmounts as amount} + + {/each} + +
+ $ + handleCustomTipAmount(e)} + class="bg-primary rounded-2xl py-3 px-10 font-semibold mt-2 mr-1 w-full md:w-auto" + placeholder="Other" + /> + +
-
- -
- - -
- Scan to pay insert name here
-
-
- Invoice - {invoiceAmountFiatFormatted} - {`(${invoiceAmountFormatted} SATS)`} -
- -
- Tip - {tipAmountFormatted} - {`(${tipAmountSats} SATS)`} -
+ +
+ Scan to pay insert name here -
- Total - {totalAmountFormatted} - {`(${totalAmountSats} SATS)`} +
+ +
+
+ Invoice + {invoiceAmountFiatFormatted} + {`(${invoiceAmountFormatted} SATS)`} +
+ +
+ Tip + {tipAmountFormatted} + {`(${tipAmountSats} SATS)`} +
+ +
+ Total + {totalAmountFormatted} + {`(${totalAmountSats} SATS)`} +
-
- {:else} -
-
-
- {/if} + {:else} +
+
+
+ {/if} +
-
+{/if} diff --git a/static/icons/heart.svg b/static/icons/heart.svg new file mode 100644 index 00000000..f3a5f757 --- /dev/null +++ b/static/icons/heart.svg @@ -0,0 +1,3 @@ + + + -- cgit v1.2.3 From 1f8b1f52431dc7a95118b310dbca3a178d24614b Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Sat, 30 Jul 2022 08:31:48 -0600 Subject: remove comment --- src/routes/receive.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/src/routes/receive.svelte b/src/routes/receive.svelte index 11bafe9a..760733a3 100644 --- a/src/routes/receive.svelte +++ b/src/routes/receive.svelte @@ -85,7 +85,6 @@ {#if $user} -
{#if $rate}
-- cgit v1.2.3 From 8acc59a86b6ec049dfe07f92fd19eeda726136f3 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 30 Jul 2022 09:47:08 -0700 Subject: logout function --- src/components/AppHeader.svelte | 4 +++- src/components/RegisterOrLogin.svelte | 4 ++-- src/lib/socket.js | 4 ++++ src/routes/[...path].svelte | 16 ---------------- src/routes/[username].js | 3 +++ src/routes/[username].svelte | 27 +++++++++++++++++++++++++++ src/routes/__layout.svelte | 23 +++++++++++++++++++---- src/routes/logout/done.svelte | 13 +++++++++++++ src/routes/logout/index.js | 26 ++++++++++++++++++++++++++ src/routes/logout/index.svelte | 10 ++++++++++ src/routes/receive.svelte | 4 ---- static/icons/logout.svg | 3 +++ 12 files changed, 110 insertions(+), 27 deletions(-) delete mode 100644 src/routes/[...path].svelte create mode 100644 src/routes/[username].js create mode 100644 src/routes/[username].svelte create mode 100644 src/routes/logout/done.svelte create mode 100644 src/routes/logout/index.js create mode 100644 src/routes/logout/index.svelte create mode 100644 static/icons/logout.svg diff --git a/src/components/AppHeader.svelte b/src/components/AppHeader.svelte index 6376e27f..b096f01e 100644 --- a/src/components/AppHeader.svelte +++ b/src/components/AppHeader.svelte @@ -14,9 +14,11 @@ - + diff --git a/src/components/RegisterOrLogin.svelte b/src/components/RegisterOrLogin.svelte index b42b8d7f..f5764a85 100644 --- a/src/components/RegisterOrLogin.svelte +++ b/src/components/RegisterOrLogin.svelte @@ -1,7 +1,7 @@ diff --git a/src/lib/socket.js b/src/lib/socket.js index 9d0c472e..14555bd3 100644 --- a/src/lib/socket.js +++ b/src/lib/socket.js @@ -46,6 +46,10 @@ export function connect() { interval = setInterval(() => send('heartbeat'), 5000); } +export function close() { + if (socket) socket.close(); +} + function onWebsocketMessage(msg) { let { type, data } = JSON.parse(msg.data); messages(data)[type] && messages(data)[type](); diff --git a/src/routes/[...path].svelte b/src/routes/[...path].svelte deleted file mode 100644 index 503316bb..00000000 --- a/src/routes/[...path].svelte +++ /dev/null @@ -1,16 +0,0 @@ - - -
-
- - - - - - -

404

-

Page not found.

-
-
diff --git a/src/routes/[username].js b/src/routes/[username].js new file mode 100644 index 00000000..39a216c2 --- /dev/null +++ b/src/routes/[username].js @@ -0,0 +1,3 @@ +export async function GET({ params }) { + return { body: params } +} diff --git a/src/routes/[username].svelte b/src/routes/[username].svelte new file mode 100644 index 00000000..fe1f7754 --- /dev/null +++ b/src/routes/[username].svelte @@ -0,0 +1,27 @@ + + +{#if $user?.username === username} + +
+
+
+ Signed in as {username} +
+ + +
+
+{/if} diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index 6562db18..c01dc848 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -2,12 +2,27 @@ import '../app.css'; import { onMount } from 'svelte'; import { connect } from '$lib/socket'; - import { token } from '$lib/store'; - import { session } from '$app/stores'; + import { user, token } from '$lib/store'; + import { page, session } from '$app/stores'; import { browser } from '$app/env'; + import { goto } from '$app/navigation'; browser && ($token ||= $session.token); - onMount(connect); + let protectedRoutes = [/receive/]; + let ready = false; + + onMount(() => { + if (protectedRoutes.find((p) => $page.url.pathname.match(p))) { + if (!$token) goto('/login'); + user.subscribe((u) => (ready = true)); + } else { + ready = true; + } + + connect(); + }); - +{#if ready} + +{/if} diff --git a/src/routes/logout/done.svelte b/src/routes/logout/done.svelte new file mode 100644 index 00000000..894c7b99 --- /dev/null +++ b/src/routes/logout/done.svelte @@ -0,0 +1,13 @@ + diff --git a/src/routes/logout/index.js b/src/routes/logout/index.js new file mode 100644 index 00000000..80e65f8b --- /dev/null +++ b/src/routes/logout/index.js @@ -0,0 +1,26 @@ +import cookie from "cookie"; + +const opts = { + httpOnly: true, + sameSite: "lax", + path: "/", +}; + +export async function GET({ request: { headers } }) { + return { + status: 302, + headers: { + location: "/logout/done", + "set-cookie": [ + cookie.serialize("token", "", { + ...opts, + expires: new Date(0), + }), + cookie.serialize("refresh_token", "", { + ...opts, + expires: new Date(0), + }), + ], + }, + }; +} diff --git a/src/routes/logout/index.svelte b/src/routes/logout/index.svelte new file mode 100644 index 00000000..2c6a7085 --- /dev/null +++ b/src/routes/logout/index.svelte @@ -0,0 +1,10 @@ + diff --git a/src/routes/receive.svelte b/src/routes/receive.svelte index 760733a3..0329dea4 100644 --- a/src/routes/receive.svelte +++ b/src/routes/receive.svelte @@ -4,10 +4,6 @@ import { goto } from '$app/navigation'; import { invoiceAmount, invoiceAmountFiat, rate, user } from '$lib/store'; - if (!$user && typeof window !== 'undefined') { - window.location = '/login'; - } - let useFiat = true; let amountFiat = 0; let amountSats = 0; diff --git a/static/icons/logout.svg b/static/icons/logout.svg new file mode 100644 index 00000000..495d6574 --- /dev/null +++ b/static/icons/logout.svg @@ -0,0 +1,3 @@ + + + -- cgit v1.2.3 From 5bf4891768f1ee359ee5795272c289b40745aed5 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 30 Jul 2022 11:13:39 -0700 Subject: get invoice by uuid --- src/components/AppHeader.svelte | 4 +- src/components/RegisterOrLogin.svelte | 2 +- src/lib/utils.js | 5 + src/routes/[username].js | 3 - src/routes/[username].svelte | 27 --- src/routes/[username]/index.js | 3 + src/routes/[username]/index.svelte | 27 +++ src/routes/[username]/receive.svelte | 188 ++++++++++++++++++++ src/routes/__layout.svelte | 2 +- src/routes/invoice/[amount].js | 12 -- src/routes/invoice/[amount].svelte | 322 ---------------------------------- src/routes/invoice/[id].js | 11 ++ src/routes/invoice/[id].svelte | 322 ++++++++++++++++++++++++++++++++++ src/routes/invoice/index.js | 11 ++ src/routes/receive.svelte | 178 ------------------- 15 files changed, 572 insertions(+), 545 deletions(-) delete mode 100644 src/routes/[username].js delete mode 100644 src/routes/[username].svelte create mode 100644 src/routes/[username]/index.js create mode 100644 src/routes/[username]/index.svelte create mode 100644 src/routes/[username]/receive.svelte delete mode 100644 src/routes/invoice/[amount].js delete mode 100644 src/routes/invoice/[amount].svelte create mode 100644 src/routes/invoice/[id].js create mode 100644 src/routes/invoice/[id].svelte create mode 100644 src/routes/invoice/index.js delete mode 100644 src/routes/receive.svelte diff --git a/src/components/AppHeader.svelte b/src/components/AppHeader.svelte index b096f01e..99eea6d5 100644 --- a/src/components/AppHeader.svelte +++ b/src/components/AppHeader.svelte @@ -8,9 +8,11 @@
diff --git a/src/lib/socket.js b/src/lib/socket.js index 36d41ea8..c7c541e1 100644 --- a/src/lib/socket.js +++ b/src/lib/socket.js @@ -18,7 +18,7 @@ export const messages = (data) => ({ }, payment() { - console.log(data); + console.log(data, 'payment'); }, connected: auth, diff --git a/src/routes/[username]/customers.svelte b/src/routes/[username]/customers.svelte new file mode 100644 index 00000000..1935b156 --- /dev/null +++ b/src/routes/[username]/customers.svelte @@ -0,0 +1,5 @@ + + + diff --git a/src/routes/[username]/dashboard.svelte b/src/routes/[username]/dashboard.svelte new file mode 100644 index 00000000..1935b156 --- /dev/null +++ b/src/routes/[username]/dashboard.svelte @@ -0,0 +1,5 @@ + + + diff --git a/src/routes/[username]/settings.svelte b/src/routes/[username]/settings.svelte new file mode 100644 index 00000000..1935b156 --- /dev/null +++ b/src/routes/[username]/settings.svelte @@ -0,0 +1,5 @@ + + + diff --git a/src/routes/[username]/support.svelte b/src/routes/[username]/support.svelte new file mode 100644 index 00000000..1935b156 --- /dev/null +++ b/src/routes/[username]/support.svelte @@ -0,0 +1,5 @@ + + + diff --git a/src/routes/[username]/transactions.svelte b/src/routes/[username]/transactions.svelte new file mode 100644 index 00000000..1935b156 --- /dev/null +++ b/src/routes/[username]/transactions.svelte @@ -0,0 +1,5 @@ + + + diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index d26ccfed..736f38e8 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -18,7 +18,7 @@ if (protectedRoutes.find((p) => $page.url.pathname.match(p))) { if (!$token) { goto('/login'); - toast.push('Please login to continue.'); + toast.push('Please sign in to continue.'); } user.subscribe((u) => (ready = true)); } else { diff --git a/static/icons/customers.svg b/static/icons/customers.svg new file mode 100644 index 00000000..0b6081ba --- /dev/null +++ b/static/icons/customers.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/icons/dash.svg b/static/icons/dash.svg new file mode 100644 index 00000000..acb39ab9 --- /dev/null +++ b/static/icons/dash.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/icons/logout.svg b/static/icons/logout.svg index 495d6574..a614cfc0 100644 --- a/static/icons/logout.svg +++ b/static/icons/logout.svg @@ -1,3 +1,3 @@ - - + + diff --git a/static/icons/settings.svg b/static/icons/settings.svg new file mode 100644 index 00000000..2fac5bea --- /dev/null +++ b/static/icons/settings.svg @@ -0,0 +1,4 @@ + + + + diff --git a/static/icons/support.svg b/static/icons/support.svg new file mode 100644 index 00000000..47b935b5 --- /dev/null +++ b/static/icons/support.svg @@ -0,0 +1,3 @@ + + + -- cgit v1.2.3 From 27cbd543cece74228680d74f276eca89e13b557b Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Sat, 30 Jul 2022 20:45:19 -0600 Subject: add user public page --- src/components/AppHeader.svelte | 84 ++++++++++++++++++--------------- src/lib/utils.js | 4 ++ src/routes/[username]/index.svelte | 96 ++++++++++++++++++++++++++++++++------ src/routes/__layout.svelte | 11 ++++- static/icons/copy.svg | 3 ++ static/icons/minus.svg | 3 ++ static/icons/plus.svg | 3 ++ 7 files changed, 152 insertions(+), 52 deletions(-) create mode 100644 static/icons/copy.svg create mode 100644 static/icons/minus.svg create mode 100644 static/icons/plus.svg diff --git a/src/components/AppHeader.svelte b/src/components/AppHeader.svelte index 9f73adbf..d0123650 100644 --- a/src/components/AppHeader.svelte +++ b/src/components/AppHeader.svelte @@ -5,6 +5,8 @@ import { goto } from '$app/navigation'; import { Icon } from '$comp'; + export let avatarPosition = 'left-[calc(50vw-48px)]'; + const menuButtons = [ { title: 'Customers', icon: 'customers', goto: 'customers' }, { title: 'Dashboard', icon: 'dash', goto: 'dashboard' }, @@ -24,48 +26,54 @@ }; -
+
- -
-
    - {#each menuButtons as button} -
  • - -
  • - {/each} -
+ {#if $user} + + + + + + + + + +
+ +
+
    + {#each menuButtons as button} +
  • + +
  • + {/each} +
+
-
+ {:else} + + + + {/if}
diff --git a/src/lib/utils.js b/src/lib/utils.js index 22c88522..7831c519 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -17,3 +17,7 @@ export const post = (url, body) => body: JSON.stringify(body), headers: { accept: 'application/json', 'content-type': 'application/json' } }).then((r) => r.json()); + +export const copy = (text) => { + navigator.clipboard.writeText(text); +}; diff --git a/src/routes/[username]/index.svelte b/src/routes/[username]/index.svelte index 90d0c04a..a53b94cc 100644 --- a/src/routes/[username]/index.svelte +++ b/src/routes/[username]/index.svelte @@ -1,24 +1,94 @@ -{#if $user?.username === username} - -
-
-
- Signed in as {username} + +{#if username} + + +
+
+
+

{username}

+ +

Address goes here

+ +
-
- - - +
+
+
+
+ +

Scan to pay with Bitcoin

+ +
+ {lightning} + +
diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index 736f38e8..b2cb8aae 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -30,8 +30,17 @@ {#if ready} - + {:else} {/if} + + diff --git a/static/icons/copy.svg b/static/icons/copy.svg new file mode 100644 index 00000000..38b43e02 --- /dev/null +++ b/static/icons/copy.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/icons/minus.svg b/static/icons/minus.svg new file mode 100644 index 00000000..65450cf4 --- /dev/null +++ b/static/icons/minus.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/icons/plus.svg b/static/icons/plus.svg new file mode 100644 index 00000000..310c79d5 --- /dev/null +++ b/static/icons/plus.svg @@ -0,0 +1,3 @@ + + + -- cgit v1.2.3 From c5f0e9838ea1fc6d66026f139b955ea2ac181ef9 Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Sat, 30 Jul 2022 23:48:55 -0600 Subject: add about section to landing page --- src/components/About.svelte | 82 ++++++++++++++++++++++++++++++++++++++++++++ src/components/index.js | 1 + src/routes/index.svelte | 15 ++++++-- static/icons/github.svg | 3 ++ static/icons/twitter.svg | 3 ++ static/images/swoosh.png | Bin 0 -> 4382 bytes 6 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 src/components/About.svelte create mode 100644 static/icons/github.svg create mode 100644 static/icons/twitter.svg create mode 100644 static/images/swoosh.png diff --git a/src/components/About.svelte b/src/components/About.svelte new file mode 100644 index 00000000..eb8e9a82 --- /dev/null +++ b/src/components/About.svelte @@ -0,0 +1,82 @@ + + +
+

About

+
+

+ Coinos is an open source bitcoin web wallet, point of sale, ecommerce marketplace and exchange + platform. Development started in Vancouver in September 2012 as a way to provide local + merchants with a convenient way to accept bitcoin payments. +

+ The feature set has grown over the years to accomodate a wide variety of use cases with the goal + of making it as easy as possible for anyone to get started using Bitcoin quickly, cheaply, and + securely. +

+ Anyone can download the source code and host their own instance of the platform backed by their + own bitcoin, liquid or lightning nodes, or reach out and we'll gladly set this up for you. + +

+

+ Once signed in, you can create both custodial and non-custodial wallets within your account. + The default custodial wallet allows funds to be deposited on any of the bitcoin, liquid or + lightning networks and seamlessly withdrawn over any other network without any conversion + process or fee. +

+ Using a non-custodial wallet means keys are generated client-side in your browser so we never have + access to the funds. Transactions from these accounts are subject to on-chain transaction fees + and Lightning Network payments are not supported but we advise using this account type or a paper + wallet for storing larger amounts. +

+ Intra-account transfers between custodial wallets of different users on our server are completely + free, instant, and unlimited. +

+
+ +
+
+

The Founder

+ + + +
+ Adam Soltys + Chief Technical Officer +
+ +
+ + +
+
+ +
    +
  • Running Bitcoin since 2011
  • +
  • 20+ years web development experience in government and industry
  • +
  • Early Bitcoin Vancouver meetup organizer
  • +
  • Founder of The Bitcoin Co-op and early supporter of Decentral Vancouver
  • +
  • Yogi, permaculturist, anarchist, decentralist
  • +
  • Husband, father, brother, son
  • +
+
+
diff --git a/src/components/index.js b/src/components/index.js index 53f0fe99..afa4790c 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -9,3 +9,4 @@ export { default as RegisterOrLogin } from './RegisterOrLogin.svelte'; export { default as AppHeader } from './AppHeader.svelte'; export { default as LoadingSplash } from './LoadingSplash.svelte'; export { default as PageNotFound } from './404.svelte'; +export { default as About } from './About.svelte'; diff --git a/src/routes/index.svelte b/src/routes/index.svelte index cda885a3..5a9a0275 100644 --- a/src/routes/index.svelte +++ b/src/routes/index.svelte @@ -1,5 +1,13 @@ -
-

About

-
-

- Coinos is an open source bitcoin web wallet, point of sale, ecommerce marketplace and exchange - platform. Development started in Vancouver in September 2012 as a way to provide local - merchants with a convenient way to accept bitcoin payments. -

- The feature set has grown over the years to accomodate a wide variety of use cases with the goal - of making it as easy as possible for anyone to get started using Bitcoin quickly, cheaply, and - securely. -

- Anyone can download the source code and host their own instance of the platform backed by their - own bitcoin, liquid or lightning nodes, or reach out and we'll gladly set this up for you. - -

-

- Once signed in, you can create both custodial and non-custodial wallets within your account. - The default custodial wallet allows funds to be deposited on any of the bitcoin, liquid or - lightning networks and seamlessly withdrawn over any other network without any conversion - process or fee. -

- Using a non-custodial wallet means keys are generated client-side in your browser so we never have - access to the funds. Transactions from these accounts are subject to on-chain transaction fees - and Lightning Network payments are not supported but we advise using this account type or a paper - wallet for storing larger amounts. -

- Intra-account transfers between custodial wallets of different users on our server are completely - free, instant, and unlimited. -

-
- -
-
-

The Founder

+

About

+
+

+ Coinos is an open source bitcoin web wallet, point of sale, ecommerce marketplace and exchange + platform. Development started in Vancouver in September 2012 as a way to provide local merchants + with a convenient way to accept bitcoin payments. +

+ The feature set has grown over the years to accomodate a wide variety of use cases with the goal + of making it as easy as possible for anyone to get started using Bitcoin quickly, cheaply, and securely. +

+ Anyone can download the source code and host their own instance of the platform backed by their own + bitcoin, liquid or lightning nodes, or reach out and we'll gladly set this up for you. + +

+

+ Once signed in, you can create both custodial and non-custodial wallets within your account. The + default custodial wallet allows funds to be deposited on any of the bitcoin, liquid or lightning + networks and seamlessly withdrawn over any other network without any conversion process or fee. +

+ Using a non-custodial wallet means keys are generated client-side in your browser so we never have + access to the funds. Transactions from these accounts are subject to on-chain transaction fees and + Lightning Network payments are not supported but we advise using this account type or a paper wallet + for storing larger amounts. +

+ Intra-account transfers between custodial wallets of different users on our server are completely + free, instant, and unlimited. +

+
- +
+
+

The Founder

-
- Adam Soltys - Chief Technical Officer -
+ -
- - -
+
+ Adam Soltys + Chief Technical Officer
-
    -
  • Running Bitcoin since 2011
  • -
  • 20+ years web development experience in government and industry
  • -
  • Early Bitcoin Vancouver meetup organizer
  • -
  • Founder of The Bitcoin Co-op and early supporter of Decentral Vancouver
  • -
  • Yogi, permaculturist, anarchist, decentralist
  • -
  • Husband, father, brother, son
  • -
+
+ + +
+ +
    +
  • Running Bitcoin since 2011
  • +
  • 20+ years web development experience in government and industry
  • +
  • Early Bitcoin Vancouver meetup organizer
  • +
  • Founder of The Bitcoin Co-op and early supporter of Decentral Vancouver
  • +
  • Yogi, permaculturist, anarchist, decentralist
  • +
  • Husband, father, brother, son
  • +
diff --git a/src/components/LandingHeader.svelte b/src/components/LandingHeader.svelte index 927c8749..91443ba5 100644 --- a/src/components/LandingHeader.svelte +++ b/src/components/LandingHeader.svelte @@ -6,6 +6,7 @@ export let howItWorks; export let faq; + export let about;
@@ -17,7 +18,7 @@ - +
+ +
-- cgit v1.2.3 From f81e273613e95e89087badcc0cb5a9bd007e6d47 Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Sun, 31 Jul 2022 01:02:39 -0600 Subject: add footer and other refactoring --- src/components/About.svelte | 18 ++++++++++++------ src/components/Footer.svelte | 39 +++++++++++++++++++++++++++++++++++++++ src/components/index.js | 1 + src/routes/community.svelte | 0 src/routes/index.svelte | 5 ++++- src/routes/jobs.svelte | 0 static/icons/shield.svg | 15 +++++++++++++++ 7 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 src/components/Footer.svelte create mode 100644 src/routes/community.svelte create mode 100644 src/routes/jobs.svelte create mode 100644 static/icons/shield.svg diff --git a/src/components/About.svelte b/src/components/About.svelte index 0fdf5200..a5f4c274 100644 --- a/src/components/About.svelte +++ b/src/components/About.svelte @@ -1,5 +1,14 @@

About

@@ -68,11 +77,8 @@
    -
  • Running Bitcoin since 2011
  • -
  • 20+ years web development experience in government and industry
  • -
  • Early Bitcoin Vancouver meetup organizer
  • -
  • Founder of The Bitcoin Co-op and early supporter of Decentral Vancouver
  • -
  • Yogi, permaculturist, anarchist, decentralist
  • -
  • Husband, father, brother, son
  • + {#each aboutAdam as about} +
  • {about}
  • + {/each}
diff --git a/src/components/Footer.svelte b/src/components/Footer.svelte new file mode 100644 index 00000000..0c682179 --- /dev/null +++ b/src/components/Footer.svelte @@ -0,0 +1,39 @@ + + +
+ + +
+

Follow Us

+ +
+ +
+

Company

+ +
+ + +
diff --git a/src/components/index.js b/src/components/index.js index afa4790c..dade4c2c 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -10,3 +10,4 @@ export { default as AppHeader } from './AppHeader.svelte'; export { default as LoadingSplash } from './LoadingSplash.svelte'; export { default as PageNotFound } from './404.svelte'; export { default as About } from './About.svelte'; +export { default as Footer } from './Footer.svelte'; diff --git a/src/routes/community.svelte b/src/routes/community.svelte new file mode 100644 index 00000000..e69de29b diff --git a/src/routes/index.svelte b/src/routes/index.svelte index 2164c58b..c823f668 100644 --- a/src/routes/index.svelte +++ b/src/routes/index.svelte @@ -6,7 +6,8 @@ HowItWorksCard, FaqCard, Image, - About + About, + Footer } from '$comp'; let howItWorks; @@ -112,3 +113,5 @@
+ +
diff --git a/src/routes/jobs.svelte b/src/routes/jobs.svelte new file mode 100644 index 00000000..e69de29b diff --git a/static/icons/shield.svg b/static/icons/shield.svg new file mode 100644 index 00000000..feda9661 --- /dev/null +++ b/static/icons/shield.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + -- cgit v1.2.3 From 1d7a1f8c2f527f2d08e0ef4e4585563307d20355 Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Sun, 31 Jul 2022 01:04:53 -0600 Subject: update colors --- tailwind.config.cjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tailwind.config.cjs b/tailwind.config.cjs index 4be763a3..d8b7f6d4 100644 --- a/tailwind.config.cjs +++ b/tailwind.config.cjs @@ -5,9 +5,9 @@ module.exports = { extend: { colors: { primary: '#F5F7FA', - secondary: '#858A92', + secondary: '#70757E', gradient: '#C3CFE2', - lightgrey: '#eaecef' + lightgrey: '#EAECEF' } } }, -- cgit v1.2.3 From 166c4ec3dd7d279acc329f70a48791d8405ac0fc Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Sun, 31 Jul 2022 10:43:47 -0600 Subject: add account link to landing if you are logged in --- src/components/LandingHeader.svelte | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/LandingHeader.svelte b/src/components/LandingHeader.svelte index 91443ba5..a8d68462 100644 --- a/src/components/LandingHeader.svelte +++ b/src/components/LandingHeader.svelte @@ -21,8 +21,8 @@ {#if !$user} + >Start in Seconds + {:else} +
-- cgit v1.2.3 From 96a36294f143b38a2ba4f914df092b4ab85c62bb Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Sun, 31 Jul 2022 11:23:20 -0600 Subject: hide btn if logged in --- src/components/LandingHero.svelte | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/components/LandingHero.svelte b/src/components/LandingHero.svelte index 2c2e1ab5..8fe344d7 100644 --- a/src/components/LandingHero.svelte +++ b/src/components/LandingHero.svelte @@ -1,6 +1,7 @@
@@ -19,14 +20,16 @@ Grow your customer base and revenue by accepting Bitcoin with an easy-to-use and managed Point of Sale. No software or hardware required. -
- -
+ {#if !$user} +
+ +
+ {/if}
-- cgit v1.2.3 From 7ecf3258c259eb259d8dfb3c4a47d4ede82f5c56 Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Sun, 31 Jul 2022 13:41:15 -0600 Subject: add mobile menu to landing page and make header sticky --- src/components/LandingHeader.svelte | 66 +++++++++++++++++++++++++++++++++++-- src/components/LandingHero.svelte | 2 +- src/routes/index.svelte | 33 +++++++++++-------- static/icons/close.svg | 3 ++ 4 files changed, 88 insertions(+), 16 deletions(-) create mode 100644 static/icons/close.svg diff --git a/src/components/LandingHeader.svelte b/src/components/LandingHeader.svelte index a8d68462..65ea607c 100644 --- a/src/components/LandingHeader.svelte +++ b/src/components/LandingHeader.svelte @@ -7,14 +7,24 @@ export let howItWorks; export let faq; export let about; + + let showMobileMenu = false; + const mobileMenuButtonClick = (section) => { + showMobileMenu = false; + scroll(section); + }; -
+
+ + diff --git a/src/components/LandingHero.svelte b/src/components/LandingHero.svelte index 8fe344d7..93bea8c2 100644 --- a/src/components/LandingHero.svelte +++ b/src/components/LandingHero.svelte @@ -4,7 +4,7 @@ import { user } from '$lib/store'; -
+

-
+
@@ -82,14 +82,17 @@ - +
+ +
+
-
+

How it works

{/each}
+
-
-

FAQ

- {#each faqQuestions as question} - - {/each} +
+
+

FAQ

+ {#each faqQuestions as question} + + {/each} +
+
-
+
diff --git a/static/icons/close.svg b/static/icons/close.svg new file mode 100644 index 00000000..0fdb37c5 --- /dev/null +++ b/static/icons/close.svg @@ -0,0 +1,3 @@ + + + -- cgit v1.2.3 From a54d21b74afb4bfc55c48828a716b43acbbc7819 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 1 Aug 2022 10:51:56 -0700 Subject: catch registration errors --- src/components/RegisterOrLogin.svelte | 5 ++++- src/routes/register.js | 12 ++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/components/RegisterOrLogin.svelte b/src/components/RegisterOrLogin.svelte index cbaad236..2463f47f 100644 --- a/src/components/RegisterOrLogin.svelte +++ b/src/components/RegisterOrLogin.svelte @@ -18,12 +18,14 @@ }[page]; let submit = async () => { + console.log("HI") let r = await post(url, { username, password }); if (!r.token) r = await post('/login', { username, password }); $token = r.token; auth(); - user.subscribe(({ username }) => goto(`/${username}/receive`)); }; + + $: if ($user) goto(`/${username}/receive`);
@@ -40,6 +42,7 @@
+ Date: Mon, 1 Aug 2022 11:32:46 -0700 Subject: pass amount to lightning invoice endpoint --- src/routes/invoice/[id].svelte | 1 + src/routes/invoice/index.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routes/invoice/[id].svelte b/src/routes/invoice/[id].svelte index 05d4b9ee..d9b1540e 100644 --- a/src/routes/invoice/[id].svelte +++ b/src/routes/invoice/[id].svelte @@ -65,6 +65,7 @@ onMount(async () => { if (browser) { let { default: QRCodeStyling } = await import('qr-code-styling'); + console.log("text", text) const qrCode = new QRCodeStyling({ width: window.screen.width < 640 ? 250 : 300, type: 'svg', diff --git a/src/routes/invoice/index.js b/src/routes/invoice/index.js index f6b1f2cf..2bd95538 100644 --- a/src/routes/invoice/index.js +++ b/src/routes/invoice/index.js @@ -4,7 +4,7 @@ let network = 'lightning'; export async function POST({ request }) { let { amount, rate, username } = await request.json(); - let { text } = await post('/lightning/invoice'); + let { text } = await post('/lightning/invoice', { amount }); let { uuid: id } = await post('/invoice', { invoice: { amount, currency: 'USD', network, rate, text }, user: { username } -- cgit v1.2.3 From 44664658d460ba2bee41aa87dbbb3f81ef232402 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 1 Aug 2022 11:44:56 -0700 Subject: display qr on invoice page refresh --- src/routes/invoice/[id].svelte | 49 +++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/src/routes/invoice/[id].svelte b/src/routes/invoice/[id].svelte index d9b1540e..d5a39daa 100644 --- a/src/routes/invoice/[id].svelte +++ b/src/routes/invoice/[id].svelte @@ -10,6 +10,7 @@ $: amountFiat = parseFloat(((amount * rate) / 100000000).toFixed(2)); let tipPercent = 0; + let qr; $: tipAmount = customTipAmount ? customTipAmount < 0 @@ -62,29 +63,29 @@ customTipAmount = e.target.value; }; - onMount(async () => { - if (browser) { - let { default: QRCodeStyling } = await import('qr-code-styling'); - console.log("text", text) - const qrCode = new QRCodeStyling({ - width: window.screen.width < 640 ? 250 : 300, - type: 'svg', - data: text, - image: '/images/invoice.svg', - backgroundOptions: { - color: 'rgba(0, 0, 0, 0)' - }, - dotsOptions: { - type: 'rounded' - }, - imageOptions: { - hideBackgroundDots: false - } - }); - - qrCode.append(document.getElementById('qr')); - } - }); + $: init(browser && $user); + let init = async (ready) => { + if (!ready) return; + let { default: QRCodeStyling } = await import('qr-code-styling'); + console.log('text', text); + const qrCode = new QRCodeStyling({ + width: window.screen.width < 640 ? 250 : 300, + type: 'svg', + data: text, + image: '/images/invoice.svg', + backgroundOptions: { + color: 'rgba(0, 0, 0, 0)' + }, + dotsOptions: { + type: 'rounded' + }, + imageOptions: { + hideBackgroundDots: false + } + }); + + qrCode.append(qr); + }; let showMobileTip = false; @@ -222,7 +223,7 @@ >
Date: Mon, 1 Aug 2022 12:27:49 -0700 Subject: use canvas for qr code --- src/components/RegisterOrLogin.svelte | 3 +-- src/routes/invoice/[id].svelte | 15 +++------------ src/routes/register.js | 2 +- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/components/RegisterOrLogin.svelte b/src/components/RegisterOrLogin.svelte index 2463f47f..ae1948f5 100644 --- a/src/components/RegisterOrLogin.svelte +++ b/src/components/RegisterOrLogin.svelte @@ -18,7 +18,6 @@ }[page]; let submit = async () => { - console.log("HI") let r = await post(url, { username, password }); if (!r.token) r = await post('/login', { username, password }); $token = r.token; @@ -42,7 +41,7 @@
- + { if (!ready) return; let { default: QRCodeStyling } = await import('qr-code-styling'); - console.log('text', text); + const qrCode = new QRCodeStyling({ width: window.screen.width < 640 ? 250 : 300, - type: 'svg', + type: 'canvas', data: text, image: '/images/invoice.svg', backgroundOptions: { @@ -102,9 +102,6 @@ }; let customInput; - - let qrSkeleton = true; - setTimeout(() => (qrSkeleton = false), 1000); {#if $user} @@ -227,13 +224,7 @@ class="border {showMobileTip ? 'border-gray-400' : 'border-lightgrey'} rounded-3xl block md:flex md:p-5 justify-center items-center h-[300px] md:h-[342px] w-[250px] md:w-[342px] relative" - > -
-
+ />
diff --git a/src/routes/register.js b/src/routes/register.js index 86f12dda..1bb03ba6 100644 --- a/src/routes/register.js +++ b/src/routes/register.js @@ -8,7 +8,7 @@ export async function POST({ request }) { } catch (e) { return { status: 500, - body: e, + body: e }; } } -- cgit v1.2.3 From e65a8cfbf13a1ddf1a9aa7bde5438fc2f4b70b51 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 1 Aug 2022 13:27:45 -0700 Subject: check username exists --- src/lib/utils.js | 8 +++++++- src/routes/[username]/index.js | 13 ++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/lib/utils.js b/src/lib/utils.js index 7831c519..38f2a010 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -9,7 +9,13 @@ const base = browser ? '' : import.meta.env.VITE_COINOS_URL; export const get = (url) => fetch(base + url, { headers: { accept: 'application/json' } - }).then((r) => r.json()); + }).then((r) => r.text()).then((body) => { + try { + return JSON.parse(body); + } catch(e) { + throw Error(body); + } + }) export const post = (url, body) => fetch(base + url, { diff --git a/src/routes/[username]/index.js b/src/routes/[username]/index.js index 01613574..5229cc50 100644 --- a/src/routes/[username]/index.js +++ b/src/routes/[username]/index.js @@ -1,3 +1,14 @@ +import { get } from '$lib/utils'; + export async function GET({ params }) { - return { body: params }; + let { username } = params; + let body; + + try { + body = await get(`/users/${username}`); + } catch(e) { + body = {}; + } + + return { body }; } -- cgit v1.2.3 From 5428fdf82a4260fa4f5e0bcdb722d6716740d8bf Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 1 Aug 2022 20:50:16 -0700 Subject: update invoice when tip changes --- src/lib/utils.js | 25 +++- src/routes/invoice/[id].js | 9 +- src/routes/invoice/[id].svelte | 282 ++++++++++++++++++++++------------------- src/routes/invoice/index.js | 4 +- 4 files changed, 173 insertions(+), 147 deletions(-) diff --git a/src/lib/utils.js b/src/lib/utils.js index 38f2a010..b80a548b 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -9,13 +9,15 @@ const base = browser ? '' : import.meta.env.VITE_COINOS_URL; export const get = (url) => fetch(base + url, { headers: { accept: 'application/json' } - }).then((r) => r.text()).then((body) => { - try { - return JSON.parse(body); - } catch(e) { - throw Error(body); - } - }) + }) + .then((r) => r.text()) + .then((body) => { + try { + return JSON.parse(body); + } catch (e) { + throw Error(body); + } + }); export const post = (url, body) => fetch(base + url, { @@ -27,3 +29,12 @@ export const post = (url, body) => export const copy = (text) => { navigator.clipboard.writeText(text); }; + +export function reverseFormat(val, locale) { + let parts = new Intl.NumberFormat(locale).formatToParts(1111.1); + let group = parts.find((part) => part.type === 'group').value; + let decimal = parts.find((part) => part.type === 'decimal').value; + let reversedVal = val.replace(new RegExp('\\' + group, 'g'), ''); + reversedVal = reversedVal.replace(new RegExp('\\' + decimal, 'g'), '.'); + return Number.isNaN(reversedVal) ? 0 : +reversedVal; +} diff --git a/src/routes/invoice/[id].js b/src/routes/invoice/[id].js index 9a38604f..514e5d69 100644 --- a/src/routes/invoice/[id].js +++ b/src/routes/invoice/[id].js @@ -1,12 +1,9 @@ import { get } from '$lib/utils'; -const username = 'bob', - network = 'lightning'; - export async function GET({ params }) { let { id } = params; - let huh = await get(`/invoice?uuid=${id}`); - let { amount, rate, text } = await get(`/invoice?uuid=${id}`); + let res = await get(`/invoice?uuid=${id}`); + let { amount, rate, text, user: { username }} = await get(`/invoice?uuid=${id}`); - return { body: { amount, rate, text } }; + return { body: { amount, rate, username, text } }; } diff --git a/src/routes/invoice/[id].svelte b/src/routes/invoice/[id].svelte index 1f1a7aa3..0f5a1437 100644 --- a/src/routes/invoice/[id].svelte +++ b/src/routes/invoice/[id].svelte @@ -1,11 +1,16 @@ -{#if $user} -
+
+ {#if $user} + {/if} -
+
+
+
- -
-

Add a tip?

+

Add a tip?

+ +
+ {tipAmountFormatted}{`(${tipAmountSats} SATS)`} + {tipPercent}% +
+ + { + customTipAmount = ''; + tipPercent = e.target.value; + }} + /> -
- {tipAmountFormatted}{`(${tipAmountSats} SATS)`} + {#each tipAmounts as amount} + - {tipPercent}% -
+ {/each} - { - customTipAmount = ''; - tipPercent = e.target.value; - }} - /> - -
- {#each tipAmounts as amount} - - {/each} - -
- $ - handleCustomTipAmount(e)} - class="bg-primary rounded-2xl py-3 px-10 font-semibold mt-2 mr-1 w-full md:w-auto" - placeholder="Other" - /> - -
+ : 'opacity-100' + : !customTipAmount + ? 'opacity-50' + : 'opacity-100'}" + disabled={showMobileTip ? !customTipAmount && !tipAmount : !customTipAmount} + on:click={() => (showMobileTip = false)}>Done
+
+ +