Compare commits
6 Commits
e63f351f63
...
master
Author | SHA1 | Date | |
---|---|---|---|
a59424171d | |||
97caf4b30e | |||
55c8b628ca | |||
1e858021be | |||
bb1d9f71a8 | |||
95d8d9a58f |
4
.gitignore
vendored
4
.gitignore
vendored
@ -93,3 +93,7 @@ out/
|
||||
|
||||
# WebStorm
|
||||
.idea/
|
||||
|
||||
# Data Directory
|
||||
data/
|
||||
*.test
|
@ -20,7 +20,13 @@ const config: ForgeConfig = {
|
||||
new MakerSquirrel({}),
|
||||
new MakerZIP({}, ['darwin']),
|
||||
new MakerRpm({}),
|
||||
new MakerDeb({})],
|
||||
new MakerDeb({
|
||||
options: {
|
||||
depends: [
|
||||
"libpcsclite1", "libpcsclite-dev", "pcscd"
|
||||
]
|
||||
}
|
||||
})],
|
||||
plugins: [
|
||||
new AutoUnpackNativesPlugin({}),
|
||||
new WebpackPlugin({
|
||||
|
188
package-lock.json
generated
188
package-lock.json
generated
@ -14,10 +14,12 @@
|
||||
"@fontsource/roboto": "^5.0.12",
|
||||
"@mui/icons-material": "^5.15.14",
|
||||
"@mui/material": "^5.15.14",
|
||||
"@types/websocket": "^1.0.10",
|
||||
"electron-squirrel-startup": "^1.0.0",
|
||||
"node-wifi-scanner": "git+https://git.gaminggeneration.de/tobiash/node-wifi-scanner",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
"react-dom": "^18.2.0",
|
||||
"websocket": "^1.0.34"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@electron-forge/cli": "^7.3.1",
|
||||
@ -1953,7 +1955,6 @@
|
||||
"version": "20.11.30",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.30.tgz",
|
||||
"integrity": "sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~5.26.4"
|
||||
@ -2100,6 +2101,14 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/websocket": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/websocket/-/websocket-1.0.10.tgz",
|
||||
"integrity": "sha512-svjGZvPB7EzuYS94cI7a+qhwgGU1y89wUgjT6E2wVUfmAGIvRfT7obBvRtnhXCSsoMdlG4gBFGE7MfkIXZLoww==",
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/ws": {
|
||||
"version": "8.5.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.10.tgz",
|
||||
@ -3212,6 +3221,18 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/bufferutil": {
|
||||
"version": "4.0.8",
|
||||
"resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.8.tgz",
|
||||
"integrity": "sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"node-gyp-build": "^4.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.14.2"
|
||||
}
|
||||
},
|
||||
"node_modules/bytes": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
||||
@ -3969,6 +3990,18 @@
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
|
||||
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="
|
||||
},
|
||||
"node_modules/d": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/d/-/d-1.0.2.tgz",
|
||||
"integrity": "sha512-MOqHvMWF9/9MX6nza0KgvFH4HpMU0EF5uUDXqX/BtxtU8NfB0QzRtJ8Oe/6SuS4kbhyzVJwjd97EA4PKrzJ8bw==",
|
||||
"dependencies": {
|
||||
"es5-ext": "^0.10.64",
|
||||
"type": "^2.7.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.12"
|
||||
}
|
||||
},
|
||||
"node_modules/data-view-buffer": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz",
|
||||
@ -4873,6 +4906,21 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/es5-ext": {
|
||||
"version": "0.10.64",
|
||||
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.64.tgz",
|
||||
"integrity": "sha512-p2snDhiLaXe6dahss1LddxqEm+SkuDvV8dnIQG0MWjyHpcMNfXKPE+/Cc0y+PhxJX3A4xGNeFCj5oc0BUh6deg==",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"es6-iterator": "^2.0.3",
|
||||
"es6-symbol": "^3.1.3",
|
||||
"esniff": "^2.0.1",
|
||||
"next-tick": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/es6-error": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz",
|
||||
@ -4881,6 +4929,28 @@
|
||||
"license": "MIT",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/es6-iterator": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz",
|
||||
"integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==",
|
||||
"dependencies": {
|
||||
"d": "1",
|
||||
"es5-ext": "^0.10.35",
|
||||
"es6-symbol": "^3.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/es6-symbol": {
|
||||
"version": "3.1.4",
|
||||
"resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.4.tgz",
|
||||
"integrity": "sha512-U9bFFjX8tFiATgtkJ1zg25+KviIXpgRvRHS8sau3GfhVzThRQrOeksPeT0BWW2MNZs1OEWJ1DPXOQMn0KKRkvg==",
|
||||
"dependencies": {
|
||||
"d": "^1.0.2",
|
||||
"ext": "^1.7.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.12"
|
||||
}
|
||||
},
|
||||
"node_modules/escalade": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz",
|
||||
@ -5158,6 +5228,20 @@
|
||||
"node": ">=10.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/esniff": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/esniff/-/esniff-2.0.1.tgz",
|
||||
"integrity": "sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg==",
|
||||
"dependencies": {
|
||||
"d": "^1.0.1",
|
||||
"es5-ext": "^0.10.62",
|
||||
"event-emitter": "^0.3.5",
|
||||
"type": "^2.7.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/espree": {
|
||||
"version": "9.6.1",
|
||||
"resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz",
|
||||
@ -5232,6 +5316,15 @@
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/event-emitter": {
|
||||
"version": "0.3.5",
|
||||
"resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz",
|
||||
"integrity": "sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==",
|
||||
"dependencies": {
|
||||
"d": "1",
|
||||
"es5-ext": "~0.10.14"
|
||||
}
|
||||
},
|
||||
"node_modules/eventemitter3": {
|
||||
"version": "4.0.7",
|
||||
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
|
||||
@ -5462,6 +5555,14 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/ext": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz",
|
||||
"integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==",
|
||||
"dependencies": {
|
||||
"type": "^2.7.2"
|
||||
}
|
||||
},
|
||||
"node_modules/extract-zip": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",
|
||||
@ -7200,6 +7301,11 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/is-typedarray": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
|
||||
"integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA=="
|
||||
},
|
||||
"node_modules/is-unicode-supported": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz",
|
||||
@ -8180,6 +8286,11 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/next-tick": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz",
|
||||
"integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ=="
|
||||
},
|
||||
"node_modules/nice-try": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
|
||||
@ -8285,6 +8396,16 @@
|
||||
"node": "^12.13 || ^14.13 || >=16"
|
||||
}
|
||||
},
|
||||
"node_modules/node-gyp-build": {
|
||||
"version": "4.8.0",
|
||||
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.0.tgz",
|
||||
"integrity": "sha512-u6fs2AEUljNho3EYTJNBfImO5QTo/J/1Etd+NVdCj7qWKUSN/bSLkZwhDv7I+w/MSC6qJ4cknepkAYykDdK8og==",
|
||||
"bin": {
|
||||
"node-gyp-build": "bin.js",
|
||||
"node-gyp-build-optional": "optional.js",
|
||||
"node-gyp-build-test": "build-test.js"
|
||||
}
|
||||
},
|
||||
"node_modules/node-loader": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/node-loader/-/node-loader-2.0.0.tgz",
|
||||
@ -11069,6 +11190,11 @@
|
||||
"dev": true,
|
||||
"license": "0BSD"
|
||||
},
|
||||
"node_modules/type": {
|
||||
"version": "2.7.2",
|
||||
"resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz",
|
||||
"integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw=="
|
||||
},
|
||||
"node_modules/type-check": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
|
||||
@ -11186,6 +11312,14 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/typedarray-to-buffer": {
|
||||
"version": "3.1.5",
|
||||
"resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz",
|
||||
"integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==",
|
||||
"dependencies": {
|
||||
"is-typedarray": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.5.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
|
||||
@ -11220,7 +11354,6 @@
|
||||
"version": "5.26.5",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
||||
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/unique-filename": {
|
||||
@ -11324,6 +11457,18 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/utf-8-validate": {
|
||||
"version": "5.0.10",
|
||||
"resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz",
|
||||
"integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"node-gyp-build": "^4.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.14.2"
|
||||
}
|
||||
},
|
||||
"node_modules/util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
@ -11734,6 +11879,22 @@
|
||||
"node": ">=10.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/websocket": {
|
||||
"version": "1.0.34",
|
||||
"resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz",
|
||||
"integrity": "sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==",
|
||||
"dependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"debug": "^2.2.0",
|
||||
"es5-ext": "^0.10.50",
|
||||
"typedarray-to-buffer": "^3.1.5",
|
||||
"utf-8-validate": "^5.0.2",
|
||||
"yaeti": "^0.0.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/websocket-driver": {
|
||||
"version": "0.7.4",
|
||||
"resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz",
|
||||
@ -11759,6 +11920,19 @@
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/websocket/node_modules/debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"dependencies": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/websocket/node_modules/ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
|
||||
},
|
||||
"node_modules/whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||
@ -11934,6 +12108,14 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/yaeti": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz",
|
||||
"integrity": "sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug==",
|
||||
"engines": {
|
||||
"node": ">=0.10.32"
|
||||
}
|
||||
},
|
||||
"node_modules/yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
|
@ -51,6 +51,7 @@
|
||||
"@mui/material": "^5.15.14",
|
||||
"@types/websocket": "^1.0.10",
|
||||
"electron-squirrel-startup": "^1.0.0",
|
||||
"nfc-pcsc": "^0.8.1",
|
||||
"node-wifi-scanner": "git+https://git.gaminggeneration.de/tobiash/node-wifi-scanner",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
|
@ -1,21 +1,36 @@
|
||||
import {client as WebSocketClient, connection} from "websocket";
|
||||
import {w3cwebsocket, IMessageEvent} from "websocket";
|
||||
|
||||
export default class CloudHandler {
|
||||
private static websocket = new WebSocketClient();
|
||||
|
||||
private static connection: connection;
|
||||
|
||||
private static connection: w3cwebsocket;
|
||||
|
||||
static connect() {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
this.websocket.connect("ws://smartmonopoly.iif.li");
|
||||
this.websocket.on("connectFailed", (err) => {
|
||||
this.connection = new w3cwebsocket('wss://smartmonopoly.iif.li');
|
||||
this.connection.onerror = (err: Error) => {
|
||||
this.connection = null;
|
||||
reject(err);
|
||||
});
|
||||
this.websocket.on("connect", (connection) => {
|
||||
this.connection = connection;
|
||||
};
|
||||
|
||||
this.connection.onopen = () => {
|
||||
resolve();
|
||||
};
|
||||
|
||||
this.connection.onclose = () => {
|
||||
this.connection = null;
|
||||
}
|
||||
|
||||
this.connection.onmessage = (e) => this.handleMessage(e);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private static handleMessage(e: IMessageEvent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static isConnected(): boolean {
|
||||
return !!this.connection;
|
||||
}
|
||||
}
|
66
src/ConfigHandler.ts
Normal file
66
src/ConfigHandler.ts
Normal file
@ -0,0 +1,66 @@
|
||||
import path from "path";
|
||||
import process from "process";
|
||||
import * as fs from "fs";
|
||||
import {Config, GameRules} from "./RawConstants";
|
||||
import {app} from "electron";
|
||||
|
||||
|
||||
export class ConfigHandler {
|
||||
private static dataPath = path.resolve(app.getPath('userData'), "config");
|
||||
private static confPath = path.resolve(this.dataPath, "config.json");
|
||||
|
||||
private static defaultConfig = {
|
||||
rules: {
|
||||
switchValues: {},
|
||||
inputValues: {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static generateDefault() {
|
||||
fs.writeFileSync(this.confPath, JSON.stringify(this.defaultConfig, null, 1));
|
||||
}
|
||||
|
||||
static get() {
|
||||
this.existsOrGenerate();
|
||||
|
||||
let confRaw = fs.readFileSync(this.confPath).toString('utf8');
|
||||
|
||||
try {
|
||||
JSON.parse(confRaw);
|
||||
} catch (e) {
|
||||
this.generateDefault();
|
||||
}
|
||||
|
||||
console.log("Config retrieved!")
|
||||
return JSON.parse(confRaw) as Config;
|
||||
}
|
||||
|
||||
static existsOrGenerate() {
|
||||
if (!fs.existsSync(this.dataPath))
|
||||
fs.mkdirSync(this.dataPath);
|
||||
|
||||
if (!fs.existsSync(this.confPath))
|
||||
this.generateDefault();
|
||||
}
|
||||
|
||||
static set(conf: Config) {
|
||||
this.existsOrGenerate();
|
||||
|
||||
let confRaw = fs.readFileSync(this.confPath).toString('utf8');
|
||||
|
||||
try {
|
||||
JSON.parse(confRaw);
|
||||
} catch (e) {
|
||||
this.generateDefault();
|
||||
}
|
||||
|
||||
|
||||
let current = JSON.parse(confRaw) as Config;
|
||||
current = {...current, ...conf};
|
||||
console.log("Config saved to " + this.confPath);
|
||||
fs.writeFileSync(this.confPath, JSON.stringify(current, null, 1));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
|
||||
|
||||
export type IPCChannel =
|
||||
'WIFI_STATUS'
|
||||
| 'WIFI_SCAN'
|
||||
| 'WIFI_LIST'
|
||||
| 'WIFI_CONNECT'
|
||||
| 'FUNCTION_TEST'
|
||||
| 'CLOUD_STATUS'
|
||||
| 'CLOUD_CONNECT'
|
||||
|
||||
|
||||
export interface IPCAnswer {
|
||||
status: boolean,
|
||||
data?: any
|
||||
}
|
||||
|
||||
export interface IPCRequest {
|
||||
data?: any,
|
||||
}
|
||||
|
||||
export interface WiFiNetwork {
|
||||
ssid: string,
|
||||
isSecured: boolean,
|
||||
isKnown?: boolean,
|
||||
psk?: string,
|
||||
rssi?: number,
|
||||
}
|
||||
|
||||
export interface FunctionTest {
|
||||
hasSudo: boolean,
|
||||
hasWPASupplicant: boolean,
|
||||
hasInternet: boolean
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
import { ipcMain } from 'electron';
|
||||
import IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
|
||||
import {IPCAnswer, IPCChannel, IPCRequest} from "./IPCConstants";
|
||||
|
||||
|
||||
export const IPCHandler = (
|
||||
channel: IPCChannel,
|
||||
listener: (
|
||||
event: IpcMainInvokeEvent,
|
||||
request: IPCRequest,
|
||||
...args: any[]
|
||||
) => Promise<IPCAnswer> | IPCAnswer
|
||||
): void => {
|
||||
ipcMain.handle(channel, listener);
|
||||
};
|
||||
|
||||
//
|
25
src/IPCMainHandler.ts
Normal file
25
src/IPCMainHandler.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { ipcMain } from 'electron';
|
||||
import IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
|
||||
import {IPCAnswer, IPCChannel, IPCListenChannels, IPCRequest} from "./RawConstants";
|
||||
|
||||
|
||||
export const IPCHandle = (
|
||||
channel: IPCChannel,
|
||||
listener: (
|
||||
event: IpcMainInvokeEvent,
|
||||
request: IPCRequest,
|
||||
...args: any[]
|
||||
) => Promise<IPCAnswer> | IPCAnswer
|
||||
): void => {
|
||||
ipcMain.handle(channel, listener);
|
||||
};
|
||||
|
||||
export const IPCSend = (
|
||||
channel: IPCListenChannels,
|
||||
message: IPCAnswer,
|
||||
...args: any
|
||||
): void => {
|
||||
console.log("Sending ", message, " to " + channel);
|
||||
|
||||
global.mainWebContents.send(channel, message, ...args);
|
||||
};
|
236
src/NFCHandler.ts
Normal file
236
src/NFCHandler.ts
Normal file
@ -0,0 +1,236 @@
|
||||
import {NFC} from "nfc-pcsc";
|
||||
import {IPCSend} from "./IPCMainHandler";
|
||||
import {
|
||||
IPCListenChannels,
|
||||
NFCAccountCard,
|
||||
NFCCard,
|
||||
NFCCardType,
|
||||
NFCPropertyCard,
|
||||
NFCTaskCard,
|
||||
PropertyColor, TaskType
|
||||
} from "./RawConstants";
|
||||
import * as fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
|
||||
export default class NFCHandler {
|
||||
public static initPCSC() {
|
||||
const nfc = new NFC(); // optionally you can pass logger
|
||||
|
||||
nfc.on('reader', reader => {
|
||||
|
||||
console.log(`${reader.name} device attached`);
|
||||
|
||||
// enable when you want to auto-process ISO 14443-4 tags (standard=TAG_ISO_14443_4)
|
||||
// when an ISO 14443-4 is detected, SELECT FILE command with the AID is issued
|
||||
// the response is available as card.data in the card event
|
||||
// see examples/basic.js line 17 for more info
|
||||
// reader.aid = 'F222222222';
|
||||
|
||||
reader.on('card', card => {
|
||||
// card is object containing following data
|
||||
// [always] String type: TAG_ISO_14443_3 (standard nfc tags like MIFARE) or TAG_ISO_14443_4 (Android HCE and others)
|
||||
// [always] String standard: same as type
|
||||
// [only TAG_ISO_14443_3] String uid: tag uid
|
||||
// [only TAG_ISO_14443_4] Buffer data: raw data from select APDU response
|
||||
|
||||
console.log(`${reader.name} card detected`, card);
|
||||
|
||||
let parsed = this.formClass(card.uid, card.data.toString("utf8"));
|
||||
if (parsed && parsed.isComplete)
|
||||
IPCSend(IPCListenChannels.NFC_CARD, {status: true, data: parsed.card});
|
||||
|
||||
IPCSend(IPCListenChannels.NFC_RAW, {status: !!parsed, data: parsed});
|
||||
});
|
||||
|
||||
reader.on('card.off', card => {
|
||||
console.log(`${reader.name} card removed`, card);
|
||||
});
|
||||
|
||||
reader.on('error', err => {
|
||||
console.log(`${reader.name} an error occurred`, err);
|
||||
});
|
||||
|
||||
reader.on('end', () => {
|
||||
console.log(`${reader.name} device removed`);
|
||||
});
|
||||
});
|
||||
|
||||
nfc.on('error', err => {
|
||||
console.log('an error occurred', err);
|
||||
});
|
||||
}
|
||||
|
||||
public static initTest() {
|
||||
fs.watchFile(path.resolve(process.cwd(), "nfc.test"), (curr, prev) => {
|
||||
let contents = fs.readFileSync(path.resolve(process.cwd(), "nfc.test")).toString("utf-8");
|
||||
let parsed = this.formClass("xyz", contents);
|
||||
if (parsed.isComplete)
|
||||
IPCSend(IPCListenChannels.NFC_CARD, {status: true, data: parsed.card});
|
||||
|
||||
IPCSend(IPCListenChannels.NFC_RAW, {status: parsed.isComplete, data: parsed.card});
|
||||
|
||||
console.log("Got NFC", parsed);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns formed nfc card or null if nothing can be parsed
|
||||
* @param uid
|
||||
* @param raw
|
||||
*/
|
||||
public static formClass(uid: string, raw: string): formClassReturn | null {
|
||||
raw = Buffer.from(raw, "base64").toString("utf-8");
|
||||
|
||||
/*
|
||||
NFC-Card FULL
|
||||
|
||||
CARD_TYPE|PROPERTIES
|
||||
|
||||
- ACCOUNT
|
||||
- PROPERTY
|
||||
- TASK
|
||||
*/
|
||||
let preParsed: NFCCard = {
|
||||
uid: uid,
|
||||
raw: raw,
|
||||
cardType: NFCCardType.INVALID,
|
||||
};
|
||||
|
||||
try {
|
||||
let parsing = raw.split("|");
|
||||
switch (parsing[0]) {
|
||||
case "PROPERTY": {
|
||||
preParsed.cardType = NFCCardType.PROPERTY;
|
||||
const splitProperty = parsing[1].split(";");
|
||||
/*
|
||||
0 Name
|
||||
1 Color
|
||||
2 Fullset Amount
|
||||
3 Buy Value
|
||||
4 Mortgage Value
|
||||
5 Rent Object (split with ,)
|
||||
0 Basic rent
|
||||
[1 Rent with 1 house
|
||||
2 Rent with 2 houses
|
||||
3 Rent with 3 houses
|
||||
4 Rent with 4 houses
|
||||
5 Rent with 1 hotel]
|
||||
6 Special Props
|
||||
""
|
||||
"TRAINSTATION"
|
||||
"UTILITY"
|
||||
*/
|
||||
let name = this.valueOr(splitProperty, 0, "");
|
||||
let color = this.valueOr(splitProperty, 1, PropertyColor.WHITE);
|
||||
let fullSetAmount = this.valueOr(splitProperty, 2, 0);
|
||||
let buyValue = this.valueOr(splitProperty, 3, 0);
|
||||
let mortgageValue = this.valueOr(splitProperty, 4, 0);
|
||||
|
||||
let rent = 0;
|
||||
let rent1 = 0;
|
||||
let rent2 = 0;
|
||||
let rent3 = 0;
|
||||
let rent4 = 0;
|
||||
let rentHotel = 0;
|
||||
if (splitProperty[5]) {
|
||||
let rentSplit = splitProperty[5].split(",");
|
||||
rent = this.valueOr(rentSplit, 0, 0);
|
||||
rent1 = this.valueOr(rentSplit, 1, undefined);
|
||||
rent2 = this.valueOr(rentSplit, 2, undefined);
|
||||
rent3 = this.valueOr(rentSplit, 3, undefined);
|
||||
rent4 = this.valueOr(rentSplit, 4, undefined);
|
||||
rentHotel = this.valueOr(rentSplit, 5, undefined);
|
||||
}
|
||||
|
||||
let specialProperties = this.valueOr(splitProperty, 6, "");
|
||||
|
||||
let propertyParsed: NFCPropertyCard = {
|
||||
...preParsed,
|
||||
name: name,
|
||||
color: color,
|
||||
fullSetAmount: fullSetAmount,
|
||||
buyValue: buyValue,
|
||||
mortgageValue: mortgageValue,
|
||||
rent: rent,
|
||||
rent1: rent1,
|
||||
rent2: rent2,
|
||||
rent3: rent3,
|
||||
rent4: rent4,
|
||||
rentHotel: rentHotel,
|
||||
specialProperties: specialProperties,
|
||||
};
|
||||
|
||||
if (splitProperty.length != 7)
|
||||
return {card: propertyParsed, isComplete: false};
|
||||
|
||||
return {card: propertyParsed, isComplete: true};
|
||||
}
|
||||
|
||||
case "ACCOUNT": {
|
||||
preParsed.cardType = NFCCardType.ACCOUNT;
|
||||
const splitAccount = parsing[1].split(";");
|
||||
let symbol = this.valueOr(splitAccount, 0, "");
|
||||
let nickname = this.valueOr(splitAccount, 1, "");
|
||||
let pin = this.valueOr(splitAccount, 2, 0);
|
||||
|
||||
const splitParsed: NFCAccountCard = {
|
||||
...preParsed,
|
||||
symbol: symbol,
|
||||
nickname: nickname,
|
||||
pin: Number.parseInt(pin)
|
||||
}
|
||||
|
||||
if (splitAccount.length != 3)
|
||||
return {card: splitParsed, isComplete: false};
|
||||
return {card: splitParsed, isComplete: true}
|
||||
}
|
||||
|
||||
case "TASK": {
|
||||
preParsed.cardType = NFCCardType.ACCOUNT;
|
||||
const splitTask = parsing[1].split(";");
|
||||
let taskType = this.valueOr(splitTask, 0, "");
|
||||
let taskAmount1 = this.valueOr(splitTask, 1, 0);
|
||||
let taskAmount2 = this.valueOr(splitTask, 2, 0);
|
||||
|
||||
const splitParsed: NFCTaskCard = {
|
||||
...preParsed,
|
||||
type: taskType as TaskType,
|
||||
amount: Number.parseInt(taskAmount1) || 0,
|
||||
amount2: Number.parseInt(taskAmount2) || 0
|
||||
}
|
||||
|
||||
if (splitTask.length < 1 || splitTask.length > 3)
|
||||
return {card: splitParsed, isComplete: false};
|
||||
|
||||
return {card: splitParsed, isComplete: true}
|
||||
}
|
||||
|
||||
default: {
|
||||
return {card: preParsed, isComplete: false};
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static valueOr(arr: string[], index: number, def: any) {
|
||||
try {
|
||||
if (arr[index])
|
||||
return arr[index];
|
||||
return def;
|
||||
} catch (e) {
|
||||
return def;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
interface formClassReturn {
|
||||
card: NFCCard;
|
||||
isComplete: boolean;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
import {WiFiNetwork} from "./IPCConstants";
|
||||
import {WiFiNetwork} from "./RawConstants";
|
||||
import {spawn, exec} from 'node:child_process';
|
||||
import * as dns from "dns";
|
||||
import * as process from "process";
|
||||
|
184
src/RawConstants.ts
Normal file
184
src/RawConstants.ts
Normal file
@ -0,0 +1,184 @@
|
||||
export type IPCChannel =
|
||||
'WIFI_SCAN'
|
||||
| 'WIFI_CONNECT'
|
||||
| 'FUNCTION_TEST'
|
||||
| 'CLOUD_STATUS'
|
||||
| 'CLOUD_CONNECT'
|
||||
| 'SETTINGS'
|
||||
| 'PREPARING'
|
||||
|
||||
export enum IPCListenChannels {
|
||||
'KEYPAD_INPUT' = 'KEYPAD_INPUT',
|
||||
'NFC_CARD' = 'NFC_CARD',
|
||||
'NFC_RAW' = 'NFC_RAW'
|
||||
}
|
||||
|
||||
export interface IPCAnswer {
|
||||
status: boolean,
|
||||
data?: any
|
||||
}
|
||||
|
||||
export interface IPCRequest {
|
||||
data?: any,
|
||||
}
|
||||
|
||||
export interface WiFiNetwork {
|
||||
ssid: string,
|
||||
isSecured: boolean,
|
||||
isKnown?: boolean,
|
||||
psk?: string,
|
||||
rssi?: number,
|
||||
}
|
||||
|
||||
export interface FunctionTest {
|
||||
hasSudo: boolean,
|
||||
hasWPASupplicant: boolean,
|
||||
hasInternet: boolean
|
||||
}
|
||||
|
||||
export type GameSwitch = {
|
||||
name: GameSwitchNames,
|
||||
label: string,
|
||||
depends?: GameSwitchNames,
|
||||
value: boolean
|
||||
}
|
||||
|
||||
export type GameInput = {
|
||||
name: GameInputNames,
|
||||
type: "number" | "text",
|
||||
label: string,
|
||||
depends?: GameSwitchNames,
|
||||
value: string
|
||||
}
|
||||
|
||||
export type GameSwitchNames =
|
||||
"GET_BONUS_PASSING_START"
|
||||
| "DOUBLE_BONUS_ON_GO"
|
||||
| "PUT_PAID_PENALTIES_IN_MIDDLE"
|
||||
| "RECEIVE_PENALTIES_AT_FREE_PARKING"
|
||||
| "PUT_10_IN_MIDDLE_AFTER_EACH_GO"
|
||||
| "STREET_MUST_BE_AUCTIONED_IF_NOT_PURCHASED"
|
||||
| "TWO_HOTELS_PER_STREET_ALLOWED"
|
||||
| "MORTGAGE_REDUCES_RENT"
|
||||
| "GOODS_GO_TO_OTHER_PLAYERS_UPON_BANKRUPTCY"
|
||||
| "STREETS_CAN_BE_SOLD_BACK_TO_THE_BANK"
|
||||
| "PRISON_CAN_BE_PURCHASED_RENT_GOES_TO_PLAYER"
|
||||
| "KEEP_MONEY_MORE_SECRET";
|
||||
|
||||
export type GameInputNames =
|
||||
"PASSING_GO_CASH"
|
||||
| "STARTING_CASH"
|
||||
| "PRISON_RELEASE_FEE"
|
||||
| "CURRENCY";
|
||||
|
||||
export interface GameRules {
|
||||
switchValues: { [key in GameSwitchNames]?: boolean },
|
||||
inputValues: { [key in GameInputNames]?: string }
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
rules?: GameRules
|
||||
}
|
||||
|
||||
export enum NFCCardType {
|
||||
INVALID = "INVALID",
|
||||
ACCOUNT = "ACCOUNT",
|
||||
PROPERTY = "PROPERTY",
|
||||
TASK = "TASK",
|
||||
}
|
||||
|
||||
export interface NFCCard {
|
||||
cardType: NFCCardType,
|
||||
uid?: string,
|
||||
raw?: string
|
||||
}
|
||||
|
||||
export enum AccountSymbols {
|
||||
HAT= "Hut",
|
||||
CAT= "Katze",
|
||||
SHOE= "Schuh",
|
||||
SHIP= "Kriegsschiff",
|
||||
RACE_CAR = "Rennauto",
|
||||
THIMBLE= "Fingerhut",
|
||||
WHEELBARROW= "Schubkarre",
|
||||
DOG = "Hund",
|
||||
IRON = "Bügeleisen",
|
||||
BATTLESHIP = "Schlachtschiff",
|
||||
TOP_HAT = "Zylinder",
|
||||
CANNON = "Kanone",
|
||||
TREX = "T-Rex",
|
||||
RUBBER_DUCK = "Gummiente",
|
||||
PENGUIN = "Pinguin",
|
||||
|
||||
PLAYTYPUS= "Schnabeltier"
|
||||
}
|
||||
|
||||
export interface NFCAccountCard extends NFCCard {
|
||||
symbol: AccountSymbols,
|
||||
nickname: string,
|
||||
pin: number
|
||||
}
|
||||
|
||||
export enum PropertyColor {
|
||||
YELLOW= "YELLOW",
|
||||
GOLD="GOLD",
|
||||
SILVER="SILVER",
|
||||
ORANGE = "ORANGE",
|
||||
PINK = "PINK",
|
||||
BEIGE="BEIGE",
|
||||
BROWN = "BROWN",
|
||||
RED ="RED",
|
||||
GREEN="GREEN",
|
||||
BLACK="BLACK",
|
||||
WHITE="WHITE",
|
||||
LIGHT_BLUE ="LIGHT_BLUE",
|
||||
DARK_BLUE = "DARK_BLUE",
|
||||
|
||||
TRAINSTATION = "TRAINSTATION",
|
||||
UTILITY = "UTILITY",
|
||||
|
||||
CUSTOM1 ="CUSTOM1",
|
||||
CUSTOM2 = "CUSTOM2",
|
||||
CUSTOM3 = "CUSTOM3"
|
||||
}
|
||||
|
||||
export type NFCPropertyCardSpecialProperties =
|
||||
"TRAINSTATION" | "UTILITY"
|
||||
|
||||
/**
|
||||
* NFC Property Card
|
||||
* NAME(str);COLOR(str);FULLSET(num);BUYVAL(num);MORTGAGEVAL(num);RENT,RENT1,RENT2,RENT3,RENT4,RENT_HOTEL,SPECIAl_PROPS
|
||||
*/
|
||||
export interface NFCPropertyCard extends NFCCard {
|
||||
name: string,
|
||||
color: PropertyColor,
|
||||
fullSetAmount: number,
|
||||
buyValue: number,
|
||||
mortgageValue: number,
|
||||
rent: number,
|
||||
rent1?: number,
|
||||
rent2?: number,
|
||||
rent3?: number,
|
||||
rent4?: number,
|
||||
rentHotel?: number,
|
||||
specialProperties: NFCPropertyCardSpecialProperties|"",
|
||||
}
|
||||
|
||||
export enum TaskType {
|
||||
GET_FROM_BANK= "GET_FROM_BANK", // 1 val
|
||||
PAY_TO_BANK= "PAY_TO_BANK", // 1 val
|
||||
PAY_TO_ALL_PLAYERS= "PAY_TO_ALL_PLAYERS", // 1 val
|
||||
PAY_FOR_PROPS= "PAY_FOR_PROPS", // 2 val
|
||||
ESCAPE_JAIL= "ESCAPE_JAIL" // 0 val
|
||||
}
|
||||
|
||||
/**
|
||||
* NFC Task Card
|
||||
* RAW: TYPE;AMOUNT;AMOUNT2
|
||||
*/
|
||||
export interface NFCTaskCard extends NFCCard {
|
||||
type: TaskType
|
||||
amount?: number,
|
||||
amount2?: number
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
import {IPCHandler} from "./IPCHandler";
|
||||
import {FunctionTest, WiFiNetwork} from "./IPCConstants";
|
||||
import {IPCHandle} from "./IPCMainHandler";
|
||||
import {FunctionTest, GameRules} from "./RawConstants";
|
||||
import OSHandler from "./OSHandler";
|
||||
import CloudHandler from "./CloudHandler";
|
||||
import {ConfigHandler} from "./ConfigHandler";
|
||||
import NFCHandler from "./NFCHandler";
|
||||
|
||||
const wifiScan = require("node-wifi-scanner");
|
||||
|
||||
@ -13,10 +15,11 @@ export default class SmartMonopoly {
|
||||
static run() {
|
||||
this.setupIPCEvents();
|
||||
OSHandler.enableAllWifis().then().catch(console.error);
|
||||
NFCHandler.initTest();
|
||||
}
|
||||
|
||||
static setupIPCEvents() {
|
||||
IPCHandler("FUNCTION_TEST", async (e, request, args) => {
|
||||
IPCHandle("FUNCTION_TEST", async (e, request, args) => {
|
||||
let data: FunctionTest = {
|
||||
hasSudo: await OSHandler.checkForSudo(),
|
||||
hasWPASupplicant: false,
|
||||
@ -29,7 +32,7 @@ export default class SmartMonopoly {
|
||||
}
|
||||
});
|
||||
|
||||
IPCHandler("WIFI_CONNECT", async (e, request, args) => {
|
||||
IPCHandle("WIFI_CONNECT", async (e, request, args) => {
|
||||
let data = request.data as { ssid: string, psk: string }
|
||||
try {
|
||||
await OSHandler.addWifi(data.ssid, data.psk);
|
||||
@ -40,7 +43,7 @@ export default class SmartMonopoly {
|
||||
}
|
||||
});
|
||||
|
||||
IPCHandler("WIFI_SCAN", async (e, request, args) => {
|
||||
IPCHandle("WIFI_SCAN", async (e, request) => {
|
||||
try {
|
||||
let networks = await OSHandler.scanWifis();
|
||||
return {status: true, data: networks};
|
||||
@ -49,13 +52,39 @@ export default class SmartMonopoly {
|
||||
}
|
||||
});
|
||||
|
||||
IPCHandler("CLOUD_CONNECT", async (e, request, args) => {
|
||||
IPCHandle("CLOUD_CONNECT", async (e, request) => {
|
||||
try {
|
||||
await CloudHandler.connect();
|
||||
return {status: true}
|
||||
return {status: true};
|
||||
} catch (e) {
|
||||
return {status: false, data: e};
|
||||
return {status: false, data: e.toString()};
|
||||
}
|
||||
});
|
||||
|
||||
IPCHandle("SETTINGS", async(e, request) => {
|
||||
if(request.data && request.data["rules"])
|
||||
{
|
||||
let rules = request.data.rules as GameRules;
|
||||
ConfigHandler.set({rules: rules});
|
||||
}
|
||||
|
||||
return {status: true, data: ConfigHandler.get()};
|
||||
});
|
||||
|
||||
IPCHandle("PREPARING", async(e, request) => {
|
||||
const useCloud = !!request.data.useCloud;
|
||||
console.log("Preparing - useCloud: " + useCloud);
|
||||
if(useCloud && !CloudHandler.isConnected())
|
||||
try {
|
||||
await CloudHandler.connect();
|
||||
}catch(e)
|
||||
{
|
||||
return {status: false, data: 'Cloud connection issue: ' + e};
|
||||
}
|
||||
|
||||
//todo when using cloud, get session etc.
|
||||
|
||||
return {status: true};
|
||||
})
|
||||
}
|
||||
}
|
1
src/global.ts
Normal file
1
src/global.ts
Normal file
@ -0,0 +1 @@
|
||||
declare var mainWebContents: Electron.WebContents;
|
@ -30,6 +30,8 @@ const createWindow = (): void => {
|
||||
|
||||
// Background
|
||||
SmartMonopoly.run();
|
||||
|
||||
global.mainWebContents = mainWindow.webContents;
|
||||
};
|
||||
|
||||
// This method will be called when Electron has finished
|
||||
|
68
src/nfc-pcsd.d.ts
vendored
Normal file
68
src/nfc-pcsd.d.ts
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
declare module 'nfc-pcsc' {
|
||||
export type ListenerSignature<L> = {
|
||||
[E in keyof L]: (...args: any[]) => any;
|
||||
};
|
||||
|
||||
export type DefaultListener = {
|
||||
[k: string]: (...args: any[]) => any;
|
||||
};
|
||||
|
||||
export class TypedEmitter<L extends ListenerSignature<L> = DefaultListener> {
|
||||
static defaultMaxListeners: number;
|
||||
addListener<U extends keyof L>(event: U, listener: L[U]): this;
|
||||
prependListener<U extends keyof L>(event: U, listener: L[U]): this;
|
||||
prependOnceListener<U extends keyof L>(event: U, listener: L[U]): this;
|
||||
removeListener<U extends keyof L>(event: U, listener: L[U]): this;
|
||||
removeAllListeners(event?: keyof L): this;
|
||||
once<U extends keyof L>(event: U, listener: L[U]): this;
|
||||
on<U extends keyof L>(event: U, listener: L[U]): this;
|
||||
off<U extends keyof L>(event: U, listener: L[U]): this;
|
||||
emit<U extends keyof L>(event: U, ...args: Parameters<L[U]>): boolean;
|
||||
eventNames<U extends keyof L>(): U[];
|
||||
listenerCount(type: keyof L): number;
|
||||
listeners<U extends keyof L>(type: U): L[U][];
|
||||
rawListeners<U extends keyof L>(type: U): L[U][];
|
||||
getMaxListeners(): number;
|
||||
setMaxListeners(n: number): this;
|
||||
}
|
||||
|
||||
type Type = 'TAG_ISO_14443_3' | 'TAG_ISO_14443_4';
|
||||
|
||||
const KEY_TYPE_A = 0x60;
|
||||
const KEY_TYPE_B = 0x61;
|
||||
|
||||
interface Card {
|
||||
type: Type;
|
||||
standard: Type;
|
||||
uid?: string;
|
||||
data?: Buffer;
|
||||
}
|
||||
|
||||
interface ReaderEmitter {
|
||||
card: (x: Card) => void;
|
||||
'card.off': (x: Card) => void;
|
||||
error: (x: Error) => void;
|
||||
end: () => void;
|
||||
}
|
||||
|
||||
export class Reader extends TypedEmitter<ReaderEmitter> {
|
||||
get name(): string;
|
||||
|
||||
authenticate(blockNumber: number, keyType: number, key: string, obsolete?: boolean): Promise<boolean>;
|
||||
|
||||
read(
|
||||
blockNumber: number,
|
||||
length: number,
|
||||
blockSize?: number,
|
||||
packetSize?: number,
|
||||
readClass?: number
|
||||
): Promise<Buffer>;
|
||||
}
|
||||
|
||||
interface NFCEmitter {
|
||||
reader: (reader: Reader) => void;
|
||||
error: (error: Error) => void;
|
||||
}
|
||||
|
||||
export class NFC extends TypedEmitter<NFCEmitter> {}
|
||||
}
|
@ -2,15 +2,14 @@
|
||||
// https://www.electronjs.org/docs/latest/tutorial/process-model#preload-scripts
|
||||
|
||||
import {ipcRenderer, contextBridge} from 'electron';
|
||||
import {IPCAnswer, IPCChannel, IPCRequest} from "./IPCConstants";
|
||||
import {IPCAnswer, IPCChannel, IPCRequest} from "./RawConstants";
|
||||
import IpcRendererEvent = Electron.IpcRendererEvent;
|
||||
|
||||
contextBridge.exposeInMainWorld('api', {
|
||||
request: (channel: IPCChannel, request: IPCRequest, ...args: any): Promise<IPCAnswer> => {
|
||||
return ipcRenderer.invoke(channel, request, ...args);
|
||||
},
|
||||
receive: (channel: IPCChannel, func: (event: IpcRendererEvent, message: IPCAnswer, ...args: any) => void) => {
|
||||
console.log("preload-receive called. args: ");
|
||||
listen: (channel: IPCChannel, func: (event: IpcRendererEvent, message: IPCAnswer, ...args: any) => void) => {
|
||||
ipcRenderer.on(channel, (event, message: IPCAnswer, ...args: any) => func(event, message, ...args));
|
||||
},
|
||||
})
|
@ -2,66 +2,16 @@ import {createRoot} from 'react-dom/client';
|
||||
import React, {Component} from "react";
|
||||
import Startup from "./Startup";
|
||||
import WiFi from "./WiFi";
|
||||
import Cloud from "./Cloud";
|
||||
import Game from "./Game";
|
||||
import GameSetup from "./GameSetup";
|
||||
import GameEnd from "./GameEnd";
|
||||
import Setup from "./Setup";
|
||||
import IPCRendererListener from "./IPCRendererListener";
|
||||
|
||||
const root = createRoot(document.getElementById("root"));
|
||||
|
||||
//window.app = window.MyNamespace || {};
|
||||
|
||||
|
||||
interface HeadingSwitcherState {
|
||||
counter: number;
|
||||
}
|
||||
|
||||
class HeadingSwitcher extends Component<{}, HeadingSwitcherState> {
|
||||
private interval: NodeJS.Timeout;
|
||||
|
||||
constructor(props: {}) {
|
||||
super(props);
|
||||
this.state = {counter: 0};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.interval = setInterval(() => this.tick(), 500);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
clearInterval(this.interval);
|
||||
}
|
||||
|
||||
tick() {
|
||||
if (this.state.counter > 5)
|
||||
this.setState({counter: 1});
|
||||
else
|
||||
this.setState({counter: this.state.counter + 1});
|
||||
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
switch (this.state.counter) {
|
||||
case 1:
|
||||
return <h1>H1</h1>;
|
||||
case 2:
|
||||
return <h2>H2</h2>;
|
||||
case 3:
|
||||
return <h3>H3</h3>;
|
||||
case 4:
|
||||
return <h4>H4</h4>;
|
||||
case 5:
|
||||
return <h5>H5</h5>;
|
||||
case 6:
|
||||
return <h6>H6</h6>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
enum PAGE {
|
||||
export enum PAGE {
|
||||
STARTUP,
|
||||
SETUP,
|
||||
WIFI,
|
||||
@ -86,6 +36,7 @@ export class App extends Component<{}, AppState> {
|
||||
currentPage: PAGE.SETUP,
|
||||
showWiFi: false,
|
||||
}
|
||||
IPCRendererListener.initialAttach();
|
||||
}
|
||||
|
||||
toggleWiFiSettings = (state: boolean) => {
|
||||
@ -102,6 +53,13 @@ export class App extends Component<{}, AppState> {
|
||||
}));
|
||||
}
|
||||
|
||||
public setPage = (page: PAGE) => {
|
||||
this.setState((prevState) => ({
|
||||
...prevState,
|
||||
currentPage: page
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
|
||||
render() {
|
||||
@ -109,7 +67,7 @@ export class App extends Component<{}, AppState> {
|
||||
<div className="app">
|
||||
{this.state.showWiFi ? <WiFi/> : null}
|
||||
|
||||
{this.state.currentPage == PAGE.STARTUP ? <Startup ref={(ref) => {
|
||||
{this.state.currentPage == PAGE.STARTUP || this.state.currentPage == PAGE.SETUP ? <Startup visible={this.state.currentPage == PAGE.STARTUP} ref={(ref) => {
|
||||
App.PAGES.set(PAGE.STARTUP, ref);
|
||||
}}/> : null}
|
||||
|
||||
@ -117,14 +75,6 @@ export class App extends Component<{}, AppState> {
|
||||
App.PAGES.set(PAGE.SETUP, ref);
|
||||
}}/> : null}
|
||||
|
||||
{this.state.currentPage == PAGE.WIFI ? <WiFi ref={(ref) => {
|
||||
App.PAGES.set(PAGE.WIFI, ref);
|
||||
}}/> : null}
|
||||
|
||||
{this.state.currentPage == PAGE.CLOUD ? <Cloud ref={(ref) => {
|
||||
App.PAGES.set(PAGE.CLOUD, ref);
|
||||
}}/> : null}
|
||||
|
||||
{this.state.currentPage == PAGE.GAME_SETUP ? <GameSetup ref={(ref) => {
|
||||
App.PAGES.set(PAGE.GAME_SETUP, ref);
|
||||
}}/> : null}
|
||||
|
449
src/web/CardSetup.tsx
Normal file
449
src/web/CardSetup.tsx
Normal file
@ -0,0 +1,449 @@
|
||||
import {
|
||||
AccountSymbols,
|
||||
NFCAccountCard,
|
||||
NFCCard,
|
||||
NFCCardType,
|
||||
NFCPropertyCard,
|
||||
NFCTaskCard,
|
||||
PropertyColor,
|
||||
TaskType
|
||||
} from "../RawConstants";
|
||||
import React, {Component} from "react";
|
||||
import {
|
||||
Backdrop,
|
||||
Box,
|
||||
Button,
|
||||
Fade,
|
||||
FormControl,
|
||||
FormControlLabel,
|
||||
FormGroup,
|
||||
FormLabel,
|
||||
Grid,
|
||||
InputLabel,
|
||||
MenuItem,
|
||||
Modal,
|
||||
Radio,
|
||||
RadioGroup,
|
||||
Select,
|
||||
TextField,
|
||||
Typography
|
||||
} from "@mui/material";
|
||||
|
||||
type AccountValues = keyof NFCAccountCard;
|
||||
type PropertyValues = keyof NFCPropertyCard;
|
||||
type TaskValues = keyof NFCTaskCard;
|
||||
|
||||
interface CardSetupState {
|
||||
NFCCardType: NFCCardType,
|
||||
|
||||
accountValues: { [key in AccountValues]?: string | number },
|
||||
propertyValues: { [key in PropertyValues]?: string | number | boolean },
|
||||
taskValues: { [key in TaskValues]?: string | TaskType | number }
|
||||
}
|
||||
|
||||
interface CardSetupProps {
|
||||
closeCallback: () => void;
|
||||
card?: NFCCard;
|
||||
validCard: boolean
|
||||
}
|
||||
|
||||
export default class CardSetup extends Component<CardSetupProps, CardSetupState> {
|
||||
constructor(props: CardSetupProps) {
|
||||
super(props);
|
||||
|
||||
let defaultType = NFCCardType.ACCOUNT;
|
||||
let accountValues: { [key in AccountValues]?: string | number } = {
|
||||
symbol: "pleaseSelect"
|
||||
};
|
||||
let propertyValues: { [key in PropertyValues]?: string | number | boolean } = {
|
||||
color: "pleaseSelect"
|
||||
};
|
||||
let taskValues: { [key in TaskValues]?: string | TaskType | number } = {
|
||||
type: "pleaseSelect"
|
||||
};
|
||||
|
||||
if (props.card) {
|
||||
defaultType = props.card.cardType as NFCCardType;
|
||||
console.log("Detected card type: " + defaultType);
|
||||
switch (defaultType) {
|
||||
case NFCCardType.ACCOUNT:
|
||||
let accountCard = props.card as NFCAccountCard;
|
||||
accountValues = {
|
||||
...accountCard
|
||||
}
|
||||
break;
|
||||
case NFCCardType.PROPERTY:
|
||||
let propertyCard = props.card as NFCPropertyCard;
|
||||
propertyValues = {
|
||||
...propertyCard
|
||||
}
|
||||
break;
|
||||
case NFCCardType.TASK:
|
||||
let taskCard = props.card as NFCTaskCard;
|
||||
taskValues = {
|
||||
...taskCard
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.state = {
|
||||
NFCCardType: defaultType,
|
||||
|
||||
accountValues: accountValues,
|
||||
propertyValues: propertyValues,
|
||||
taskValues: taskValues,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
}
|
||||
|
||||
modalStyle = {
|
||||
position: 'absolute',
|
||||
top: '50%',
|
||||
left: '50%',
|
||||
transform: 'translate(-50%, -50%)',
|
||||
width: 700,
|
||||
maxHeight: '85%',
|
||||
overflowY: 'scroll',
|
||||
height: 'auto',
|
||||
display: 'block',
|
||||
bgcolor: 'background.paper',
|
||||
border: '2px solid #0000',
|
||||
boxShadow: 24,
|
||||
p: 4,
|
||||
};
|
||||
|
||||
changeAccountState(prop: AccountValues, ev: any, useUpperCase = false) {
|
||||
this.setState(prevState => ({
|
||||
...prevState,
|
||||
accountValues: {
|
||||
...prevState.accountValues,
|
||||
[prop]: useUpperCase ? ev.target.value.toUpperCase() : ev.target.value
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
changePropertyState(prop: PropertyValues, ev: any) {
|
||||
if (prop == "fullSetAmount") {
|
||||
if (ev.target.value > 4)
|
||||
ev.target.value = 4;
|
||||
if (ev.target.value < 1)
|
||||
ev.target.value = 1;
|
||||
}
|
||||
if (prop == "buyValue" || prop == "mortgageValue" || prop.includes("rent")) {
|
||||
if (ev.target.value < 0)
|
||||
ev.target.value = 0;
|
||||
}
|
||||
|
||||
this.setState(prevState => ({
|
||||
...prevState,
|
||||
propertyValues: {
|
||||
...prevState.propertyValues,
|
||||
[prop]: ev.target.value
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
changeTaskState(prop: TaskValues, ev: any) {
|
||||
this.setState(prevState => ({
|
||||
...prevState,
|
||||
taskValues: {
|
||||
...prevState.taskValues,
|
||||
[prop]: ev.target.value
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
insertInputsPerType = () => {
|
||||
if (this.state.NFCCardType == NFCCardType.ACCOUNT) {
|
||||
return (<FormGroup sx={{m: 1}}>
|
||||
<InputLabel id="symbolLabel">Symbol</InputLabel>
|
||||
<Select
|
||||
labelId={"symbolLabel"}
|
||||
sx={{mb: 1}}
|
||||
onChange={(ev) => this.changeAccountState("symbol", ev)}
|
||||
label="Symbol "
|
||||
value={this.state.accountValues["symbol"]}
|
||||
fullWidth
|
||||
>
|
||||
<MenuItem disabled={true} value="pleaseSelect">Bitte wählen...</MenuItem>
|
||||
{Object.entries(AccountSymbols).map((ele) => (
|
||||
<MenuItem key={ele[0]} value={ele[0]}>{ele[1]}</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
<TextField sx={{mb: 1}}
|
||||
label="Nickname"
|
||||
type="text"
|
||||
value={this.state.accountValues["nickname"]}
|
||||
onChange={(ev) => this.changeAccountState("nickname", ev)}
|
||||
/>
|
||||
<TextField sx={{mb: 1}}
|
||||
label="PIN"
|
||||
type="number"
|
||||
value={this.state.accountValues["pin"]}
|
||||
onChange={(ev) => this.changeAccountState("pin", ev)}
|
||||
/>
|
||||
|
||||
</FormGroup>)
|
||||
}
|
||||
|
||||
if (this.state.NFCCardType == NFCCardType.PROPERTY) {
|
||||
return (<FormGroup sx={{m: 1}}>
|
||||
<Grid container spacing={2} sx={{width: '100%'}}>
|
||||
<Grid item xs={12} sm={12}>
|
||||
<InputLabel>Name</InputLabel>
|
||||
<TextField
|
||||
sx={{mb: 1}}
|
||||
type="text"
|
||||
value={this.state.propertyValues["name"]}
|
||||
onChange={(ev) => this.changePropertyState("name", ev)}
|
||||
fullWidth
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<InputLabel id="colorLabel">Farbcode / Typ</InputLabel>
|
||||
<Select
|
||||
labelId={"colorLabel"}
|
||||
sx={{mb: 1}}
|
||||
onChange={(ev) => this.changePropertyState("color", ev)}
|
||||
label="Farbcode / Typ "
|
||||
value={this.state.propertyValues["color"]}
|
||||
fullWidth
|
||||
>
|
||||
<MenuItem disabled={true} value="pleaseSelect">Bitte wählen...</MenuItem>
|
||||
{Object.keys(PropertyColor).map((color: string) => (
|
||||
<MenuItem key={color} value={color}>{color}</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<InputLabel>Voller Satz Anzahl</InputLabel>
|
||||
<TextField
|
||||
sx={{mb: 1}}
|
||||
type="number"
|
||||
value={this.state.propertyValues["fullSetAmount"]}
|
||||
onChange={(ev) => this.changePropertyState("fullSetAmount", ev)}
|
||||
fullWidth
|
||||
aria-valuemin={0}
|
||||
aria-valuemax={4}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<InputLabel>Kauf-Wert</InputLabel>
|
||||
<TextField
|
||||
sx={{mb: 1}}
|
||||
inputProps={{"step": 5}}
|
||||
type="number"
|
||||
value={this.state.propertyValues["buyValue"]}
|
||||
onChange={(ev) => this.changePropertyState("buyValue", ev)}
|
||||
fullWidth
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<InputLabel>Hypothek-Wert</InputLabel>
|
||||
<TextField
|
||||
sx={{mb: 1}}
|
||||
inputProps={{"step": 5}}
|
||||
type="number"
|
||||
value={this.state.propertyValues["mortgageValue"]}
|
||||
onChange={(ev) => this.changePropertyState("mortgageValue", ev)}
|
||||
fullWidth
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={4} sm={4}>
|
||||
<TextField
|
||||
type="number"
|
||||
label={"Grundmiete"}
|
||||
inputProps={{"step": 5}}
|
||||
value={this.state.propertyValues["rent"]}
|
||||
onChange={(ev) => this.changePropertyState("rent", ev)}
|
||||
helperText={"Grundmiete ohne Haus und Set"}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4} sm={4}>
|
||||
<TextField
|
||||
type="number"
|
||||
label={"Miete 1"}
|
||||
inputProps={{"step": 5}}
|
||||
value={this.state.propertyValues["rent1"]}
|
||||
onChange={(ev) => this.changePropertyState("rent1", ev)}
|
||||
helperText={"Miete bei einem Haus"}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4} sm={4}>
|
||||
<TextField
|
||||
type="number"
|
||||
label={"Miete 2"}
|
||||
inputProps={{"step": 5}}
|
||||
value={this.state.propertyValues["rent2"]}
|
||||
onChange={(ev) => this.changePropertyState("rent2", ev)}
|
||||
helperText={"Miete bei 2 Häusern"}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={4} sm={4}>
|
||||
<TextField
|
||||
type="number"
|
||||
label={"Miete 3"}
|
||||
inputProps={{"step": 5}}
|
||||
value={this.state.propertyValues["rent3"]}
|
||||
onChange={(ev) => this.changePropertyState("rent3", ev)}
|
||||
helperText={"Miete bei 3 Häusern"}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={4} sm={4}>
|
||||
<TextField
|
||||
type="number"
|
||||
label={"Miete 4"}
|
||||
inputProps={{"step": 5}}
|
||||
value={this.state.propertyValues["rent4"]}
|
||||
onChange={(ev) => this.changePropertyState("rent4", ev)}
|
||||
helperText={"Miete bei 4 Häusern"}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={4} sm={4}>
|
||||
<TextField
|
||||
type="number"
|
||||
label={"Miete Hotel"}
|
||||
inputProps={{"step": 5}}
|
||||
value={this.state.propertyValues["rentHotel"]}
|
||||
onChange={(ev) => this.changePropertyState("rentHotel", ev)}
|
||||
helperText={"Miete bei einem Hotel"}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={12}>
|
||||
<FormControl fullWidth>
|
||||
<FormLabel id="cardProperties">Besondere Eigenschaften</FormLabel>
|
||||
<RadioGroup
|
||||
row
|
||||
aria-labelledby="cardProperties"
|
||||
defaultValue={""}
|
||||
value={this.state.propertyValues["specialProperties"]}
|
||||
onChange={(ev) => this.changePropertyState("specialProperties", ev)}
|
||||
>
|
||||
<FormControlLabel value={""} control={<Radio/>} label="Keine"/>
|
||||
<FormControlLabel value="TRAINSTATION" control={<Radio/>} label="Bahnhof"/>
|
||||
<FormControlLabel value="UTILITY" control={<Radio/>} label="Versorgungswerk"/>
|
||||
<FormControlLabel value="JAIL" control={<Radio/>} label="Gefängnis"/>
|
||||
</RadioGroup>
|
||||
</FormControl>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
|
||||
</FormGroup>)
|
||||
|
||||
}
|
||||
|
||||
if (this.state.NFCCardType == NFCCardType.TASK) {
|
||||
/**
|
||||
* type: TaskType
|
||||
* amount?: number,
|
||||
* amount2?: number
|
||||
*/
|
||||
return (<FormGroup sx={{m: 1}}>
|
||||
<InputLabel id="typeLabel">Typ</InputLabel>
|
||||
<Select
|
||||
labelId={"typeLabel"}
|
||||
sx={{mb: 1}}
|
||||
onChange={(ev) => this.changeTaskState("type", ev)}
|
||||
label="Typ "
|
||||
value={this.state.taskValues["type"]}
|
||||
fullWidth
|
||||
>
|
||||
<MenuItem disabled={true} value="pleaseSelect">Bitte wählen...</MenuItem>
|
||||
{Object.keys(TaskType).map((tt: string) => (
|
||||
<MenuItem key={tt} value={tt}>{tt}</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
<TextField sx={{mb: 1}}
|
||||
label="Betrag 1"
|
||||
type="text"
|
||||
disabled={this.state.taskValues["type"] == "ESCAPE_JAIL"}
|
||||
value={this.state.taskValues["amount"]}
|
||||
onChange={(ev) => this.changeAccountState("nickname", ev)}
|
||||
helperText={this.state.taskValues["type"] == "PAY_FOR_PROPS" ? "Preis pro Haus" : "Geldbetrag"}
|
||||
/>
|
||||
<TextField sx={{mb: 1}}
|
||||
label="Betrag 2"
|
||||
type="number"
|
||||
disabled={this.state.taskValues["type"] != "PAY_FOR_PROPS"}
|
||||
value={this.state.taskValues["amount2"]}
|
||||
onChange={(ev) => this.changeAccountState("pin", ev)}
|
||||
helperText={"gfs. Preis pro Hotel"}
|
||||
/>
|
||||
</FormGroup>)
|
||||
}
|
||||
|
||||
return (<div>Bitte einen Typ selektieren um fortzufahren.<br/> </div>)
|
||||
}
|
||||
|
||||
render() {
|
||||
return (<Modal
|
||||
aria-labelledby="transition-modal-title"
|
||||
aria-describedby="transition-modal-description"
|
||||
open={true}
|
||||
onClose={() => {
|
||||
this.props.closeCallback()
|
||||
}}
|
||||
closeAfterTransition
|
||||
slots={{backdrop: Backdrop}}
|
||||
slotProps={{
|
||||
backdrop: {
|
||||
timeout: 500,
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Fade in={true}>
|
||||
<Box sx={this.modalStyle}>
|
||||
<Typography id="transition-modal-title" variant="h6" component="h2">
|
||||
NFC-Karte konfigurieren
|
||||
</Typography>
|
||||
<Typography id="transition-modal-description" sx={{mt: 2}}>
|
||||
{this.props.validCard ? "Es wurde eine gültige Spielkarte erkannt." : "Es wurde eine ungültige NFC-Karte erkannt."}
|
||||
<br/><br/>
|
||||
<div>
|
||||
<InputLabel id="nfcCardTypeLabel">Karten-Typ</InputLabel>
|
||||
<Select
|
||||
labelId="nfcCardTypeLabel"
|
||||
value={this.state.NFCCardType.toString()}
|
||||
onChange={(ev) =>
|
||||
this.setState(prevState => ({
|
||||
...prevState,
|
||||
NFCCardType: ev.target.value as NFCCardType
|
||||
}))
|
||||
}
|
||||
>
|
||||
{Object.values(NFCCardType).map(e => {
|
||||
return (
|
||||
<MenuItem key={e} value={(e)}>{(e == NFCCardType.INVALID ? "Bitte wählen" : e)}</MenuItem>
|
||||
)
|
||||
})}
|
||||
|
||||
</Select>
|
||||
</div>
|
||||
{this.insertInputsPerType()}
|
||||
<br/>
|
||||
<Button variant="contained" onClick={() => {
|
||||
this.props.closeCallback();
|
||||
}}
|
||||
color="secondary">Schließen</Button>
|
||||
|
||||
<Button variant="contained" color="primary" sx={{ml: 1}}
|
||||
onClick={() => {
|
||||
}}>Karte beschreiben</Button>
|
||||
</Typography>
|
||||
</Box>
|
||||
</Fade>
|
||||
</Modal>);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
import {Component} from "react";
|
||||
|
||||
|
||||
interface CloudState {
|
||||
|
||||
}
|
||||
|
||||
export default class Cloud extends Component<{}, CloudState> {
|
||||
constructor(props: {}) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
return <p>Test</p>
|
||||
}
|
||||
|
||||
}
|
64
src/web/GameHandler.ts
Normal file
64
src/web/GameHandler.ts
Normal file
@ -0,0 +1,64 @@
|
||||
import {PAGE} from "./App";
|
||||
import {IPCListenChannels, NFCCard} from "../RawConstants";
|
||||
import IPCRendererListener from "./IPCRendererListener";
|
||||
|
||||
export enum GAME_STATE {
|
||||
NOT_STARTED,
|
||||
PREPARING,
|
||||
PLAYING,
|
||||
END
|
||||
}
|
||||
|
||||
export default class GameHandler {
|
||||
|
||||
static GAMESTATE: GAME_STATE = GAME_STATE.NOT_STARTED;
|
||||
static attachedNFCHandler: number = 0;
|
||||
|
||||
static setGameState(state: GAME_STATE)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case GAME_STATE.NOT_STARTED:
|
||||
window.app.setPage(PAGE.STARTUP);
|
||||
break;
|
||||
case GAME_STATE.PREPARING :
|
||||
window.app.setPage(PAGE.GAME_SETUP);
|
||||
break;
|
||||
}
|
||||
|
||||
this.GAMESTATE = state;
|
||||
}
|
||||
|
||||
static attachNFCHandler(cb: (card: NFCCard) => void)
|
||||
{
|
||||
IPCRendererListener.detach(this.attachedNFCHandler);
|
||||
this.attachedNFCHandler = IPCRendererListener.attach(IPCListenChannels.NFC_CARD, (ipcMsg) => {
|
||||
if(ipcMsg.status)
|
||||
cb(ipcMsg.data as NFCCard);
|
||||
});
|
||||
}
|
||||
|
||||
static detachNFCHandler()
|
||||
{
|
||||
IPCRendererListener.detach(this.attachedNFCHandler);
|
||||
}
|
||||
|
||||
static async requestPreparing(useCloud: boolean)
|
||||
{
|
||||
let response = await window.api.request("PREPARING", {
|
||||
data:
|
||||
{
|
||||
useCloud: useCloud,
|
||||
}
|
||||
});
|
||||
|
||||
if(!response.status)
|
||||
{
|
||||
this.setGameState(GAME_STATE.NOT_STARTED);
|
||||
throw new Error(response.data);
|
||||
}
|
||||
|
||||
this.setGameState(GAME_STATE.PREPARING);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,26 +1,157 @@
|
||||
import {Component} from "react";
|
||||
import React, {Component} from "react";
|
||||
import {
|
||||
Button, Dialog,
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
DialogContentText,
|
||||
DialogTitle,
|
||||
Grid, ListItemAvatar,
|
||||
Snackbar,
|
||||
Typography,
|
||||
Avatar, ListItemText, ListItem, List, Chip
|
||||
} from "@mui/material";
|
||||
import NfcIcon from '@mui/icons-material/Nfc';
|
||||
import AddCardIcon from '@mui/icons-material/AddCard';
|
||||
import PersonAddIcon from '@mui/icons-material/PersonAdd';
|
||||
|
||||
|
||||
import GameHandler from "./GameHandler";
|
||||
import {NFCCard} from "../RawConstants";
|
||||
import {Person as PersonIcon, QrCode, RemoveDone} from "@mui/icons-material";
|
||||
import CloudIcon from "@mui/icons-material/Cloud";
|
||||
|
||||
interface GameState {
|
||||
|
||||
snackMsg: string,
|
||||
helpDialog: boolean
|
||||
}
|
||||
|
||||
export default class GameSetup extends Component<{}, GameState> {
|
||||
constructor(props: {}) {
|
||||
super(props);
|
||||
this.state = {
|
||||
snackMsg: "",
|
||||
helpDialog: true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
setTimeout(() => {
|
||||
this.setState((prevState) => ({
|
||||
...prevState,
|
||||
helpDialog: false,
|
||||
snackMsg: "Zum hinzufügen von Spielern, NFC-Karte an das Lesegerät halten!",
|
||||
}))
|
||||
}, 15000);
|
||||
|
||||
GameHandler.attachNFCHandler((card: NFCCard) => {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
||||
GameHandler.detachNFCHandler();
|
||||
}
|
||||
|
||||
render() {
|
||||
return <p>Test</p>
|
||||
return <div className="gameSetup">
|
||||
<Snackbar
|
||||
open={!!this.state.snackMsg}
|
||||
autoHideDuration={10000}
|
||||
onClose={() => {
|
||||
this.setState(prevState => ({
|
||||
...prevState,
|
||||
snackMsg: ""
|
||||
}))
|
||||
}}
|
||||
message={this.state.snackMsg}
|
||||
/>
|
||||
<Dialog
|
||||
open={this.state.helpDialog}
|
||||
onClose={() => {
|
||||
this.setState((prevState) => ({
|
||||
...prevState,
|
||||
helpDialog: false
|
||||
}))
|
||||
}}
|
||||
aria-labelledby="alert-dialog-title"
|
||||
aria-describedby="alert-dialog-description"
|
||||
>
|
||||
<DialogTitle id="alert-dialog-title">
|
||||
Spielerkarte auf Gerät legen! <AddCardIcon/>
|
||||
</DialogTitle>
|
||||
<DialogContent>
|
||||
<DialogContentText id="alert-dialog-description">
|
||||
Um eine Figur zum Spiel hinzuzufügen, musst du die NFC-Spielerkarte an den Kartenleser
|
||||
halten. <br/><br/>
|
||||
Ein kurzes Berühren reicht aus, schon sollte der Spieler in der Tabelle auftauchen! <PersonAddIcon/>
|
||||
</DialogContentText>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={() => this.setState((prevState) => ({
|
||||
...prevState,
|
||||
helpDialog: false
|
||||
}))}>
|
||||
Okay</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
|
||||
<Chip sx={{position: "absolute", top: "1%", right: "1%"}} onClick={() => {this.setState(prevState => ({
|
||||
...prevState,
|
||||
helpDialog: true
|
||||
}))}}
|
||||
label="?" color="info"
|
||||
variant="outlined"/>
|
||||
|
||||
<Typography variant="h2" >Wer spielt mit?</Typography>
|
||||
<Chip onClick={() => {this.setState(prevState => ({
|
||||
...prevState,
|
||||
snackMsg: "Um einen Spieler hinzuzufügen, lege eine NFC-Karte auf den leser!"
|
||||
}))}}
|
||||
label={<div><NfcIcon sx={{marginTop: 0.9}} className={"animationBreathe"}
|
||||
color="primary"/> NFC</div>} color="secondary"
|
||||
variant="outlined"/>
|
||||
<Grid sx={{mt: 2}} container spacing={1}>
|
||||
<Grid item xs={2}></Grid>
|
||||
<Grid justifyContent="center" alignItems="center" item xs={"auto"}>
|
||||
<List sx={{ width: '100%', minWidth: '60%', bgcolor: 'background.paper', border: "1px solid black", borderRadius: "5px" }}>
|
||||
<ListItem>
|
||||
<ListItemAvatar>
|
||||
<Avatar>
|
||||
<PersonIcon />
|
||||
</Avatar>
|
||||
</ListItemAvatar>
|
||||
<ListItemText primary="Hut" secondary="Connect+ QR-Code anzeigen" onClick={() => {console.log("connect?")}}/>
|
||||
<Button sx={{ml: 4}} variant="outlined" color="info">Umbenennen</Button>
|
||||
<Button sx={{ml: 1}} variant="outlined" color="error">Rauswerfen</Button>
|
||||
<Button disabled sx={{ml: 1}} variant="outlined" color="primary"><QrCode/></Button>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<ListItemAvatar>
|
||||
<Avatar>
|
||||
<PersonIcon />
|
||||
</Avatar>
|
||||
</ListItemAvatar>
|
||||
<ListItemText primary="Schubkarre" secondary="Connect+ QR-Code anzeigen" onClick={() => {}}/>
|
||||
<Button sx={{ml: 4}} variant="outlined" color="info">Umbenennen</Button>
|
||||
<Button sx={{ml: 1}} variant="outlined" color="error">Rauswerfen</Button>
|
||||
<Button disabled sx={{ml: 1}} variant="outlined" color="primary"><QrCode/></Button>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<ListItemAvatar>
|
||||
<Avatar>
|
||||
<CloudIcon />
|
||||
</Avatar>
|
||||
</ListItemAvatar>
|
||||
<ListItemText primary="Schuh" secondary="Connect+ verbunden" onClick={() => {}}/>
|
||||
<Button sx={{ml: 4}} variant="outlined" color="info">Umbenennen</Button>
|
||||
<Button sx={{ml: 1}} variant="outlined" color="error">Rauswerfen</Button>
|
||||
<Button disabled sx={{ml: 1}} variant="outlined" color="primary"><QrCode/></Button>
|
||||
</ListItem>
|
||||
</List>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</div>
|
||||
}
|
||||
|
||||
}
|
||||
}
|
36
src/web/IPCRendererListener.ts
Normal file
36
src/web/IPCRendererListener.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import {IPCAnswer, IPCListenChannels} from "../RawConstants";
|
||||
|
||||
type IPCListen = {
|
||||
channel: IPCListenChannels,
|
||||
fn: (message: IPCAnswer, ...args: any) => void,
|
||||
}
|
||||
|
||||
export default class IPCRendererListener {
|
||||
private static attachments: Map<number, IPCListen> = new Map<number, IPCListen>();
|
||||
private static uID = 99;
|
||||
|
||||
public static attach(event: IPCListenChannels, fn: (message: IPCAnswer, ...args: any) => void): number {
|
||||
this.uID++;
|
||||
this.attachments.set(this.uID, {fn: fn, channel: event});
|
||||
return this.uID;
|
||||
}
|
||||
|
||||
public static detach(id: number)
|
||||
{
|
||||
this.attachments.delete(id);
|
||||
}
|
||||
|
||||
|
||||
public static initialAttach()
|
||||
{
|
||||
for(let c of Object.keys(IPCListenChannels))
|
||||
{
|
||||
window.api.listen((c as unknown as IPCListenChannels), (event, message: IPCAnswer, ...args: any) => {
|
||||
for(let [a, listener] of this.attachments)
|
||||
{
|
||||
listener.fn(message, ...args);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
4
src/web/Player.ts
Normal file
4
src/web/Player.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export default class Player {
|
||||
private nickname: string;
|
||||
private figure: string;
|
||||
}
|
@ -1,44 +1,54 @@
|
||||
import React, {Component} from "react";
|
||||
import {FormControl, FormControlLabel, FormGroup, FormLabel, Grid, Switch} from "@mui/material";
|
||||
import {
|
||||
Button,
|
||||
Chip,
|
||||
FormControl,
|
||||
FormControlLabel,
|
||||
FormGroup,
|
||||
FormLabel,
|
||||
Grid,
|
||||
Snackbar,
|
||||
Switch,
|
||||
TextField,
|
||||
Typography
|
||||
} from "@mui/material";
|
||||
import RestartAltIcon from '@mui/icons-material/RestartAlt';
|
||||
import CloseIcon from '@mui/icons-material/Close';
|
||||
import SaveIcon from '@mui/icons-material/Save';
|
||||
import {PAGE} from "./App";
|
||||
import {
|
||||
Config,
|
||||
GameInput,
|
||||
GameRules,
|
||||
GameSwitch,
|
||||
GameSwitchNames,
|
||||
IPCListenChannels,
|
||||
NFCCard,
|
||||
NFCCardType,
|
||||
NFCPropertyCard,
|
||||
PropertyColor
|
||||
} from "../RawConstants";
|
||||
import NfcIcon from "@mui/icons-material/Nfc";
|
||||
import IPCRendererListener from "./IPCRendererListener";
|
||||
import CardSetup from "./CardSetup";
|
||||
|
||||
type GameSwitch = {
|
||||
name: GameSwitchNames,
|
||||
label: string,
|
||||
depends?: GameSwitchNames,
|
||||
value: boolean
|
||||
}
|
||||
|
||||
type GameSwitchNames =
|
||||
"GET_BONUS_PASSING_START"
|
||||
| "DOUBLE_BONUS_ON_GO"
|
||||
| "PUT_PAID_PENALTIES_IN_MIDDLE"
|
||||
| "RECEIVE_PENALTIES_AT_FREE_PARKING"
|
||||
| "PUT_10_IN_MIDDLE_AFTER_EACH_GO"
|
||||
| "STREET_MUST_BE_AUCTIONED_IF_NOT_PURCHASED"
|
||||
| "TWO_HOTELS_PER_STREET_ALLOWED"
|
||||
| "NO_MORTGAGE_ON_STREETS_WITH_BUILDINGS"
|
||||
| "MORTGAGE_REDUCES_RENT"
|
||||
| "GOODS_GO_TO_OTHER_PLAYERS_UPON_BANKRUPTCY"
|
||||
| "STREETS_CAN_BE_SOLD_BACK_TO_THE_BANK"
|
||||
| "PRISON_CAN_BE_PURCHASED_RENT_GOES_TO_PLAYER";
|
||||
|
||||
type GameInputs = {
|
||||
"PASSING_GO_CASH": string,
|
||||
"STARTING_CASH": string,
|
||||
"PRISON_RELEASE_FEE": string
|
||||
}
|
||||
|
||||
interface InitialSetupState {
|
||||
open: boolean,
|
||||
switchValues: GameSwitch[],
|
||||
inputValues: GameInputs
|
||||
inputValues: GameInput[],
|
||||
savedMsg: boolean,
|
||||
openNFCModal: boolean,
|
||||
nfcCard: NFCCard,
|
||||
validCard: boolean
|
||||
}
|
||||
|
||||
export default class Setup extends Component<{}, InitialSetupState> {
|
||||
constructor(props: {}) {
|
||||
super(props);
|
||||
this.state = {
|
||||
const defaultConf: InitialSetupState = {
|
||||
open: true,
|
||||
savedMsg: false,
|
||||
openNFCModal: false,
|
||||
nfcCard: null,
|
||||
validCard: false,
|
||||
switchValues: [
|
||||
{
|
||||
name: "GET_BONUS_PASSING_START",
|
||||
@ -58,7 +68,7 @@ export default class Setup extends Component<{}, InitialSetupState> {
|
||||
},
|
||||
{
|
||||
name: "RECEIVE_PENALTIES_AT_FREE_PARKING",
|
||||
label: "Bei 'Frei Parken' erhaltene Strafen",
|
||||
label: "Bei 'Frei Parken' Strafen aus der 'Mitte' einziehen",
|
||||
depends: "PUT_PAID_PENALTIES_IN_MIDDLE",
|
||||
value: true
|
||||
},
|
||||
@ -78,11 +88,6 @@ export default class Setup extends Component<{}, InitialSetupState> {
|
||||
label: "Zwei Hotels pro Straße erlaubt",
|
||||
value: false
|
||||
},
|
||||
{
|
||||
name: "NO_MORTGAGE_ON_STREETS_WITH_BUILDINGS",
|
||||
label: "Keine Hypothek auf Straßen mit Bauten",
|
||||
value: true
|
||||
},
|
||||
{
|
||||
name: "MORTGAGE_REDUCES_RENT",
|
||||
label: "Hypothek verringert Miete",
|
||||
@ -102,14 +107,72 @@ export default class Setup extends Component<{}, InitialSetupState> {
|
||||
name: "PRISON_CAN_BE_PURCHASED_RENT_GOES_TO_PLAYER",
|
||||
label: "Gefängnis kann erworben werden, Miete geht an den Spieler",
|
||||
value: false
|
||||
},
|
||||
{
|
||||
name: "KEEP_MONEY_MORE_SECRET",
|
||||
label: "Geld von anderen Spielern ungenauer anzeigen",
|
||||
value: false
|
||||
}
|
||||
|
||||
],
|
||||
inputValues: {
|
||||
"PASSING_GO_CASH": "200",
|
||||
"STARTING_CASH": "1500",
|
||||
"PRISON_RELEASE_FEE": "50"
|
||||
inputValues: [
|
||||
{
|
||||
name: "STARTING_CASH",
|
||||
type: "number",
|
||||
label: "Start Guthaben",
|
||||
value: "1500"
|
||||
},
|
||||
{
|
||||
name: "PASSING_GO_CASH",
|
||||
type: "number",
|
||||
label: "Lohn über Los",
|
||||
value: "200"
|
||||
},
|
||||
{
|
||||
name: "PRISON_RELEASE_FEE",
|
||||
type: "number",
|
||||
label: "Gefängnis Gebühren",
|
||||
value: "50"
|
||||
},
|
||||
{
|
||||
name: "CURRENCY",
|
||||
type: "text",
|
||||
label: "Währung",
|
||||
value: "€"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
export default class Setup extends Component<{}, InitialSetupState> {
|
||||
constructor(props: {}) {
|
||||
super(props);
|
||||
let x: NFCPropertyCard = {
|
||||
cardType: NFCCardType.PROPERTY,
|
||||
"name": "Test",
|
||||
mortgageValue: 2,
|
||||
rent: 100,
|
||||
buyValue: 200,
|
||||
specialProperties: "",
|
||||
color: PropertyColor.BEIGE,
|
||||
fullSetAmount: 2,
|
||||
|
||||
}
|
||||
|
||||
this.state = {
|
||||
...defaultConf,
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
reset = () => {
|
||||
this.setState(prevState => ({
|
||||
...prevState,
|
||||
...defaultConf
|
||||
}))
|
||||
|
||||
//window.api.request("")
|
||||
}
|
||||
|
||||
style = {
|
||||
@ -125,7 +188,7 @@ export default class Setup extends Component<{}, InitialSetupState> {
|
||||
};
|
||||
|
||||
onSwitch = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const { name, checked } = event.target;
|
||||
const {name, checked} = event.target;
|
||||
|
||||
this.setState((prevState) => ({
|
||||
...prevState,
|
||||
@ -141,38 +204,162 @@ export default class Setup extends Component<{}, InitialSetupState> {
|
||||
}));
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
onInput = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const {name, value} = event.target;
|
||||
|
||||
this.setState((prevState) => ({
|
||||
...prevState,
|
||||
inputValues: prevState.inputValues.map((switchObj) => {
|
||||
if (switchObj.name === name) {
|
||||
return {
|
||||
...switchObj,
|
||||
value: value
|
||||
};
|
||||
}
|
||||
return switchObj;
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
||||
getSettings = () => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
window.api.request("SETTINGS", {}).then(answer => {
|
||||
try {
|
||||
let data = answer.data as Config;
|
||||
for (let [sw, state] of Object.entries(data.rules.switchValues)) {
|
||||
this.setState((prevState) => ({
|
||||
...prevState,
|
||||
switchValues: prevState.switchValues.map((obj) => {
|
||||
if (obj.name === sw) {
|
||||
return {
|
||||
...obj,
|
||||
value: state
|
||||
};
|
||||
}
|
||||
return obj;
|
||||
})
|
||||
}));
|
||||
}
|
||||
for (let [sw, state] of Object.entries(data.rules.inputValues)) {
|
||||
this.setState((prevState) => ({
|
||||
...prevState,
|
||||
inputValues: prevState.inputValues.map((obj) => {
|
||||
if (obj.name === sw) {
|
||||
return {
|
||||
...obj,
|
||||
value: state
|
||||
};
|
||||
}
|
||||
return obj;
|
||||
})
|
||||
}));
|
||||
}
|
||||
resolve();
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
saveSettings = (silent = false) => {
|
||||
let gameSettings: any = {
|
||||
switchValues: {},
|
||||
inputValues: {}
|
||||
};
|
||||
|
||||
|
||||
for (let ele of this.state.switchValues) {
|
||||
gameSettings.switchValues[ele.name] = ele.value;
|
||||
if (!!ele.depends && ele.value)
|
||||
gameSettings.switchValues[ele.name] = this.checkDependsValue(ele.depends);
|
||||
}
|
||||
|
||||
for (let ele of this.state.inputValues) {
|
||||
gameSettings.inputValues[ele.name] = ele.value;
|
||||
}
|
||||
|
||||
window.api.request("SETTINGS", {data: {rules: gameSettings as GameRules}}).then();
|
||||
|
||||
if (!silent)
|
||||
this.setState(prevState => ({
|
||||
...prevState,
|
||||
savedMsg: true
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
onNFCRawEvent = (card: NFCCard|null, isComplete: boolean) => {
|
||||
this.setState(prevState => ({
|
||||
...prevState,
|
||||
openNFCModal: true,
|
||||
nfcCard: card,
|
||||
validCard: isComplete
|
||||
}));
|
||||
console.log(card);
|
||||
}
|
||||
|
||||
private rawNFCListener: number = 0;
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
this.rawNFCListener = IPCRendererListener.attach(IPCListenChannels.NFC_RAW, (message) => {
|
||||
this.onNFCRawEvent(message.data, message.status);
|
||||
console.log("Got an raw nfc event")
|
||||
})
|
||||
this.getSettings().then();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
IPCRendererListener.detach(this.rawNFCListener);
|
||||
}
|
||||
|
||||
handleClose = () => {
|
||||
window.app.toggleWiFiSettings(false);
|
||||
}
|
||||
|
||||
checkDependsValue = (depends: string) => {
|
||||
for(let x of this.state.switchValues)
|
||||
{
|
||||
if(x.name == depends)
|
||||
checkDependsValue = (depends: GameSwitchNames) => {
|
||||
for (let x of this.state.switchValues) {
|
||||
if (x.name == depends)
|
||||
return x.value;
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div className="setup">
|
||||
<Grid container spacing={2}>
|
||||
<Snackbar
|
||||
open={this.state.savedMsg}
|
||||
autoHideDuration={6000}
|
||||
onClose={() => {
|
||||
this.setState(prevState => ({
|
||||
...prevState,
|
||||
savedMsg: false
|
||||
}))
|
||||
}}
|
||||
message={"Einstellungen gespeichert!"}
|
||||
/>
|
||||
|
||||
|
||||
{this.state.openNFCModal &&
|
||||
<CardSetup card={this.state.nfcCard} validCard={this.state.validCard} closeCallback={() => this.setState(prevState => ({
|
||||
...prevState,
|
||||
openNFCModal: false
|
||||
}))}/>}
|
||||
<Typography variant="h2" sx={{mb: 2}}>Einstellungen</Typography>
|
||||
<Grid container spacing={3}>
|
||||
<Grid item xs={6}>
|
||||
<FormControl component="fieldset" variant="standard">
|
||||
<FormLabel component="legend">Regeln</FormLabel>
|
||||
<FormLabel component="legend">Schalter-Regeln</FormLabel>
|
||||
<FormGroup>
|
||||
{Object.values(this.state.switchValues).map(value => {
|
||||
return (
|
||||
<FormControlLabel sx={{mb: 1}}
|
||||
<FormControlLabel key={value.name} sx={{mb: 1}}
|
||||
control={
|
||||
<Switch checked={(value.value && !value.depends) || (value.value && !!value.depends && this.checkDependsValue(value.depends))} disabled={!!value.depends && !this.checkDependsValue(value.depends)} onChange={this.onSwitch}
|
||||
<Switch
|
||||
checked={(value.value && !value.depends) || (value.value && !!value.depends && this.checkDependsValue(value.depends))}
|
||||
disabled={!!value.depends && !this.checkDependsValue(value.depends)}
|
||||
onChange={this.onSwitch}
|
||||
name={value.name}/>
|
||||
} label={value.label}
|
||||
/>)
|
||||
@ -182,14 +369,47 @@ export default class Setup extends Component<{}, InitialSetupState> {
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
<FormControl component="fieldset" variant="standard">
|
||||
<FormLabel component="legend">Standardwerte</FormLabel>
|
||||
<FormLabel component="legend">Werte-Regeln</FormLabel>
|
||||
<FormGroup>
|
||||
|
||||
{Object.values(this.state.inputValues).map(value => {
|
||||
return (
|
||||
<FormControlLabel key={value.name} sx={{mb: 2}}
|
||||
control={
|
||||
<TextField type={value.type} variant="standard"
|
||||
value={value.value}
|
||||
disabled={!!value.depends && !this.checkDependsValue(value.depends)}
|
||||
onChange={this.onInput}
|
||||
name={value.name}/>
|
||||
} label={value.label}
|
||||
/>)
|
||||
})}
|
||||
</FormGroup>
|
||||
</FormControl>
|
||||
<FormControl sx={{mt: 5, mb: 1}} component="fieldset" variant="standard">
|
||||
<FormLabel component="legend">Spielkarten</FormLabel>
|
||||
<Typography sx={{ml: -2}} width={"95%"} variant="body1"><Chip
|
||||
label={<div><NfcIcon sx={{marginTop: 0.9}} className={"animationBreathe"}
|
||||
color="primary"/> NFC</div>} color="secondary"
|
||||
variant="outlined"/><br/>Bitte die Karte an das Lesegerät halten, um sie zu
|
||||
konfigurieren.<br/>Anschließend können die Einstellungen der Karte im Dialog angepasst
|
||||
werden.</Typography>
|
||||
</FormControl>
|
||||
</Grid>
|
||||
<Grid item xs={3.5}></Grid>
|
||||
<Grid item xs={"auto"} alignItems="center">
|
||||
<Button variant="contained" color="secondary" onClick={() => {
|
||||
this.getSettings().then(r => window.app.setPage(PAGE.STARTUP));
|
||||
}}>Abbrechen <CloseIcon/></Button>
|
||||
<Button sx={{ml: 2}} variant="outlined" color="error"
|
||||
onClick={() => this.reset()}>Zurücksetzen <RestartAltIcon/></Button>
|
||||
<Button sx={{ml: 2}} variant="contained" color="success" onClick={() => {
|
||||
this.saveSettings();
|
||||
window.app.setPage(PAGE.STARTUP);
|
||||
}}>Speichern <SaveIcon/></Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
|
||||
</div>
|
||||
}
|
||||
|
||||
|
@ -2,41 +2,53 @@ import React, {Component} from "react";
|
||||
import {
|
||||
Backdrop,
|
||||
Box,
|
||||
CircularProgress,
|
||||
Fade,
|
||||
Modal,
|
||||
Stack,
|
||||
Typography,
|
||||
Button,
|
||||
Chip,
|
||||
CircularProgress,
|
||||
Dialog,
|
||||
DialogTitle, DialogContent, DialogContentText, DialogActions, Chip, FormControl, Snackbar
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
DialogContentText,
|
||||
DialogTitle,
|
||||
Fade,
|
||||
FormControl,
|
||||
Modal,
|
||||
Snackbar,
|
||||
Stack,
|
||||
Typography, Zoom
|
||||
} from "@mui/material";
|
||||
import {FunctionTest} from "../IPCConstants";
|
||||
import {FunctionTest} from "../RawConstants";
|
||||
import SettingsIcon from '@mui/icons-material/Settings';
|
||||
import PlayCircleIcon from '@mui/icons-material/PlayCircle';
|
||||
import CloudOffIcon from '@mui/icons-material/CloudOff';
|
||||
import CloudIcon from '@mui/icons-material/Cloud';
|
||||
import {PAGE} from "./App";
|
||||
import GameHandler from "./GameHandler";
|
||||
|
||||
interface StartupProps {
|
||||
visible: boolean
|
||||
}
|
||||
|
||||
interface StartupState {
|
||||
statusTxt: string,
|
||||
openCloudConnectModal: boolean,
|
||||
showStartBtn: boolean,
|
||||
isConnected: boolean,
|
||||
cloudErrorMsg: string,
|
||||
isCloudConnected: boolean,
|
||||
snackErrorMsg: string,
|
||||
isConnectionIssue: boolean,
|
||||
startCounter: number,
|
||||
}
|
||||
|
||||
export default class Startup extends Component<{}, StartupState> {
|
||||
constructor(props: {}) {
|
||||
export default class Startup extends Component<StartupProps, StartupState> {
|
||||
constructor(props: StartupProps) {
|
||||
super(props);
|
||||
this.state = {
|
||||
statusTxt: "Smart-Monopoly wird gestartet...",
|
||||
openCloudConnectModal: false,
|
||||
showStartBtn: false,
|
||||
isConnected: false,
|
||||
isCloudConnected: false,
|
||||
isConnectionIssue: false,
|
||||
cloudErrorMsg: "",
|
||||
snackErrorMsg: "",
|
||||
startCounter: 10,
|
||||
};
|
||||
}
|
||||
@ -62,17 +74,44 @@ export default class Startup extends Component<{}, StartupState> {
|
||||
let response = await window.api.request("CLOUD_CONNECT", {});
|
||||
this.setState((prevState) => ({
|
||||
...prevState,
|
||||
cloudErrorMsg: response.data.toString()
|
||||
snackErrorMsg: "Fehler:" + response.data.toString(),
|
||||
isCloudConnected: response.status,
|
||||
isConnectionIssue: !response.status,
|
||||
}));
|
||||
console.log(response)
|
||||
return response.status;
|
||||
} catch (e) {
|
||||
this.setState((prevState) => ({
|
||||
...prevState,
|
||||
snackErrorMsg: "Ein unerwarteter Fehler ist aufgetreten.",
|
||||
}));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
startupBtnClick = () => {
|
||||
// Startup handle
|
||||
this.setState(prevState => ({
|
||||
...prevState,
|
||||
showStartBtn: false,
|
||||
statusTxt: "Kapitalismus an die Macht!"
|
||||
}));
|
||||
setTimeout(async () => {
|
||||
try {
|
||||
let resp = await GameHandler.requestPreparing(this.state.isCloudConnected);
|
||||
} catch(e)
|
||||
{
|
||||
this.setState(prevState => ({
|
||||
...prevState,
|
||||
showStartBtn: true,
|
||||
snackErrorMsg: "Start fehlgeschlagen! \n" + e.toString()
|
||||
}));
|
||||
await this.cloudDecision(false);
|
||||
}
|
||||
}, 1500)
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
style = {
|
||||
@ -88,13 +127,12 @@ export default class Startup extends Component<{}, StartupState> {
|
||||
};
|
||||
|
||||
|
||||
|
||||
async cloudDecision(decision: boolean) {
|
||||
this.setState((prevState) => ({
|
||||
...prevState,
|
||||
openCloudConnectModal: false,
|
||||
isConnectionIssue: false,
|
||||
isConnected: false,
|
||||
isCloudConnected: false,
|
||||
startCounter: 30
|
||||
}));
|
||||
clearInterval(this.counterInterval);
|
||||
@ -124,20 +162,20 @@ export default class Startup extends Component<{}, StartupState> {
|
||||
...prevState,
|
||||
statusTxt: "Bereit zum Spielen?",
|
||||
showStartBtn: true,
|
||||
isConnectionIssue: !connected,
|
||||
isConnected: connected
|
||||
})
|
||||
)
|
||||
if(connected)
|
||||
if (connected)
|
||||
this.counterInterval = setInterval(() => {
|
||||
if(this.state.startCounter == 0) {
|
||||
if (!this.props.visible) return;
|
||||
|
||||
if (this.state.startCounter == 0) {
|
||||
clearInterval(this.counterInterval);
|
||||
this.startupBtnClick();
|
||||
return;
|
||||
}
|
||||
this.setState((prevState) => ({
|
||||
...prevState,
|
||||
startCounter: prevState.startCounter-1
|
||||
startCounter: prevState.startCounter - 1
|
||||
}));
|
||||
|
||||
}, 1000);
|
||||
@ -151,29 +189,35 @@ export default class Startup extends Component<{}, StartupState> {
|
||||
startCounter: 30
|
||||
}));
|
||||
this.counterInterval = setInterval(() => {
|
||||
this.setState((prevState) => ({
|
||||
...prevState,
|
||||
startCounter: prevState.startCounter-1
|
||||
}));
|
||||
if(this.state.startCounter == 0) {
|
||||
if (!this.props.visible) return;
|
||||
|
||||
if (this.state.startCounter == 0) {
|
||||
clearInterval(this.counterInterval);
|
||||
this.startupBtnClick();
|
||||
return;
|
||||
}
|
||||
this.setState((prevState) => ({
|
||||
...prevState,
|
||||
startCounter: prevState.startCounter - 1
|
||||
}));
|
||||
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div className="startup">
|
||||
return <div className={`startup ${this.props.visible ? '' : 'hidden'}`}>
|
||||
<Snackbar
|
||||
open={this.state.cloudErrorMsg != ""}
|
||||
open={this.state.snackErrorMsg != ""}
|
||||
autoHideDuration={8000}
|
||||
onClose={() => {this.setState(prevState => ({
|
||||
onClose={() => {
|
||||
this.setState(prevState => ({
|
||||
...prevState,
|
||||
cloudErrorMsg: ""
|
||||
}))}}
|
||||
message={this.state.cloudErrorMsg}
|
||||
snackErrorMsg: ""
|
||||
}))
|
||||
}}
|
||||
message={this.state.snackErrorMsg}
|
||||
/>
|
||||
<Dialog
|
||||
open={this.state.isConnectionIssue}
|
||||
@ -226,7 +270,8 @@ export default class Startup extends Component<{}, StartupState> {
|
||||
<i>Dafür wird eine WiFi-Verbindung hergestellt</i>
|
||||
<br/>
|
||||
<br/>
|
||||
<Button variant="contained" sx={{mr: 1}} onClick={() => this.cloudDecision(true)}>Ja</Button>
|
||||
<Button variant="contained" sx={{mr: 1}}
|
||||
onClick={() => this.cloudDecision(true)}>Ja</Button>
|
||||
<Button variant="contained" onClick={() => this.cloudDecision(false)}
|
||||
color="error">Nein</Button>
|
||||
</Typography>
|
||||
@ -243,16 +288,24 @@ export default class Startup extends Component<{}, StartupState> {
|
||||
|
||||
<Box alignItems="center" sx={{width: '100%'}}>
|
||||
<FormControl sx={{mr: 2, minWidth: '30%'}}>
|
||||
{this.state.showStartBtn && <Button color="secondary" variant="contained">Setup <SettingsIcon/></Button>}
|
||||
<Zoom in={this.state.showStartBtn}><Button color="secondary"
|
||||
onClick={() => window.app.setPage(PAGE.SETUP)}
|
||||
variant="contained">Einstellungen <SettingsIcon/></Button></Zoom>
|
||||
</FormControl>
|
||||
<FormControl sx={{minWidth: '30%'}}>
|
||||
{this.state.showStartBtn && <Button color="success" variant="contained">Start <Chip sx={{ml: 1}} size="small" label={this.state.startCounter} /> <PlayCircleIcon/></Button>}
|
||||
<Zoom in={this.state.showStartBtn}><Button color="success"
|
||||
onClick={() => this.startupBtnClick()}
|
||||
variant="contained">Start <Chip sx={{ml: 1}}
|
||||
size="small"
|
||||
label={this.state.startCounter}/>
|
||||
<PlayCircleIcon/></Button></Zoom>
|
||||
</FormControl>
|
||||
</Box>
|
||||
<Chip sx={{mt: 3}} color={this.state.isConnected ? "success" : "default"} onClick={() => this.setState(prevState => ({
|
||||
<Chip sx={{mt: 3}} color={this.state.isCloudConnected ? "success" : "default"}
|
||||
disabled={!this.state.showStartBtn} onClick={() => this.setState(prevState => ({
|
||||
...prevState,
|
||||
openCloudConnectModal: true
|
||||
}))} label={this.state.isConnected ? <CloudIcon/> : <CloudOffIcon />}/>
|
||||
}))} label={this.state.isCloudConnected ? <CloudIcon/> : <CloudOffIcon/>}/>
|
||||
|
||||
</Stack>
|
||||
</div>
|
||||
|
@ -17,7 +17,7 @@ import {
|
||||
|
||||
import WifiPasswordIcon from "@mui/icons-material/WifiPassword";
|
||||
import WifiIcon from "@mui/icons-material/Wifi";
|
||||
import {IPCAnswer, WiFiNetwork} from "../IPCConstants";
|
||||
import {IPCAnswer, WiFiNetwork} from "../RawConstants";
|
||||
|
||||
|
||||
interface WiFiState {
|
||||
|
@ -7,3 +7,38 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.animationBreathe {
|
||||
animation: breathing 2.5s ease-out infinite normal;
|
||||
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
@keyframes breathing {
|
||||
0% {
|
||||
-webkit-transform: scale(0.9);
|
||||
-ms-transform: scale(0.9);
|
||||
transform: scale(0.9);
|
||||
}
|
||||
|
||||
25% {
|
||||
-webkit-transform: scale(1.2);
|
||||
-ms-transform: scale(1.2);
|
||||
transform: scale(1.2);
|
||||
}
|
||||
|
||||
80% {
|
||||
-webkit-transform: scale(0.9);
|
||||
-ms-transform: scale(0.9);
|
||||
transform: scale(0.9);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: scale(0.9);
|
||||
-ms-transform: scale(0.9);
|
||||
transform: scale(0.9);
|
||||
}
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
import {IPCAnswer, IPCChannel, IPCRequest} from "../IPCConstants";
|
||||
import {IPCAnswer, IPCChannel, IPCListenChannels, IPCRequest} from "../RawConstants";
|
||||
import IpcRendererEvent = Electron.IpcRendererEvent;
|
||||
import {App} from "./App"
|
||||
import {App} from "./App";
|
||||
|
||||
export {}
|
||||
declare global {
|
||||
interface Window {
|
||||
"api": {
|
||||
request: (channel: IPCChannel, request: IPCRequest, ...args: any) => Promise<IPCAnswer>;
|
||||
listen: (channel: IPCChannel, func: (event: IpcRendererEvent, message: IPCAnswer, ...args: any) => void) => void;
|
||||
listen: (channel: IPCListenChannels, func: (event: IpcRendererEvent, message: IPCAnswer, ...args: any) => void) => void;
|
||||
}
|
||||
app: App;
|
||||
}
|
||||
|
66
yarn.lock
66
yarn.lock
@ -840,6 +840,14 @@
|
||||
mkdirp "^1.0.4"
|
||||
rimraf "^3.0.2"
|
||||
|
||||
"@pokusew/pcsclite@^0.6.0":
|
||||
version "0.6.0"
|
||||
resolved "https://registry.yarnpkg.com/@pokusew/pcsclite/-/pcsclite-0.6.0.tgz#30ae3fbf9d1137f2a1b343c32cd8569be581ba2d"
|
||||
integrity sha512-jX7zRXM2Or5Pms1AFjNtawsXDjLiZOzOUo7Sf0put7Pnq/EKIR9g0KvTx62HtwdPpVP6hWHGydUTHgIi9PxodQ==
|
||||
dependencies:
|
||||
bindings "^1.5.0"
|
||||
nan "^2.14.0"
|
||||
|
||||
"@popperjs/core@^2.11.8":
|
||||
version "2.11.8"
|
||||
resolved "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz"
|
||||
@ -1144,7 +1152,7 @@
|
||||
|
||||
"@types/websocket@^1.0.10":
|
||||
version "1.0.10"
|
||||
resolved "https://registry.yarnpkg.com/@types/websocket/-/websocket-1.0.10.tgz#804b1a02780da522f5742bc184a6d16a2eb78c7c"
|
||||
resolved "https://registry.npmjs.org/@types/websocket/-/websocket-1.0.10.tgz"
|
||||
integrity sha512-svjGZvPB7EzuYS94cI7a+qhwgGU1y89wUgjT6E2wVUfmAGIvRfT7obBvRtnhXCSsoMdlG4gBFGE7MfkIXZLoww==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
@ -1700,6 +1708,13 @@ binary-extensions@^2.0.0:
|
||||
resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz"
|
||||
integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==
|
||||
|
||||
bindings@^1.5.0:
|
||||
version "1.5.0"
|
||||
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df"
|
||||
integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==
|
||||
dependencies:
|
||||
file-uri-to-path "1.0.0"
|
||||
|
||||
bl@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz"
|
||||
@ -1802,7 +1817,7 @@ buffer@^5.5.0:
|
||||
|
||||
bufferutil@^4.0.1:
|
||||
version "4.0.8"
|
||||
resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.8.tgz#1de6a71092d65d7766c4d8a522b261a6e787e8ea"
|
||||
resolved "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.8.tgz"
|
||||
integrity sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==
|
||||
dependencies:
|
||||
node-gyp-build "^4.3.0"
|
||||
@ -2239,7 +2254,7 @@ csstype@^3.0.2, csstype@^3.1.3:
|
||||
|
||||
d@1, d@^1.0.1, d@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/d/-/d-1.0.2.tgz#2aefd554b81981e7dccf72d6842ae725cb17e5de"
|
||||
resolved "https://registry.npmjs.org/d/-/d-1.0.2.tgz"
|
||||
integrity sha512-MOqHvMWF9/9MX6nza0KgvFH4HpMU0EF5uUDXqX/BtxtU8NfB0QzRtJ8Oe/6SuS4kbhyzVJwjd97EA4PKrzJ8bw==
|
||||
dependencies:
|
||||
es5-ext "^0.10.64"
|
||||
@ -2721,7 +2736,7 @@ es-to-primitive@^1.2.1:
|
||||
|
||||
es5-ext@^0.10.35, es5-ext@^0.10.50, es5-ext@^0.10.62, es5-ext@^0.10.64, es5-ext@~0.10.14:
|
||||
version "0.10.64"
|
||||
resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.64.tgz#12e4ffb48f1ba2ea777f1fcdd1918ef73ea21714"
|
||||
resolved "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.64.tgz"
|
||||
integrity sha512-p2snDhiLaXe6dahss1LddxqEm+SkuDvV8dnIQG0MWjyHpcMNfXKPE+/Cc0y+PhxJX3A4xGNeFCj5oc0BUh6deg==
|
||||
dependencies:
|
||||
es6-iterator "^2.0.3"
|
||||
@ -2736,7 +2751,7 @@ es6-error@^4.1.1:
|
||||
|
||||
es6-iterator@^2.0.3:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7"
|
||||
resolved "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz"
|
||||
integrity sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==
|
||||
dependencies:
|
||||
d "1"
|
||||
@ -2745,7 +2760,7 @@ es6-iterator@^2.0.3:
|
||||
|
||||
es6-symbol@^3.1.1, es6-symbol@^3.1.3:
|
||||
version "3.1.4"
|
||||
resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.4.tgz#f4e7d28013770b4208ecbf3e0bf14d3bcb557b8c"
|
||||
resolved "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.4.tgz"
|
||||
integrity sha512-U9bFFjX8tFiATgtkJ1zg25+KviIXpgRvRHS8sau3GfhVzThRQrOeksPeT0BWW2MNZs1OEWJ1DPXOQMn0KKRkvg==
|
||||
dependencies:
|
||||
d "^1.0.2"
|
||||
@ -2877,7 +2892,7 @@ eslint@^8.0.1:
|
||||
|
||||
esniff@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/esniff/-/esniff-2.0.1.tgz#a4d4b43a5c71c7ec51c51098c1d8a29081f9b308"
|
||||
resolved "https://registry.npmjs.org/esniff/-/esniff-2.0.1.tgz"
|
||||
integrity sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg==
|
||||
dependencies:
|
||||
d "^1.0.1"
|
||||
@ -2930,7 +2945,7 @@ etag@~1.8.1:
|
||||
|
||||
event-emitter@^0.3.5:
|
||||
version "0.3.5"
|
||||
resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39"
|
||||
resolved "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz"
|
||||
integrity sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==
|
||||
dependencies:
|
||||
d "1"
|
||||
@ -3032,7 +3047,7 @@ express@^4.17.1, express@^4.17.3:
|
||||
|
||||
ext@^1.7.0:
|
||||
version "1.7.0"
|
||||
resolved "https://registry.yarnpkg.com/ext/-/ext-1.7.0.tgz#0ea4383c0103d60e70be99e9a7f11027a33c4f5f"
|
||||
resolved "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz"
|
||||
integrity sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==
|
||||
dependencies:
|
||||
type "^2.7.2"
|
||||
@ -3102,6 +3117,11 @@ file-entry-cache@^6.0.1:
|
||||
dependencies:
|
||||
flat-cache "^3.0.4"
|
||||
|
||||
file-uri-to-path@1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd"
|
||||
integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==
|
||||
|
||||
filename-reserved-regex@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz"
|
||||
@ -4054,7 +4074,7 @@ is-typed-array@^1.1.13:
|
||||
|
||||
is-typedarray@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
|
||||
resolved "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz"
|
||||
integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==
|
||||
|
||||
is-unicode-supported@^0.1.0:
|
||||
@ -4619,6 +4639,11 @@ multicast-dns@^7.2.5:
|
||||
dns-packet "^5.2.2"
|
||||
thunky "^1.0.2"
|
||||
|
||||
nan@^2.14.0:
|
||||
version "2.19.0"
|
||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.19.0.tgz#bb58122ad55a6c5bc973303908d5b16cfdd5a8c0"
|
||||
integrity sha512-nO1xXxfh/RWNxfd/XPfbIfFk5vgLsAxUR9y5O0cHMJu/AW9U95JLXqthYHjEp+8gQ5p96K9jUp8nbVOxCdRbtw==
|
||||
|
||||
nanoid@^3.3.7:
|
||||
version "3.3.7"
|
||||
resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz"
|
||||
@ -4646,9 +4671,16 @@ neo-async@^2.6.2:
|
||||
|
||||
next-tick@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb"
|
||||
resolved "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz"
|
||||
integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==
|
||||
|
||||
nfc-pcsc@^0.8.1:
|
||||
version "0.8.1"
|
||||
resolved "https://registry.yarnpkg.com/nfc-pcsc/-/nfc-pcsc-0.8.1.tgz#76882be17842cb832a72b76345e665c8108ff049"
|
||||
integrity sha512-wEfacG0dwPVZOG/WY28Mk3P4Q+yz6q7LnjpnZvdFddx3iXavEXiGhftRZXBtudr0NrzH1MrGWSkWq77tef7BMA==
|
||||
dependencies:
|
||||
"@pokusew/pcsclite" "^0.6.0"
|
||||
|
||||
nice-try@^1.0.4:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz"
|
||||
@ -4695,7 +4727,7 @@ node-forge@^1:
|
||||
|
||||
node-gyp-build@^4.3.0:
|
||||
version "4.8.0"
|
||||
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.0.tgz#3fee9c1731df4581a3f9ead74664369ff00d26dd"
|
||||
resolved "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.0.tgz"
|
||||
integrity sha512-u6fs2AEUljNho3EYTJNBfImO5QTo/J/1Etd+NVdCj7qWKUSN/bSLkZwhDv7I+w/MSC6qJ4cknepkAYykDdK8og==
|
||||
|
||||
node-gyp@^9.0.0:
|
||||
@ -6284,7 +6316,7 @@ type-is@~1.6.18:
|
||||
|
||||
type@^2.7.2:
|
||||
version "2.7.2"
|
||||
resolved "https://registry.yarnpkg.com/type/-/type-2.7.2.tgz#2376a15a3a28b1efa0f5350dcf72d24df6ef98d0"
|
||||
resolved "https://registry.npmjs.org/type/-/type-2.7.2.tgz"
|
||||
integrity sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==
|
||||
|
||||
typed-array-buffer@^1.0.2:
|
||||
@ -6333,7 +6365,7 @@ typed-array-length@^1.0.5:
|
||||
|
||||
typedarray-to-buffer@^3.1.5:
|
||||
version "3.1.5"
|
||||
resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080"
|
||||
resolved "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz"
|
||||
integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==
|
||||
dependencies:
|
||||
is-typedarray "^1.0.0"
|
||||
@ -6412,7 +6444,7 @@ username@^5.1.0:
|
||||
|
||||
utf-8-validate@^5.0.2:
|
||||
version "5.0.10"
|
||||
resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.10.tgz#d7d10ea39318171ca982718b6b96a8d2442571a2"
|
||||
resolved "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz"
|
||||
integrity sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==
|
||||
dependencies:
|
||||
node-gyp-build "^4.3.0"
|
||||
@ -6589,7 +6621,7 @@ websocket-extensions@>=0.1.1:
|
||||
|
||||
websocket@^1.0.34:
|
||||
version "1.0.34"
|
||||
resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.34.tgz#2bdc2602c08bf2c82253b730655c0ef7dcab3111"
|
||||
resolved "https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz"
|
||||
integrity sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==
|
||||
dependencies:
|
||||
bufferutil "^4.0.1"
|
||||
@ -6720,7 +6752,7 @@ y18n@^5.0.5:
|
||||
|
||||
yaeti@^0.0.6:
|
||||
version "0.0.6"
|
||||
resolved "https://registry.yarnpkg.com/yaeti/-/yaeti-0.0.6.tgz#f26f484d72684cf42bedfb76970aa1608fbf9577"
|
||||
resolved "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz"
|
||||
integrity sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug==
|
||||
|
||||
yallist@^4.0.0:
|
||||
|
Reference in New Issue
Block a user