New electron app

This commit is contained in:
barwie2@st.amu.edu.pl 2020-01-13 17:24:01 +01:00
parent 353ef2f72c
commit 48b4e2e5c5
4 changed files with 67 additions and 127 deletions

View File

@ -3,12 +3,12 @@
<head> <head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/css/materialize.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/css/materialize.min.css">
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Student counter</title> <title>@ATCHECK</title>
</head> </head>
<body> <body>
<nav> <nav>
<div class="nav-wrapper"> <div class="nav-wrapper">
<a class="brand-logo center">Student counter</a> <a class="brand-logo center">@ATCHECK</a>
</div> </div>
</nav> </nav>

View File

@ -7,9 +7,6 @@ const asn1js = require('asn1js');
const util = require('util'); const util = require('util');
const notifier = require('node-notifier'); const notifier = require('node-notifier');
const smartcard = require('smartcard'); const smartcard = require('smartcard');
const axios = require('axios')
let class_code = "";
let counter = 0; let counter = 0;
@ -36,7 +33,7 @@ app.on('ready', function () {
//Load html into window //Load html into window
mainWindow.loadURL(url.format({ mainWindow.loadURL(url.format({
pathname: path.join(__dirname, "classcode.html"), pathname: path.join(__dirname, "index.html"),
protocol: "file:", protocol: "file:",
slashes: true slashes: true
})); }));
@ -296,21 +293,6 @@ function printStudent(item) {
icon: path.join(__dirname, 'ok.png') icon: path.join(__dirname, 'ok.png')
}); });
axios.post('http://127.0.0.1:8000/add/cache', {
classes_code: 'LLcUHw3b0a',
student_index: item[2],
student_name: item[0],
student_surname: item[1]
})
.then((res) => {
console.log(`statusCode: ${res.statusCode}`)
console.log(res)
})
.catch((error) => {
console.error(error)
})
} }
//Catch //Catch
@ -325,16 +307,6 @@ ipcMain.on("card:read", function (e) {
card_read(); card_read();
}) })
ipcMain.on("set:classcode", function (e,classcode) {
class_code = classcode;
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, "index.html"),
protocol: "file:",
slashes: true
}));
})
//Menu template //Menu template
const mainMenuTemplate = [{ const mainMenuTemplate = [{
label: "Student", label: "Student",

View File

@ -5,9 +5,9 @@
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@electron/get": { "@electron/get": {
"version": "1.7.0", "version": "1.7.2",
"resolved": "https://registry.npmjs.org/@electron/get/-/get-1.7.0.tgz", "resolved": "https://registry.npmjs.org/@electron/get/-/get-1.7.2.tgz",
"integrity": "sha512-Xzo+xLQ+gwmGywFnFuG7HNIALPVJOCkvKagGxSXU1LC3s/j3h2Nku9OdwJ4KDkITeUuXfvAO5KS8rLGcmAunNQ==", "integrity": "sha512-LSE4LZGMjGS9TloDx0yO44D2UTbaeKRk+QjlhWLiQlikV6J4spgDCjb6z4YIcqmPAwNzlNCnWF4dubytwI+ATA==",
"dev": true, "dev": true,
"requires": { "requires": {
"debug": "^4.1.1", "debug": "^4.1.1",
@ -17,7 +17,7 @@
"global-tunnel-ng": "^2.7.1", "global-tunnel-ng": "^2.7.1",
"got": "^9.6.0", "got": "^9.6.0",
"sanitize-filename": "^1.6.2", "sanitize-filename": "^1.6.2",
"sumchecker": "^3.0.0" "sumchecker": "^3.0.1"
} }
}, },
"@sindresorhus/is": { "@sindresorhus/is": {
@ -36,9 +36,9 @@
} }
}, },
"@types/node": { "@types/node": {
"version": "12.12.11", "version": "12.12.17",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.11.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.17.tgz",
"integrity": "sha512-O+x6uIpa6oMNTkPuHDa9MhMMehlxLAd5QcOvKRjAFsBVpeFWTOPnXbDvILvFgFFZfQ1xh1EZi1FbXxUix+zpsQ==", "integrity": "sha512-Is+l3mcHvs47sKy+afn2O1rV4ldZFU7W8101cNlOd+MRbjM4Onida8jSZnJdTe/0Pcf25g9BNIUsuugmE6puHA==",
"dev": true "dev": true
}, },
"abbrev": { "abbrev": {
@ -126,20 +126,11 @@
"dev": true "dev": true
}, },
"aws4": { "aws4": {
"version": "1.8.0", "version": "1.9.0",
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.0.tgz",
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", "integrity": "sha512-Uvq6hVe90D0B2WEnUqtdgY1bATGz3mw33nH9Y+dmA+w5DHvUmBgkr5rM/KCHpCsiFNRUfokW/szpPPgMK2hm4A==",
"dev": true "dev": true
}, },
"axios": {
"version": "0.19.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz",
"integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==",
"requires": {
"follow-redirects": "1.5.10",
"is-buffer": "^2.0.2"
}
},
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
@ -402,9 +393,9 @@
"dev": true "dev": true
}, },
"core-js": { "core-js": {
"version": "3.4.2", "version": "3.5.0",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.4.2.tgz", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.5.0.tgz",
"integrity": "sha512-bUTfqFWtNKWp73oNIfRkqwYZJeNT3lstzZcAkhhiuvDraRSgOH1/+F9ZklbpR4zpdKuo4cpXN8tKP7s61yjX+g==", "integrity": "sha512-Ifh3kj78gzQ7NAoJXeTu+XwzDld0QRIwjBLRqAMhuLhP3d2Av5wmgE9ycfnvK6NAEjTkQ1sDPeoEZAWO3Hx1Uw==",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
@ -457,9 +448,9 @@
} }
}, },
"defer-to-connect": { "defer-to-connect": {
"version": "1.1.0", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.0.tgz", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.1.tgz",
"integrity": "sha512-WE2sZoctWm/v4smfCAdjYbrfS55JiMRdlY9ZubFhsYbteCK9+BvAx4YV7nPjYM6ZnX5BcoVKwfmyx9sIFTgQMQ==", "integrity": "sha512-J7thop4u3mRTkYRQ+Vpfwy2G5Ehoy82I14+14W4YMDLKdWloI9gSzRbV30s/NckQGVJtPkWNcW4oMAUigTdqiQ==",
"dev": true "dev": true
}, },
"define-properties": { "define-properties": {
@ -514,9 +505,9 @@
} }
}, },
"electron": { "electron": {
"version": "7.1.2", "version": "7.1.5",
"resolved": "https://registry.npmjs.org/electron/-/electron-7.1.2.tgz", "resolved": "https://registry.npmjs.org/electron/-/electron-7.1.5.tgz",
"integrity": "sha512-7hjONYt2GlQfKuKgQrhhUL1P9lbGWLBfMUq+2QFU3yeLtCvM0ROfPJCRP4OF5pVp3KDyfFp4DtmhuVzAnxV3jA==", "integrity": "sha512-jagsvNz6Axu2Lsp5PqDgkcR+4BwoPP9YyLgMu9lhpFNRNKpNgfsEqUbtNolkFN/TtmWjxGO+iioWRrGqZHmJ8w==",
"dev": true, "dev": true,
"requires": { "requires": {
"@electron/get": "^1.0.1", "@electron/get": "^1.0.1",
@ -644,9 +635,9 @@
"dev": true "dev": true
}, },
"fast-json-stable-stringify": { "fast-json-stable-stringify": {
"version": "2.0.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
"dev": true "dev": true
}, },
"fd-slicer": { "fd-slicer": {
@ -672,29 +663,6 @@
"locate-path": "^3.0.0" "locate-path": "^3.0.0"
} }
}, },
"follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
"requires": {
"debug": "=3.1.0"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
},
"forever-agent": { "forever-agent": {
"version": "0.6.1", "version": "0.6.1",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
@ -948,11 +916,6 @@
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"is-buffer": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz",
"integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A=="
},
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
@ -1180,9 +1143,9 @@
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg=="
}, },
"node-abi": { "node-abi": {
"version": "2.12.0", "version": "2.13.0",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.12.0.tgz", "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.13.0.tgz",
"integrity": "sha512-VhPBXCIcvmo/5K8HPmnWJyyhvgKxnHTUMXR/XwGHV68+wrgkzST4UmQrY/XszSWA5dtnXpNp528zkcyJ/pzVcw==", "integrity": "sha512-9HrZGFVTR5SOu3PZAnAY2hLO36aW1wmA+FDsVkr85BTST32TLCA1H/AEcatVRAsWLyXS3bqUDYCAjq5/QGuSTA==",
"dev": true, "dev": true,
"requires": { "requires": {
"semver": "^5.4.1" "semver": "^5.4.1"
@ -1257,9 +1220,9 @@
"dev": true "dev": true
}, },
"npm": { "npm": {
"version": "6.13.1", "version": "6.13.4",
"resolved": "https://registry.npmjs.org/npm/-/npm-6.13.1.tgz", "resolved": "https://registry.npmjs.org/npm/-/npm-6.13.4.tgz",
"integrity": "sha512-2awiDZ9JuV/UoF4oXGhekCURC2X+eLLRz9/e58AGrPDlpzyn7e4oCaZmkzyEaisxM7jSoFKNnZhzB4xbmbM0Yw==", "integrity": "sha512-vTcUL4SCg3AzwInWTbqg1OIaOXlzKSS8Mb8kc5avwrJpcvevDA5J9BhYSuei+fNs3pwOp4lzA5x2FVDXACvoXA==",
"requires": { "requires": {
"JSONStream": "^1.3.5", "JSONStream": "^1.3.5",
"abbrev": "~1.1.1", "abbrev": "~1.1.1",
@ -1267,7 +1230,7 @@
"ansistyles": "~0.1.3", "ansistyles": "~0.1.3",
"aproba": "^2.0.0", "aproba": "^2.0.0",
"archy": "~1.0.0", "archy": "~1.0.0",
"bin-links": "^1.1.3", "bin-links": "^1.1.6",
"bluebird": "^3.5.5", "bluebird": "^3.5.5",
"byte-size": "^5.0.1", "byte-size": "^5.0.1",
"cacache": "^12.0.3", "cacache": "^12.0.3",
@ -1288,7 +1251,7 @@
"find-npm-prefix": "^1.0.2", "find-npm-prefix": "^1.0.2",
"fs-vacuum": "~1.2.10", "fs-vacuum": "~1.2.10",
"fs-write-stream-atomic": "~1.0.10", "fs-write-stream-atomic": "~1.0.10",
"gentle-fs": "^2.2.1", "gentle-fs": "^2.3.0",
"glob": "^7.1.4", "glob": "^7.1.4",
"graceful-fs": "^4.2.3", "graceful-fs": "^4.2.3",
"has-unicode": "~2.0.1", "has-unicode": "~2.0.1",
@ -1337,7 +1300,7 @@
"npm-install-checks": "^3.0.2", "npm-install-checks": "^3.0.2",
"npm-lifecycle": "^3.1.4", "npm-lifecycle": "^3.1.4",
"npm-package-arg": "^6.1.1", "npm-package-arg": "^6.1.1",
"npm-packlist": "^1.4.6", "npm-packlist": "^1.4.7",
"npm-pick-manifest": "^3.0.2", "npm-pick-manifest": "^3.0.2",
"npm-profile": "^4.0.2", "npm-profile": "^4.0.2",
"npm-registry-fetch": "^4.0.2", "npm-registry-fetch": "^4.0.2",
@ -1346,7 +1309,7 @@
"once": "~1.4.0", "once": "~1.4.0",
"opener": "^1.5.1", "opener": "^1.5.1",
"osenv": "^0.1.5", "osenv": "^0.1.5",
"pacote": "^9.5.9", "pacote": "^9.5.11",
"path-is-inside": "~1.0.2", "path-is-inside": "~1.0.2",
"promise-inflight": "~1.0.1", "promise-inflight": "~1.0.1",
"qrcode-terminal": "^0.12.0", "qrcode-terminal": "^0.12.0",
@ -1355,7 +1318,7 @@
"read": "~1.0.7", "read": "~1.0.7",
"read-cmd-shim": "^1.0.5", "read-cmd-shim": "^1.0.5",
"read-installed": "~4.0.3", "read-installed": "~4.0.3",
"read-package-json": "^2.1.0", "read-package-json": "^2.1.1",
"read-package-tree": "^5.3.1", "read-package-tree": "^5.3.1",
"readable-stream": "^3.4.0", "readable-stream": "^3.4.0",
"readdir-scoped-modules": "^1.1.0", "readdir-scoped-modules": "^1.1.0",
@ -1526,13 +1489,14 @@
} }
}, },
"bin-links": { "bin-links": {
"version": "1.1.3", "version": "1.1.6",
"bundled": true, "bundled": true,
"requires": { "requires": {
"bluebird": "^3.5.3", "bluebird": "^3.5.3",
"cmd-shim": "^3.0.0", "cmd-shim": "^3.0.0",
"gentle-fs": "^2.0.1", "gentle-fs": "^2.3.0",
"graceful-fs": "^4.1.15", "graceful-fs": "^4.1.15",
"npm-normalize-package-bin": "^1.0.0",
"write-file-atomic": "^2.3.0" "write-file-atomic": "^2.3.0"
} }
}, },
@ -2281,11 +2245,12 @@
"bundled": true "bundled": true
}, },
"gentle-fs": { "gentle-fs": {
"version": "2.2.1", "version": "2.3.0",
"bundled": true, "bundled": true,
"requires": { "requires": {
"aproba": "^1.1.2", "aproba": "^1.1.2",
"chownr": "^1.1.2", "chownr": "^1.1.2",
"cmd-shim": "^3.0.3",
"fs-vacuum": "^1.2.10", "fs-vacuum": "^1.2.10",
"graceful-fs": "^4.1.11", "graceful-fs": "^4.1.11",
"iferr": "^0.1.5", "iferr": "^0.1.5",
@ -3130,8 +3095,11 @@
} }
}, },
"npm-bundled": { "npm-bundled": {
"version": "1.0.6", "version": "1.1.1",
"bundled": true "bundled": true,
"requires": {
"npm-normalize-package-bin": "^1.0.1"
}
}, },
"npm-cache-filename": { "npm-cache-filename": {
"version": "1.0.2", "version": "1.0.2",
@ -3162,6 +3130,10 @@
"version": "1.2.1", "version": "1.2.1",
"bundled": true "bundled": true
}, },
"npm-normalize-package-bin": {
"version": "1.0.1",
"bundled": true
},
"npm-package-arg": { "npm-package-arg": {
"version": "6.1.1", "version": "6.1.1",
"bundled": true, "bundled": true,
@ -3173,7 +3145,7 @@
} }
}, },
"npm-packlist": { "npm-packlist": {
"version": "1.4.6", "version": "1.4.7",
"bundled": true, "bundled": true,
"requires": { "requires": {
"ignore-walk": "^3.0.1", "ignore-walk": "^3.0.1",
@ -3331,7 +3303,7 @@
} }
}, },
"pacote": { "pacote": {
"version": "9.5.9", "version": "9.5.11",
"bundled": true, "bundled": true,
"requires": { "requires": {
"bluebird": "^3.5.3", "bluebird": "^3.5.3",
@ -3348,6 +3320,7 @@
"mississippi": "^3.0.0", "mississippi": "^3.0.0",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"normalize-package-data": "^2.4.0", "normalize-package-data": "^2.4.0",
"npm-normalize-package-bin": "^1.0.0",
"npm-package-arg": "^6.1.0", "npm-package-arg": "^6.1.0",
"npm-packlist": "^1.1.12", "npm-packlist": "^1.1.12",
"npm-pick-manifest": "^3.0.0", "npm-pick-manifest": "^3.0.0",
@ -3586,14 +3559,14 @@
} }
}, },
"read-package-json": { "read-package-json": {
"version": "2.1.0", "version": "2.1.1",
"bundled": true, "bundled": true,
"requires": { "requires": {
"glob": "^7.1.1", "glob": "^7.1.1",
"graceful-fs": "^4.1.2", "graceful-fs": "^4.1.2",
"json-parse-better-errors": "^1.0.1", "json-parse-better-errors": "^1.0.1",
"normalize-package-data": "^2.0.0", "normalize-package-data": "^2.0.0",
"slash": "^1.0.0" "npm-normalize-package-bin": "^1.0.0"
} }
}, },
"read-package-tree": { "read-package-tree": {
@ -3746,10 +3719,6 @@
"version": "3.0.2", "version": "3.0.2",
"bundled": true "bundled": true
}, },
"slash": {
"version": "1.0.0",
"bundled": true
},
"slide": { "slide": {
"version": "1.1.6", "version": "1.1.6",
"bundled": true "bundled": true
@ -4520,9 +4489,9 @@
"optional": true "optional": true
}, },
"psl": { "psl": {
"version": "1.4.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz", "resolved": "https://registry.npmjs.org/psl/-/psl-1.6.0.tgz",
"integrity": "sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw==", "integrity": "sha512-SYKKmVel98NCOYXpkwUqZqh0ahZeeKfmisiLIcEZdsb+WbLv02g/dI5BUmZnIyOe7RzZtLax81nnb2HbvC2tzA==",
"dev": true "dev": true
}, },
"pump": { "pump": {
@ -4810,9 +4779,9 @@
} }
}, },
"sumchecker": { "sumchecker": {
"version": "3.0.0", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-3.0.0.tgz", "resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-3.0.1.tgz",
"integrity": "sha512-yreseuC/z4iaodVoq07XULEOO9p4jnQazO7mbrnDSvWAU/y2cbyIKs+gWJptfcGu9R+1l27K8Rkj0bfvqnBpgQ==", "integrity": "sha512-MvjXzkz/BOfyVDkG0oFOtBxHX2u3gKbMHIF/dXblZsgD3BWOFLmHovIpZY7BykJdAjcqRCBi1WYBNdEC9yI7vg==",
"dev": true, "dev": true,
"requires": { "requires": {
"debug": "^4.1.0" "debug": "^4.1.0"

View File

@ -10,16 +10,15 @@
"author": "Me", "author": "Me",
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"electron": "^7.1.2", "electron": "^7.1.5",
"electron-rebuild": "^1.8.8" "electron-rebuild": "^1.8.8"
}, },
"dependencies": { "dependencies": {
"asn1js": "^2.0.26", "asn1js": "^2.0.26",
"axios": "^0.19.0",
"fs": "0.0.1-security", "fs": "0.0.1-security",
"node-datetime": "^2.1.2", "node-datetime": "^2.1.2",
"node-notifier": "^6.0.0", "node-notifier": "^6.0.0",
"npm": "^6.13.1", "npm": "^6.13.4",
"pcsclite": "^1.0.0", "pcsclite": "^1.0.0",
"smartcard": "^1.0.32" "smartcard": "^1.0.32"
} }