diff --git a/backend/app.js b/backend/app.js index 960c65e..cecf6b4 100644 --- a/backend/app.js +++ b/backend/app.js @@ -3,6 +3,8 @@ const bodyparser = require('body-parser'); const app = express(); const postmodel = require('./models/post'); const usermodel = require('./models/user'); +const ownermodel = require('./models/owner'); +const itemmodel = require('./models/item'); const mongoose = require('mongoose'); const stdrpc = require('stdrpc'); //const RequestIP = require('@supercharge/request-ip'); @@ -54,7 +56,15 @@ app.get('/api/posts', (req, res, next) => { }); }); +/* + * Add a new user + * @param address: String. Shielded zcash address + * @param session: String. Browser session uuid + * @param blocktime: Number. Blocktime of login zcash transaction + */ + app.post('/api/users', (req, res, next) => { + console.log('Post: /api/users'); const user = new usermodel({ address: req.body.address, session: req.body.session, @@ -67,7 +77,7 @@ app.post('/api/users', (req, res, next) => { }); app.get('/api/users', (req, res, next) => { - //console.log(req.query); + console.log('Get: /api/users'); usermodel.find({'address': req.query.address, 'session': req.query.session}). then((documents) => { console.log("Searching"); @@ -79,6 +89,7 @@ app.get('/api/users', (req, res, next) => { }); app.get('/api/getuser', (req, res, next) => { + console.log('Get: /api/getuser/', req.query.session); usermodel.find({'session': req.query.session}). then((documents) => { console.log("Searching for user..."); @@ -98,6 +109,7 @@ app.get('/api/getuser', (req, res, next) => { }); app.get('/api/blockheight', (req, res, next) => { + console.log('Get: /api/blockheight'); rpc.getblock("-1", 1).then(block => { res.status(200).json({ message: 'Found block', @@ -106,7 +118,9 @@ app.get('/api/blockheight', (req, res, next) => { }); }); + app.get('/api/txs', (req, res, next) => { + console.log('Get: /api/txs'); rpc.z_listreceivedbyaddress(fullnode.addr, 5).then(txs => { res.status(200).json({ message: 'Transactions found', @@ -116,10 +130,50 @@ app.get('/api/txs', (req, res, next) => { }); app.get('/api/getaddr', (req, res, next) => { + console.log('Get: /api/getaddr'); res.status(200).json({ message: 'Sending address', addr: fullnode.addr }); }); +app.get('/api/getowner', (req, res, next) => { + console.log('Get: /api/getowner'); + ownermodel.find({'address': req.query.address}).then((documents) => { + if(documents.length > 0){ + //console.log(documents); + res.status(200).json({ + message: 'Owner found!', + owner: documents + }); + } else { + res.status(204).json({ + message: 'Owner not found!', + owner: null + }); + } + }); + +}); + +app.post('/api/addowner', (req, res, next) => { + console.log('Post: /api/addowner'); + const owner = new ownermodel(req.body); + owner.save(); + res.status(201).json({ + message: 'Owner added successfully' + }); +}); + +app.post('/api/addownername', (req, res, next) => { + console.log('Post: /api/addownername'); + const owner = ownermodel.findOne({address: req.body.address}); + + owner.name = req.body.name; + owner.save(); + res.status(201).json({ + message: 'Ownername added successfully' + }); +}); + module.exports = app; diff --git a/backend/models/item.js b/backend/models/item.js new file mode 100644 index 0000000..2333d22 --- /dev/null +++ b/backend/models/item.js @@ -0,0 +1,10 @@ +const mongoose = require('mongoose'); + +const userSchema = mongoose.Schema({ + name: {type: String, required: true}, + description: {type: String, required: true}, + user: {type: String, required: true}, + cost: {type: Number, required: true} +}); + +module.exports = mongoose.model('Item', userSchema); diff --git a/backend/models/owner.js b/backend/models/owner.js new file mode 100644 index 0000000..38fac2e --- /dev/null +++ b/backend/models/owner.js @@ -0,0 +1,8 @@ +const mongoose = require('mongoose'); + +const ownerSchema = mongoose.Schema({ + address: {type: String, required:true}, + name: {type: String, required:true} +}); + +module.exports = mongoose.model('Owner', ownerSchema); diff --git a/package-lock.json b/package-lock.json index 280b6eb..7b2e722 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,6 @@ "@supercharge/request-ip": "^1.1.2", "angular-local-storage": "^0.7.1", "easyqrcodejs": "^4.4.6", - "qrcode-with-logos": "^1.0.3", "rxjs": "~6.6.0", "tslib": "^2.3.0", "urlsafe-base64": "^1.0.0", @@ -311,9 +310,9 @@ } }, "node_modules/@angular/cdk": { - "version": "12.2.8", - "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-12.2.8.tgz", - "integrity": "sha512-M0Y61o0yEVLMg+DSNsaDgiOifAV6OdumTgt2/kNoSuauPRWS0bkZJE58k3LR+cPi1Cho3UXELMKMOXZN9AhofA==", + "version": "12.2.11", + "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-12.2.11.tgz", + "integrity": "sha512-GgBB3NdVSv6RnDDOMspeLGg3uCbbmWIEIQ9VIqT5TWXWnljd2EANOQWdLu+fkmRzJn66FFdlTtJ6rHYoY/oBkA==", "dependencies": { "tslib": "^2.2.0" }, @@ -568,15 +567,15 @@ } }, "node_modules/@angular/material": { - "version": "12.2.8", - "resolved": "https://registry.npmjs.org/@angular/material/-/material-12.2.8.tgz", - "integrity": "sha512-wRTaTZIGC9+2e8aft44V9Qqwp3PsR9AG0FeJ0spl8mdOlYEqMMyoRXjvMiWIjo2ywxHLoQgLXXsWn3ip2xnnVg==", + "version": "12.2.11", + "resolved": "https://registry.npmjs.org/@angular/material/-/material-12.2.11.tgz", + "integrity": "sha512-3SIraessvZRfUgUA9LsJ0OUmvdm0ePj4v81l5uMRF9uUMVoM6OrW8MmIMzS1vAoHz9bpDakx5Xz3yqgZGco5Zw==", "dependencies": { "tslib": "^2.2.0" }, "peerDependencies": { "@angular/animations": "^12.0.0 || ^13.0.0-0", - "@angular/cdk": "12.2.8", + "@angular/cdk": "12.2.11", "@angular/common": "^12.0.0 || ^13.0.0-0", "@angular/core": "^12.0.0 || ^13.0.0-0", "@angular/forms": "^12.0.0 || ^13.0.0-0", @@ -3101,6 +3100,7 @@ "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, "dependencies": { "color-convert": "^1.9.0" }, @@ -3539,6 +3539,7 @@ "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, "funding": [ { "type": "github", @@ -3721,6 +3722,7 @@ "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, "funding": [ { "type": "github", @@ -3740,29 +3742,11 @@ "ieee754": "^1.1.13" } }, - "node_modules/buffer-alloc": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", - "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", - "dependencies": { - "buffer-alloc-unsafe": "^1.1.0", - "buffer-fill": "^1.0.0" - } - }, - "node_modules/buffer-alloc-unsafe": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", - "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" - }, - "node_modules/buffer-fill": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", - "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=" - }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true }, "node_modules/buffer-indexof": { "version": "1.1.1", @@ -3859,6 +3843,7 @@ "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, "engines": { "node": ">=6" } @@ -4053,6 +4038,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, "dependencies": { "string-width": "^3.1.0", "strip-ansi": "^5.2.0", @@ -4063,6 +4049,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true, "engines": { "node": ">=6" } @@ -4070,12 +4057,14 @@ "node_modules/cliui/node_modules/emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true }, "node_modules/cliui/node_modules/is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true, "engines": { "node": ">=4" } @@ -4084,6 +4073,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, "dependencies": { "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", @@ -4097,6 +4087,7 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, "dependencies": { "ansi-regex": "^4.1.0" }, @@ -4153,6 +4144,7 @@ "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, "dependencies": { "color-name": "1.1.3" } @@ -4160,7 +4152,8 @@ "node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true }, "node_modules/colord": { "version": "2.8.0", @@ -5197,6 +5190,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -5448,11 +5442,6 @@ "integrity": "sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw=", "dev": true }, - "node_modules/dijkstrajs": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.2.tgz", - "integrity": "sha512-QV6PMaHTCNmKSeP6QoXhVTw9snc9VD8MulTT0Bd99Pacp4SS1cjcrYPgBPmibqKVtMJJfqC6XvOXgPMEEPH/fg==" - }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -6552,6 +6541,7 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, "engines": { "node": "6.* || 8.* || >= 10.*" } @@ -7187,6 +7177,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, "funding": [ { "type": "github", @@ -9965,6 +9956,7 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, "dependencies": { "p-try": "^2.0.0" }, @@ -10018,6 +10010,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, "engines": { "node": ">=6" } @@ -10286,14 +10279,6 @@ "node": ">=8" } }, - "node_modules/pngjs": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", - "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==", - "engines": { - "node": ">=4.0.0" - } - }, "node_modules/portfinder": { "version": "1.0.28", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz", @@ -12246,39 +12231,6 @@ "node": ">=0.9" } }, - "node_modules/qrcode": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.4.4.tgz", - "integrity": "sha512-oLzEC5+NKFou9P0bMj5+v6Z40evexeE29Z9cummZXZ9QXyMr3lphkURzxjXgPJC5azpxcshoDWV1xE46z+/c3Q==", - "dependencies": { - "buffer": "^5.4.3", - "buffer-alloc": "^1.2.0", - "buffer-from": "^1.1.1", - "dijkstrajs": "^1.0.1", - "isarray": "^2.0.1", - "pngjs": "^3.3.0", - "yargs": "^13.2.4" - }, - "bin": { - "qrcode": "bin/qrcode" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/qrcode-with-logos": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/qrcode-with-logos/-/qrcode-with-logos-1.0.3.tgz", - "integrity": "sha512-I0LkEyHsWpzObpvbj4jc93rj/+57DdshAd3c7xzh9Gms6bJ5A30ApFY0ZCHOVlF4Bqm2d9kFUV9oFCBkHORqOg==", - "dependencies": { - "qrcode": "^1.4.4" - } - }, - "node_modules/qrcode/node_modules/isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" - }, "node_modules/qs": { "version": "6.7.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", @@ -12620,6 +12572,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -12636,7 +12589,8 @@ "node_modules/require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true }, "node_modules/requires-port": { "version": "1.0.0", @@ -13136,7 +13090,8 @@ "node_modules/set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true }, "node_modules/set-value": { "version": "2.0.1", @@ -15358,7 +15313,8 @@ "node_modules/which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true }, "node_modules/wide-align": { "version": "1.1.3", @@ -15422,6 +15378,7 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, "dependencies": { "ansi-styles": "^3.2.0", "string-width": "^3.0.0", @@ -15435,6 +15392,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true, "engines": { "node": ">=6" } @@ -15442,12 +15400,14 @@ "node_modules/wrap-ansi/node_modules/emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true }, "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true, "engines": { "node": ">=4" } @@ -15456,6 +15416,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, "dependencies": { "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", @@ -15469,6 +15430,7 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, "dependencies": { "ansi-regex": "^4.1.0" }, @@ -15494,7 +15456,8 @@ "node_modules/y18n": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", - "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==" + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", + "dev": true }, "node_modules/yallist": { "version": "4.0.0", @@ -15515,6 +15478,7 @@ "version": "13.3.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "dev": true, "dependencies": { "cliui": "^5.0.0", "find-up": "^3.0.0", @@ -15532,6 +15496,7 @@ "version": "13.1.2", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "dev": true, "dependencies": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" @@ -15541,6 +15506,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true, "engines": { "node": ">=6" } @@ -15548,12 +15514,14 @@ "node_modules/yargs/node_modules/emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true }, "node_modules/yargs/node_modules/find-up": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, "dependencies": { "locate-path": "^3.0.0" }, @@ -15565,6 +15533,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true, "engines": { "node": ">=4" } @@ -15573,6 +15542,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, "dependencies": { "p-locate": "^3.0.0", "path-exists": "^3.0.0" @@ -15585,6 +15555,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, "dependencies": { "p-limit": "^2.0.0" }, @@ -15596,6 +15567,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true, "engines": { "node": ">=4" } @@ -15604,6 +15576,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, "dependencies": { "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", @@ -15617,6 +15590,7 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, "dependencies": { "ansi-regex": "^4.1.0" }, @@ -15822,9 +15796,9 @@ } }, "@angular/cdk": { - "version": "12.2.8", - "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-12.2.8.tgz", - "integrity": "sha512-M0Y61o0yEVLMg+DSNsaDgiOifAV6OdumTgt2/kNoSuauPRWS0bkZJE58k3LR+cPi1Cho3UXELMKMOXZN9AhofA==", + "version": "12.2.11", + "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-12.2.11.tgz", + "integrity": "sha512-GgBB3NdVSv6RnDDOMspeLGg3uCbbmWIEIQ9VIqT5TWXWnljd2EANOQWdLu+fkmRzJn66FFdlTtJ6rHYoY/oBkA==", "requires": { "parse5": "^5.0.0", "tslib": "^2.2.0" @@ -16001,9 +15975,9 @@ } }, "@angular/material": { - "version": "12.2.8", - "resolved": "https://registry.npmjs.org/@angular/material/-/material-12.2.8.tgz", - "integrity": "sha512-wRTaTZIGC9+2e8aft44V9Qqwp3PsR9AG0FeJ0spl8mdOlYEqMMyoRXjvMiWIjo2ywxHLoQgLXXsWn3ip2xnnVg==", + "version": "12.2.11", + "resolved": "https://registry.npmjs.org/@angular/material/-/material-12.2.11.tgz", + "integrity": "sha512-3SIraessvZRfUgUA9LsJ0OUmvdm0ePj4v81l5uMRF9uUMVoM6OrW8MmIMzS1vAoHz9bpDakx5Xz3yqgZGco5Zw==", "requires": { "tslib": "^2.2.0" } @@ -17890,6 +17864,7 @@ "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, "requires": { "color-convert": "^1.9.0" } @@ -18238,7 +18213,8 @@ "base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true }, "base64id": { "version": "2.0.0", @@ -18381,34 +18357,17 @@ "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, "requires": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, - "buffer-alloc": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", - "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", - "requires": { - "buffer-alloc-unsafe": "^1.1.0", - "buffer-fill": "^1.0.0" - } - }, - "buffer-alloc-unsafe": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", - "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" - }, - "buffer-fill": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", - "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=" - }, "buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true }, "buffer-indexof": { "version": "1.1.1", @@ -18489,7 +18448,8 @@ "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true }, "caniuse-api": { "version": "3.0.0", @@ -18638,6 +18598,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, "requires": { "string-width": "^3.1.0", "strip-ansi": "^5.2.0", @@ -18647,22 +18608,26 @@ "ansi-regex": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true }, "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true }, "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true }, "string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, "requires": { "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", @@ -18673,6 +18638,7 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, "requires": { "ansi-regex": "^4.1.0" } @@ -18716,6 +18682,7 @@ "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, "requires": { "color-name": "1.1.3" } @@ -18723,7 +18690,8 @@ "color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true }, "colord": { "version": "2.8.0", @@ -19501,7 +19469,8 @@ "decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true }, "decode-uri-component": { "version": "0.2.0", @@ -19702,11 +19671,6 @@ "integrity": "sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw=", "dev": true }, - "dijkstrajs": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.2.tgz", - "integrity": "sha512-QV6PMaHTCNmKSeP6QoXhVTw9snc9VD8MulTT0Bd99Pacp4SS1cjcrYPgBPmibqKVtMJJfqC6XvOXgPMEEPH/fg==" - }, "dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -20588,7 +20552,8 @@ "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true }, "get-intrinsic": { "version": "1.1.1", @@ -21113,7 +21078,8 @@ "ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true }, "ignore": { "version": "5.1.8", @@ -23230,6 +23196,7 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, "requires": { "p-try": "^2.0.0" } @@ -23264,7 +23231,8 @@ "p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true }, "pacote": { "version": "11.3.5", @@ -23474,11 +23442,6 @@ "find-up": "^4.0.0" } }, - "pngjs": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", - "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==" - }, "portfinder": { "version": "1.0.28", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz", @@ -24863,35 +24826,6 @@ "integrity": "sha512-8YOJEHtxpySA3fFDyCRxA+UUV+fA+rTWnuWvylOK/NCjhY+b4ocCtmu8TtsWb+mYeU+GCHf/S66KZF/AsteKHg==", "dev": true }, - "qrcode": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.4.4.tgz", - "integrity": "sha512-oLzEC5+NKFou9P0bMj5+v6Z40evexeE29Z9cummZXZ9QXyMr3lphkURzxjXgPJC5azpxcshoDWV1xE46z+/c3Q==", - "requires": { - "buffer": "^5.4.3", - "buffer-alloc": "^1.2.0", - "buffer-from": "^1.1.1", - "dijkstrajs": "^1.0.1", - "isarray": "^2.0.1", - "pngjs": "^3.3.0", - "yargs": "^13.2.4" - }, - "dependencies": { - "isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" - } - } - }, - "qrcode-with-logos": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/qrcode-with-logos/-/qrcode-with-logos-1.0.3.tgz", - "integrity": "sha512-I0LkEyHsWpzObpvbj4jc93rj/+57DdshAd3c7xzh9Gms6bJ5A30ApFY0ZCHOVlF4Bqm2d9kFUV9oFCBkHORqOg==", - "requires": { - "qrcode": "^1.4.4" - } - }, "qs": { "version": "6.7.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", @@ -25160,7 +25094,8 @@ "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true }, "require-from-string": { "version": "2.0.2", @@ -25171,7 +25106,8 @@ "require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true }, "requires-port": { "version": "1.0.0", @@ -25549,7 +25485,8 @@ "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true }, "set-value": { "version": "2.0.1", @@ -27286,7 +27223,8 @@ "which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true }, "wide-align": { "version": "1.1.3", @@ -27340,6 +27278,7 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, "requires": { "ansi-styles": "^3.2.0", "string-width": "^3.0.0", @@ -27349,22 +27288,26 @@ "ansi-regex": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true }, "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true }, "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true }, "string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, "requires": { "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", @@ -27375,6 +27318,7 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, "requires": { "ansi-regex": "^4.1.0" } @@ -27399,7 +27343,8 @@ "y18n": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", - "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==" + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", + "dev": true }, "yallist": { "version": "4.0.0", @@ -27417,6 +27362,7 @@ "version": "13.3.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "dev": true, "requires": { "cliui": "^5.0.0", "find-up": "^3.0.0", @@ -27433,17 +27379,20 @@ "ansi-regex": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true }, "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true }, "find-up": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, "requires": { "locate-path": "^3.0.0" } @@ -27451,12 +27400,14 @@ "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true }, "locate-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, "requires": { "p-locate": "^3.0.0", "path-exists": "^3.0.0" @@ -27466,6 +27417,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, "requires": { "p-limit": "^2.0.0" } @@ -27473,12 +27425,14 @@ "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true }, "string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, "requires": { "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", @@ -27489,6 +27443,7 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, "requires": { "ansi-regex": "^4.1.0" } @@ -27499,6 +27454,7 @@ "version": "13.1.2", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "dev": true, "requires": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index c107708..5174696 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,15 +1,13 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; -import { PostCreateComponent } from './posts/post-create/post-create.component'; -import { PostListComponent } from './posts/post-list/post-list.component'; import { ViewerComponent } from './viewer/viewer.component'; import { LoginComponent } from './login/login.component'; import { AuthGuardService } from './auth-guard.service'; const routes: Routes = [ { path: '', component: LoginComponent }, - { path: 'create', component: PostCreateComponent, canActivate: [AuthGuardService]}, - { path: 'view', component: PostListComponent, canActivate: [AuthGuardService]}, + //{ path: 'create', component: PostCreateComponent, canActivate: [AuthGuardService]}, + { path: 'view', component: ViewerComponent, canActivate: [AuthGuardService]}, { path: 'login', component: LoginComponent} ]; diff --git a/src/app/app.component.html b/src/app/app.component.html index dc65a8b..54165cd 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,4 +1,3 @@ - diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 06cf04a..8dad2f4 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,5 +1,5 @@ import { Component } from '@angular/core'; -import { Post} from './posts/post.model'; +//import { Post} from './posts/post.model'; @Component({ selector: 'app-root', diff --git a/src/app/app.module.ts b/src/app/app.module.ts index e474973..43c0765 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -7,25 +7,28 @@ import { MatButtonModule } from '@angular/material/button'; import { MatToolbarModule } from '@angular/material/toolbar'; import { MatExpansionModule } from '@angular/material/expansion'; import { HttpClientModule } from '@angular/common/http'; +import { MatDialogModule } from '@angular/material/dialog'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; -import { PostCreateComponent } from './posts/post-create/post-create.component'; -import { HeaderComponent } from './header/header.component'; -import { PostListComponent } from './posts/post-list/post-list.component'; -import { PostService } from './posts/posts.service'; -import { ViewerComponent } from './viewer/viewer.component'; +//import { PostCreateComponent } from './posts/post-create/post-create.component'; +//import { HeaderComponent } from './header/header.component'; +//import { PostListComponent } from './posts/post-list/post-list.component'; +//import { PostService } from './posts/posts.service'; +//import { ViewerComponent } from './viewer/viewer.component'; import { LoginComponent } from './login/login.component'; +//import { NameDialogComponent } from './namedialog/namedialog.component'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; @NgModule({ declarations: [ AppComponent, - PostCreateComponent, - HeaderComponent, - ViewerComponent, + //PostCreateComponent, + //HeaderComponent, + //ViewerComponent, LoginComponent, - PostListComponent + //NameDialogComponent, + //PostListComponent ], imports: [ BrowserModule, @@ -37,9 +40,11 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; MatButtonModule, MatToolbarModule, MatExpansionModule, + MatDialogModule, BrowserAnimationsModule ], providers: [], - bootstrap: [AppComponent] + bootstrap: [AppComponent]//, + //entryComponents: [NameDialogComponent] }) export class AppModule { } diff --git a/src/app/fullnode.service.ts b/src/app/fullnode.service.ts index a362ebf..359085c 100644 --- a/src/app/fullnode.service.ts +++ b/src/app/fullnode.service.ts @@ -1,5 +1,5 @@ import {Injectable} from '@angular/core'; -import {Subject} from 'rxjs'; +import {Subject, Subscription, BehaviorSubject, Observable} from 'rxjs'; import {HttpClient, HttpParams} from '@angular/common/http'; import {UserService} from './user.service'; @@ -9,25 +9,31 @@ import {UserService} from './user.service'; export class FullnodeService{ private height = 0; private memoList: string[] = []; - private addr: string = ''; - private heightUpdated = new Subject(); - private memoUpdated = new Subject(); - private addrUpdated = new Subject(); + private addr: string = ''; + private _heightUpdated: BehaviorSubject = new BehaviorSubject(this.height); + private _memoUpdated: BehaviorSubject = new BehaviorSubject(this.memoList); + private _addrUpdated: BehaviorSubject = new BehaviorSubject(this.addr); + public readonly addrUpdate: Observable = this._addrUpdated.asObservable(); + public readonly heightUpdate: Observable = this._heightUpdated.asObservable(); + public readonly memoUpdate: Observable = this._memoUpdated.asObservable(); + private UserSub: Subscription = new Subscription(); constructor(private http: HttpClient, public userService: UserService){ } - getHeight() { - this.http.get<{message: string, height: number}>('http://localhost:3000/api/blockheight'). - subscribe((BlockData) => { + getHeight(){ + let obs = this.http.get<{message: string, height: number}>('http://localhost:3000/api/blockheight'); + obs.subscribe((BlockData) => { this.height = BlockData.height; - this.heightUpdated.next(this.height); + this._heightUpdated.next(this.height); }); + + return obs; } - getHeightUpdateListener() { - return this.heightUpdated; - } + //getHeightUpdateListener() { + //return this.heightUpdated; + //} hexToString(hexString: string) { var str = ''; @@ -53,38 +59,40 @@ export class FullnodeService{ var address = match[2]; var session = match[1]; var blocktime = TxData.txs[i].blocktime; - const params = new HttpParams().append('address', address).append('session', session); - this.http.get<{message: string, users: any}>('http://localhost:3000/api/users', {headers:{}, params: params}). - subscribe((UserData) => { - console.log(UserData.message); - console.log(UserData.users.length); - if (UserData.users.length == 0){ - console.log(`No matching user found! Adding ${address} ${session} ${blocktime}`); + console.log(memo); + console.log(`Searching for user for ${session}`); + this.userService.getUser(session); + this.UserSub = this.userService.getZaddrUpdateListener(). + subscribe((zAddr) => { + if (zAddr.length == 0) { + console.log('FS: getMemos new adding user'); this.userService.addUser(address, session, blocktime); + } else { + console.log('FS: getMemos found user'); } }); } } } this.memoList = memos; - this.memoUpdated.next(this.memoList); + this._memoUpdated.next(this.memoList); }); } - getMemoUpdateListener() { - return this.memoUpdated; - } + //getMemoUpdateListener() { + //return this.memoUpdated; + //} getAddr() { this.http.get<{message: string, addr: string}>('http://localhost:3000/api/getaddr'). subscribe((AddrData) => { this.addr = AddrData.addr; - this.addrUpdated.next(this.addr); + this._addrUpdated.next(this.addr); }); } - getAddrUpdateListener() { - return this.addrUpdated; - } + //getAddrUpdateListener() { + //return this.addrUpdated; + //} } diff --git a/src/app/header/header.component.css b/src/app/header/header.component.css index 8aa1a3c..41057db 100644 --- a/src/app/header/header.component.css +++ b/src/app/header/header.component.css @@ -1,3 +1,7 @@ +* { + font-family: 'Roboto Mono', monospace; +} + a{ text-decoration: none; color: white; diff --git a/src/app/header/header.component.html b/src/app/header/header.component.html index 8cf8430..7bd7184 100644 --- a/src/app/header/header.component.html +++ b/src/app/header/header.component.html @@ -5,6 +5,9 @@ + + testy + Viewer diff --git a/src/app/header/header.component.ts b/src/app/header/header.component.ts index 41b1975..4431f26 100644 --- a/src/app/header/header.component.ts +++ b/src/app/header/header.component.ts @@ -1,27 +1,45 @@ -import { Component, OnInit } from '@angular/core'; +import {Component, OnInit, OnDestroy} from '@angular/core'; import {FullnodeService} from '../fullnode.service'; +import { UserService } from '../user.service'; import {Subscription} from 'rxjs'; +import {Owner} from '../owner.model'; + @Component({ selector: 'app-header', templateUrl: './header.component.html', styleUrls: ['./header.component.css'] }) -export class HeaderComponent implements OnInit { +export class HeaderComponent implements OnInit, OnDestroy { - height = 0; - private FullnodeSub: Subscription = new Subscription(); - constructor(public fullnodeService: FullnodeService){ + public height = 0; + private owner: Owner= {_id:'', address: 'none', name:''}; + private session: string | null = ''; + //private FullnodeSub: Subscription = new Subscription(); + private UserSub: Subscription = new Subscription(); + constructor( + public fullnodeService: FullnodeService, + public userService: UserService + ){ } ngOnInit(){ this.fullnodeService.getHeight(); - this.FullnodeSub=this.fullnodeService.getHeightUpdateListener(). - subscribe((height: number) => { - this.height = height; - }); + this.height = this.fullnodeService.heightUpdate; + } + + ngOnDestroy(){ + //this.FullnodeSub.unsubscribe(); + //this.UserSub.unsubscribe(); + } + + shortenZaddr() { + var addr = this.owner.address; + var end = addr.length; + var last = end - 5; + return addr.substring(0,5).concat('...').concat(addr.substring(last, end)); } } diff --git a/src/app/items/item.model.ts b/src/app/items/item.model.ts new file mode 100644 index 0000000..2805009 --- /dev/null +++ b/src/app/items/item.model.ts @@ -0,0 +1,7 @@ +export interface Item { + id: string; + name: string; + description: string; + cost: number; + user: string; +} diff --git a/src/app/items/items.service.ts b/src/app/items/items.service.ts new file mode 100644 index 0000000..901cf20 --- /dev/null +++ b/src/app/items/items.service.ts @@ -0,0 +1,17 @@ +import { Item } from './item.model'; +import { Injectable } from '@angular/core'; +import { Subject } from 'rxjs'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({providedIn: 'root'}) + +export class ItemService{ + private items: Item[] = []; + private itemUpdated = new Subject(); + + constructor(private http: HttpClient){ + } + + getItems(addr: string){ + } +} diff --git a/src/app/login/login.component.html b/src/app/login/login.component.html index 86f0d88..42d861f 100644 --- a/src/app/login/login.component.html +++ b/src/app/login/login.component.html @@ -1,6 +1,6 @@ - Welcome to Sell4ZEC! + Welcome to Zgo! diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts index 5067753..53fffc0 100644 --- a/src/app/login/login.component.ts +++ b/src/app/login/login.component.ts @@ -29,68 +29,44 @@ export class LoginComponent implements OnInit { ngOnInit(){ this.fullnodeService.getMemos(); this.fullnodeService.getAddr(); - this.FullnodeSub = this.fullnodeService.getAddrUpdateListener(). - subscribe((addr: string) => { - var localToken = localStorage.getItem('s4z_token'); - console.log(localToken); - if(localToken == null){ - var token = uuidv4(); - localStorage.setItem('s4z_token', token); - console.log('Showing QR code for login'); - console.log(URLSafeBase64.encode(Buffer.from('S4ZEC::'.concat(token)))); - var codeString = `zcash:${addr}?amount=0.001&memo=${URLSafeBase64.encode(Buffer.from('S4ZEC::'.concat(token)))}`; - console.log(codeString); - var qrcode = new QRCode(document.getElementById("qrcode"), { - text: codeString, - logo: "/assets/zcash.png", - logoWidth: 80, - logoHeight: 80 - }); - } else { - this.userService.getUser(localToken); - this.userService.getZaddrUpdateListener(). - subscribe((userAddr: string) => { - if (userAddr != '') { - console.log('Log in found!'); - this.router.navigate(['/create']); - } else { - console.log('No login for token found'); - console.log('Showing QR code for login'); - //console.log(URLSafeBase64.encode(Buffer.from('S4ZEC::'.concat(localToken)))); - var codeString = `zcash:${addr}?amount=0.001&memo=${URLSafeBase64.encode(Buffer.from('S4ZEC::'.concat(localToken!)))}`; - console.log(codeString); - var qrcode = new QRCode(document.getElementById("qrcode"), { - text: codeString, - logo: "/assets/zcash.png", - logoWidth: 80, - logoHeight: 80 - }); - - } - }); - } - }); - //this.FullnodeSub=this.fullnodeService.getMemoUpdateListener(). - //subscribe((memos: string[]) => { - //this.memos = memos; - //var addr = this.fullnodeService.getAddr(); - //if(localStorage.getItem('s4z_token') == null){ - //var token = uuidv4(); - //localStorage.setItem('s4z_token', token); - //console.log('Showing QR code for login'); - //console.log(URLSafeBase64.encode(Buffer.from('S4ZEC::'.concat(token)))); - //var codeString = `zcash:${addr}?amount=0.001&memo=${URLSafeBase64.encode(Buffer.from('S4ZEC::'.concat(token)))}`; - //console.log(codeString); - //var qrcode = new QRCode(document.getElementById("qrcode"), { - //text: codeString, - //logo: "/assets/zcash.png", - //logoWidth: 80, - //logoHeight: 80 - //}); - //} else { - //console.log(localStorage.getItem('s4z_token')); - //} - //}); + var nodeAddr = this.fullnodeService.addrUpdate; + var localToken = localStorage.getItem('s4z_token'); + console.log(localToken); + if(localToken == null){ + var token = uuidv4(); + localStorage.setItem('s4z_token', token); + console.log('Showing QR code for login'); + console.log(URLSafeBase64.encode(Buffer.from('S4ZEC::'.concat(token)))); + var codeString = `zcash:${nodeAddr}?amount=0.001&memo=${URLSafeBase64.encode(Buffer.from('S4ZEC::'.concat(token)))}`; + console.log(codeString); + var qrcode = new QRCode(document.getElementById("qrcode"), { + text: codeString, + logo: "/assets/zcash.png", + logoWidth: 80, + logoHeight: 80 + }); + } else { + this.userService.getUser(localToken); + this.userService.getZaddrUpdateListener(). + subscribe((userAddr: string) => { + if (userAddr.length != 0) { + console.log('Log in found!'); + //this.router.navigate(['/view']); + } else { + console.log('No login for existing token found'); + console.log('Showing QR code for login'); + //console.log(URLSafeBase64.encode(Buffer.from('S4ZEC::'.concat(localToken)))); + var codeString = `zcash:${nodeAddr}?amount=0.001&memo=${URLSafeBase64.encode(Buffer.from('S4ZEC::'.concat(localToken!)))}`; + console.log(codeString); + var qrcode = new QRCode(document.getElementById("qrcode"), { + text: codeString, + logo: "/assets/zcash.png", + logoWidth: 80, + logoHeight: 80 + }); + } + }); + } } ngOnDestroy(){ diff --git a/src/app/namedialog/namedialog.component.html b/src/app/namedialog/namedialog.component.html new file mode 100644 index 0000000..ecdad0b --- /dev/null +++ b/src/app/namedialog/namedialog.component.html @@ -0,0 +1,14 @@ +Set the name of your business + + + + + This field is required + + + + + Close + Save + + diff --git a/src/app/namedialog/namedialog.component.ts b/src/app/namedialog/namedialog.component.ts new file mode 100644 index 0000000..70cef1c --- /dev/null +++ b/src/app/namedialog/namedialog.component.ts @@ -0,0 +1,32 @@ +import { Inject, Component, OnInit, OnDestroy } from '@angular/core'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; +import { NgForm } from '@angular/forms'; + +@Component({ + selector: 'name-dialog', + templateUrl: './namedialog.component.html' +}) + +export class NameDialogComponent implements OnInit{ + bizname: string = ''; + + constructor( + private dialogRef: MatDialogRef + ) { + } + + ngOnInit() { + } + + save(form: NgForm) { + if (form.invalid) { + return; + } + this.dialogRef.close(form.value.bizname); + //console.log(`Saving name ${form.value.bizname}`); + } + + close() { + this.dialogRef.close(); + } +} diff --git a/src/app/owner.model.ts b/src/app/owner.model.ts new file mode 100644 index 0000000..13e095c --- /dev/null +++ b/src/app/owner.model.ts @@ -0,0 +1,5 @@ +export interface Owner { + _id: string; + address: string; + name: string; +} diff --git a/src/app/posts/post-create/post-create.component.css b/src/app/posts/post-create/post-create.component.css deleted file mode 100644 index 83c9061..0000000 --- a/src/app/posts/post-create/post-create.component.css +++ /dev/null @@ -1,4 +0,0 @@ -mat-form-field, -textarea{ - width:100%; -} diff --git a/src/app/posts/post-create/post-create.component.html b/src/app/posts/post-create/post-create.component.html deleted file mode 100644 index 0d40c12..0000000 --- a/src/app/posts/post-create/post-create.component.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - This field is required - - - - This field is required - - Save Post - - diff --git a/src/app/posts/post-create/post-create.component.ts b/src/app/posts/post-create/post-create.component.ts deleted file mode 100644 index 1ae8a58..0000000 --- a/src/app/posts/post-create/post-create.component.ts +++ /dev/null @@ -1,34 +0,0 @@ -import {Component, EventEmitter, Output} from '@angular/core'; -import { Post } from '../post.model'; -import { NgForm } from '@angular/forms'; -import { PostService } from '../posts.service'; - -@Component({ - selector: 'app-post-create', - templateUrl: './post-create.component.html', - styleUrls: ['./post-create.component.css'] -}) - -export class PostCreateComponent { - - enteredTitle = ''; - enteredContent = ''; - constructor(public postsService: PostService){} - - //@Output() postCreated = new EventEmitter(); - onAddPost(form: NgForm) { - //console.log(this.enteredTitle); - //console.log(this.enteredContent); - if (form.invalid) { - return; - } - const post: Post = { - id: '', - title: form.value.enteredTitle, - content: form.value.enteredContent - }; - //console.log("Pressed the button!"); - //this.postCreated.emit(post); - this.postsService.addPost(form.value.enteredTitle, form.value.enteredContent); - } -} diff --git a/src/app/posts/post-list/post-list.component.css b/src/app/posts/post-list/post-list.component.css deleted file mode 100644 index d04cd30..0000000 --- a/src/app/posts/post-list/post-list.component.css +++ /dev/null @@ -1,8 +0,0 @@ -:host{ - Display: block; - margin-top: 1rem; -} - -.info-text{ - text-align: center; -} diff --git a/src/app/posts/post-list/post-list.component.html b/src/app/posts/post-list/post-list.component.html deleted file mode 100644 index 45a2c67..0000000 --- a/src/app/posts/post-list/post-list.component.html +++ /dev/null @@ -1,9 +0,0 @@ - 0"> - - - {{post.title}} - - {{post.content}} - - -No posts! diff --git a/src/app/posts/post-list/post-list.component.ts b/src/app/posts/post-list/post-list.component.ts deleted file mode 100644 index 6bd9b9b..0000000 --- a/src/app/posts/post-list/post-list.component.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Component, Input, OnInit, OnDestroy } from '@angular/core'; -import { Post } from '../post.model'; -import { PostService } from '../posts.service'; -import { Subscription } from 'rxjs'; - -@Component({ - selector: 'app-post-list', - templateUrl: './post-list.component.html', - styleUrls: ['./post-list.component.css'] -}) - - -export class PostListComponent implements OnInit, OnDestroy { - //posts=[ - //{title: 'First Post', content:'This is the first post\'s content'}, - //{title: 'Second Post', content:'This is the second post\'s content'}, - //{title: 'Third Post', content:'This is the third post\'s content'} - //]; - posts: Post[] = []; - private PostSub: Subscription = new Subscription(); - constructor(public postsService: PostService){ - //this.postsService = postsService; - } - - ngOnInit(){ - this.postsService.getPosts(); - this.PostSub=this.postsService.getPostUpdateListener(). - subscribe((posts: Post[]) => { - this.posts = posts; - }); - } - - ngOnDestroy(){ - this.PostSub.unsubscribe(); - } -} diff --git a/src/app/posts/post.model.ts b/src/app/posts/post.model.ts deleted file mode 100644 index f269dac..0000000 --- a/src/app/posts/post.model.ts +++ /dev/null @@ -1,5 +0,0 @@ -export interface Post { - id: string; - title: string; - content: string; -} diff --git a/src/app/posts/posts.service.ts b/src/app/posts/posts.service.ts deleted file mode 100644 index 55fe5da..0000000 --- a/src/app/posts/posts.service.ts +++ /dev/null @@ -1,35 +0,0 @@ -import {Post} from './post.model'; -import {Injectable} from '@angular/core'; -import {Subject} from 'rxjs'; -import {HttpClient} from '@angular/common/http'; - -@Injectable({providedIn: 'root'}) -export class PostService{ - private posts: Post[] = []; - private postUpdated = new Subject(); - - constructor(private http: HttpClient){ - } - - getPosts(){ - this.http.get<{message: string, posts: Post[]}>('http://localhost:3000/api/posts') - .subscribe((PostData) => { - this.posts = PostData.posts; - this.postUpdated.next([...this.posts]); - }); - } - - addPost(title: string, content: string){ - const post: Post={id: '', title: title, content: content}; - this.http.post<{message: string}>('http://localhost:3000/api/posts', post). - subscribe((responseData) => { - console.log(responseData.message); - this.posts.push(post); - this.postUpdated.next([...this.posts]); - }); - } - - getPostUpdateListener() { - return this.postUpdated; - } -} diff --git a/src/app/user.service.ts b/src/app/user.service.ts index dd4b215..47b1c5c 100644 --- a/src/app/user.service.ts +++ b/src/app/user.service.ts @@ -2,19 +2,45 @@ import {Injectable} from '@angular/core'; import {Subject} from 'rxjs'; import {HttpClient, HttpParams} from '@angular/common/http'; import {User} from './user.model'; +import {Owner} from './owner.model'; @Injectable({providedIn: 'root'}) export class UserService{ private uZaddr = ''; + private oZaddr = ''; + private uName = ''; + private session: string | null = ''; private uZaddrUpdated = new Subject(); + private uNameUpdated = new Subject(); + private ownerUpdated = new Subject(); constructor(private http: HttpClient){ + this.session = localStorage.getItem('s4z_token'); } addUser(address: string, session: string, blocktime: number) { const user: User={_id: '', address: address, session: session, blocktime: blocktime}; this.http.post<{message: string}>('http://localhost:3000/api/users', user). + subscribe((responseData) => { + console.log(responseData.message); + //this.getOwner(address); + //if (this.oZaddr == '') { + //this.addOwner(address); + //} + }); + } + + addOwner(address: string) { + const owner: Owner={_id: '', address: address, name: 'Zgo-'.concat(address.substring(0,5))}; + this.http.post<{message: string}>('http://localhost:3000/api/addowner', {address: owner.address, name: owner.name}). + subscribe((responseData) => { + console.log(responseData.message); + }); + } + + addOwnerName(address: string, name: string) { + this.http.post<{message: string}>('http://localhost:3000/api/addownername', {address, name}). subscribe((responseData) => { console.log(responseData.message); }); @@ -22,21 +48,59 @@ export class UserService{ getUser(session: string) { const params = new HttpParams().append('session', session); + console.log(`US: Searching for session ${session} `); this.http.get<{message: string, user: any}>('http://localhost:3000/api/getuser', { headers:{}, params: params, observe: 'response'}). subscribe((UserDataResponse) => { console.log(UserDataResponse.status); if (UserDataResponse.status == 200){ this.uZaddr = UserDataResponse.body!.user[0].address; + console.log(`US: Found user, returning zaddr ${this.uZaddr}`); this.uZaddrUpdated.next(this.uZaddr); } else { + console.log('US: Did not find user'); this.uZaddrUpdated.next(''); } }); } + getOwner(address: string) { + const ownParams = new HttpParams().append('address', address); + this.http.get<{message:string, owner: any}>('http://localhost:3000/api/getowner', {params: ownParams, observe: 'response'}). + subscribe((OwnerDataResponse) => { + if (OwnerDataResponse.status == 200) { + this.ownerUpdated.next(OwnerDataResponse.body!.owner[0]); + } else { + console.log("No owner found, adding"); + //this.addOwner(address); + } + }); + } + + hasOwner() { + return this.uZaddr === this.oZaddr; + } + + getName() { + if (this.session != null) { + this.getUser(this.session); + this.uZaddrUpdated.subscribe((addr: string) => { + console.log(` US: ${addr}`); + this.getOwner(addr); + }); + } + } + + getNameUpdateListener() { + return this.uNameUpdated; + } + getZaddrUpdateListener() { return this.uZaddrUpdated; } + getOwnerUpdateListener() { + return this.ownerUpdated; + } + } diff --git a/src/app/viewer/viewer.component.html b/src/app/viewer/viewer.component.html index 86f0d88..b30b5e6 100644 --- a/src/app/viewer/viewer.component.html +++ b/src/app/viewer/viewer.component.html @@ -1,27 +1,4 @@ - + - Welcome to Sell4ZEC! + {{message}} - - - - - - - - A non-custodial point-of-sale application, powered by Zcash. - - - - - Ensure you include your Reply-To shielded address! - - - Your shielded address is your username and all payments will be sent to it. - - - - - - - diff --git a/src/app/viewer/viewer.component.ts b/src/app/viewer/viewer.component.ts index bf330b4..68da332 100644 --- a/src/app/viewer/viewer.component.ts +++ b/src/app/viewer/viewer.component.ts @@ -1,12 +1,16 @@ -import { Component, OnInit, OnDestroy, Injectable } from '@angular/core'; +import { Component, OnInit, OnDestroy } from '@angular/core'; import { CanActivate, Router, RouterStateSnapshot, ActivatedRouteSnapshot } from '@angular/router'; +import { MatDialog, MatDialogConfig } from '@angular/material/dialog'; import { UserService } from '../user.service'; import { FullnodeService } from '../fullnode.service'; +//import { NameDialogComponent } from '../namedialog/namedialog.component'; import { Subscription } from 'rxjs'; -import { v4 as uuidv4 } from 'uuid'; -var QRCode = require('easyqrcodejs'); -var URLSafeBase64 = require('urlsafe-base64'); -var Buffer = require('buffer/').Buffer; + +import {Owner} from '../owner.model'; +//import { v4 as uuidv4 } from 'uuid'; +//var QRCode = require('easyqrcodejs'); +//var URLSafeBase64 = require('urlsafe-base64'); +//var Buffer = require('buffer/').Buffer; @Component({ @@ -16,85 +20,52 @@ var Buffer = require('buffer/').Buffer; }) export class ViewerComponent implements OnInit { - memos: string[] = []; - private FullnodeSub: Subscription = new Subscription(); + public message: string = "Welcome to the inside!"; private UserSub: Subscription = new Subscription(); + private OwnerSub: Subscription = new Subscription(); + constructor( public fullnodeService: FullnodeService, private router: Router, - public userService: UserService + public userService: UserService, + private dialog: MatDialog ){ } ngOnInit(){ - this.fullnodeService.getMemos(); - this.fullnodeService.getAddr(); - this.FullnodeSub = this.fullnodeService.getAddrUpdateListener(). - subscribe((addr: string) => { - var localToken = localStorage.getItem('s4z_token'); - console.log(localToken); - if(localToken == null){ - var token = uuidv4(); - localStorage.setItem('s4z_token', token); - console.log('Showing QR code for login'); - console.log(URLSafeBase64.encode(Buffer.from('S4ZEC::'.concat(token)))); - var codeString = `zcash:${addr}?amount=0.001&memo=${URLSafeBase64.encode(Buffer.from('S4ZEC::'.concat(token)))}`; - console.log(codeString); - var qrcode = new QRCode(document.getElementById("qrcode"), { - text: codeString, - logo: "/assets/zcash.png", - logoWidth: 80, - logoHeight: 80 + + this.userService.getName(); + this.UserSub = this.userService.getNameUpdateListener(). + subscribe((name) => { + if (name.length == 0) { + console.log(name); + this.OwnerSub = this.userService.getZaddrUpdateListener(). + subscribe((addr) => { + //this.openDialog(addr); }); } else { - this.userService.getUser(localToken); - this.userService.getZaddrUpdateListener(). - subscribe((userAddr: string) => { - if (userAddr != '') { - console.log('Log in found!'); - this.router.navigate(['/create']); - } else { - console.log('No login for token found'); - console.log('Showing QR code for login'); - //console.log(URLSafeBase64.encode(Buffer.from('S4ZEC::'.concat(localToken)))); - var codeString = `zcash:${addr}?amount=0.001&memo=${URLSafeBase64.encode(Buffer.from('S4ZEC::'.concat(localToken!)))}`; - console.log(codeString); - var qrcode = new QRCode(document.getElementById("qrcode"), { - text: codeString, - logo: "/assets/zcash.png", - logoWidth: 80, - logoHeight: 80 - }); - - } - }); + this.message = name; } }); - //this.FullnodeSub=this.fullnodeService.getMemoUpdateListener(). - //subscribe((memos: string[]) => { - //this.memos = memos; - //var addr = this.fullnodeService.getAddr(); - //if(localStorage.getItem('s4z_token') == null){ - //var token = uuidv4(); - //localStorage.setItem('s4z_token', token); - //console.log('Showing QR code for login'); - //console.log(URLSafeBase64.encode(Buffer.from('S4ZEC::'.concat(token)))); - //var codeString = `zcash:${addr}?amount=0.001&memo=${URLSafeBase64.encode(Buffer.from('S4ZEC::'.concat(token)))}`; - //console.log(codeString); - //var qrcode = new QRCode(document.getElementById("qrcode"), { - //text: codeString, - //logo: "/assets/zcash.png", - //logoWidth: 80, - //logoHeight: 80 - //}); - //} else { - //console.log(localStorage.getItem('s4z_token')); - //} - //}); } ngOnDestroy(){ - this.FullnodeSub.unsubscribe(); - this.UserSub.unsubscribe(); } + + //openDialog(address: string) { + //const dialogConfig = new MatDialogConfig(); + + //dialogConfig.autoFocus = true; + + /* + *dialogConfig.data = { + * id: 1, + * title: 'Whee!' + *} + */ + + //const dialogRef = this.dialog.open(NameDialogComponent, dialogConfig); + + //dialogRef.afterClosed().subscribe(name => this.userService.addOwnerName(address, name) ); + //} }
{{post.content}}
No posts!
A non-custodial point-of-sale application, powered by Zcash.
- Ensure you include your Reply-To shielded address! -
- Your shielded address is your username and all payments will be sent to it. -