diff options
author | LawnCable <lawncable.tmw2@simonlaux.de> | 2018-05-22 01:32:10 -0400 |
---|---|---|
committer | LawnCable <lawncable.tmw2@simonlaux.de> | 2018-05-22 01:32:10 -0400 |
commit | 4fdd86da90dd811378b153de31da542f9fabb355 (patch) | |
tree | 59f78e5cdf361b9f513c6f3dd5f23639841b5d7e | |
parent | d6ff248cee446218392567296cfcd2fb8723b066 (diff) | |
download | electron-4fdd86da90dd811378b153de31da542f9fabb355.tar.gz electron-4fdd86da90dd811378b153de31da542f9fabb355.tar.bz2 electron-4fdd86da90dd811378b153de31da542f9fabb355.tar.xz electron-4fdd86da90dd811378b153de31da542f9fabb355.zip |
started update logic for windows - only downloads the zip for now
-rw-r--r-- | assets/index.css | 16 | ||||
-rw-r--r-- | assets/index.html | 5 | ||||
-rw-r--r-- | package-lock.json | 176 | ||||
-rw-r--r-- | package.json | 4 | ||||
-rw-r--r-- | src/main.ts | 22 | ||||
-rw-r--r-- | src/main/manaplus/manaApp/manaApp.interface.ts | 8 | ||||
-rw-r--r-- | src/main/manaplus/manaApp/windows.ts | 58 | ||||
-rw-r--r-- | src/main/manaplus/manaplus.ts | 61 | ||||
-rw-r--r-- | src/main/manaplus/update/updater.interface.ts | 6 | ||||
-rw-r--r-- | src/main/status.ts | 19 | ||||
-rw-r--r-- | src/main/util/downloader.ts | 28 | ||||
-rw-r--r-- | src/renderer/index.ts | 13 | ||||
-rw-r--r-- | src/renderer/serverView.ts | 3 | ||||
-rw-r--r-- | tsconfig.json | 3 |
14 files changed, 266 insertions, 156 deletions
diff --git a/assets/index.css b/assets/index.css index 148f818..97845c5 100644 --- a/assets/index.css +++ b/assets/index.css @@ -84,6 +84,7 @@ html, body { box-shadow: 0px 0px 2px 1px rgb(0, 0, 0); overflow: hidden; z-index: 20; + position: relative; } #play { @@ -190,7 +191,7 @@ html, body { color: #c1c1c1; } .sidebarItem > .colapse > div > svg { - margin-right:4pt; + margin-right: 4pt; color: magenta; } @@ -288,3 +289,16 @@ html, body { height:16pt; margin-left: 3pt; } + +#activity { + position: absolute; + height: 100%; + padding:3pt; + right: 4pt; + color:darkgrey; + font-family: SourceSansPro; +} + +#activity.error { + color:red; +} diff --git a/assets/index.html b/assets/index.html index 2e75101..d651178 100644 --- a/assets/index.html +++ b/assets/index.html @@ -27,9 +27,10 @@ <div class="sidebar" id="sidebar"></div> </div> <div class="footer"> + <div id="activity"></div> <button id="play">Play</button> - <span>Logged in as <b>LawnCable<b></span> - <span><progress value="22" max="100"></progress>Setting up something</span> + <span>Logged in as <b>LawnCable</b></span> + <progress id="progress" value="0" max="100"></progress> </div> </div> diff --git a/package-lock.json b/package-lock.json index 5e78c96..9ec8365 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,6 @@ "version": "5.5.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", - "dev": true, "requires": { "co": "4.6.0", "fast-deep-equal": "1.1.0", @@ -37,14 +36,12 @@ "asn1": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", - "dev": true + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" }, "assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" }, "async-limiter": { "version": "1.0.0", @@ -54,20 +51,17 @@ "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, "aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", - "dev": true + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" }, "aws4": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", - "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==", - "dev": true + "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" }, "balanced-match": { "version": "1.0.0", @@ -79,21 +73,11 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", - "dev": true, "optional": true, "requires": { "tweetnacl": "0.14.5" } }, - "boom": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", - "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", - "dev": true, - "requires": { - "hoek": "4.2.1" - } - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -129,14 +113,12 @@ "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", - "dev": true + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", - "dev": true + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" }, "code-point-at": { "version": "1.1.0", @@ -148,7 +130,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", - "dev": true, "requires": { "delayed-stream": "1.0.0" } @@ -205,28 +186,7 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "cryptiles": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", - "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", - "dev": true, - "requires": { - "boom": "5.2.0" - }, - "dependencies": { - "boom": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", - "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", - "dev": true, - "requires": { - "hoek": "4.2.1" - } - } - } + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "currently-unhandled": { "version": "0.4.1", @@ -241,7 +201,6 @@ "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "dev": true, "requires": { "assert-plus": "1.0.0" } @@ -270,8 +229,7 @@ "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, "discord-rpc": { "version": "3.0.0-beta.10", @@ -303,7 +261,6 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", - "dev": true, "optional": true, "requires": { "jsbn": "0.1.1" @@ -355,8 +312,7 @@ "extend": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", - "dev": true + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" }, "extract-zip": { "version": "1.6.6", @@ -373,20 +329,17 @@ "extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" }, "fast-deep-equal": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", - "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", - "dev": true + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" }, "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", - "dev": true + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" }, "fd-slicer": { "version": "1.0.1", @@ -410,14 +363,12 @@ "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" }, "form-data": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", - "dev": true, "requires": { "asynckit": "0.4.0", "combined-stream": "1.0.6", @@ -453,7 +404,6 @@ "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "dev": true, "requires": { "assert-plus": "1.0.0" } @@ -481,37 +431,17 @@ "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" }, "har-validator": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", - "dev": true, "requires": { "ajv": "5.5.2", "har-schema": "2.0.0" } }, - "hawk": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", - "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", - "dev": true, - "requires": { - "boom": "4.3.1", - "cryptiles": "3.1.2", - "hoek": "4.2.1", - "sntp": "2.1.0" - } - }, - "hoek": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", - "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==", - "dev": true - }, "home-path": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/home-path/-/home-path-1.0.6.tgz", @@ -528,7 +458,6 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "dev": true, "requires": { "assert-plus": "1.0.0", "jsprim": "1.4.1", @@ -602,8 +531,7 @@ "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, "is-utf8": { "version": "0.2.1", @@ -620,33 +548,28 @@ "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "dev": true + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true, "optional": true }, "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" }, "json-schema-traverse": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", - "dev": true + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, "jsonfile": { "version": "2.4.0", @@ -661,7 +584,6 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "dev": true, "requires": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", @@ -728,14 +650,12 @@ "mime-db": { "version": "1.33.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", - "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==", - "dev": true + "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" }, "mime-types": { "version": "2.1.18", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", - "dev": true, "requires": { "mime-db": "1.33.0" } @@ -800,7 +720,7 @@ "minimist": "1.2.0", "pretty-bytes": "1.0.4", "progress-stream": "1.2.0", - "request": "2.86.0", + "request": "2.87.0", "single-line-log": "1.1.2", "throttleit": "0.0.2" } @@ -814,8 +734,7 @@ "oauth-sign": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", - "dev": true + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" }, "object-assign": { "version": "4.1.1", @@ -887,8 +806,7 @@ "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "dev": true + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, "pify": { "version": "2.3.0", @@ -945,14 +863,12 @@ "punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" }, "qs": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", - "dev": true + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" }, "rc": { "version": "1.2.7", @@ -1019,10 +935,9 @@ } }, "request": { - "version": "2.86.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.86.0.tgz", - "integrity": "sha512-BQZih67o9r+Ys94tcIW4S7Uu8pthjrQVxhsZ/weOwHbDfACxvIyvnAbzFQxjy1jMtvFSzv5zf4my6cZsJBbVzw==", - "dev": true, + "version": "2.87.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", + "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", "requires": { "aws-sign2": "0.7.0", "aws4": "1.7.0", @@ -1032,7 +947,6 @@ "forever-agent": "0.6.1", "form-data": "2.3.2", "har-validator": "5.0.3", - "hawk": "6.0.2", "http-signature": "1.2.0", "is-typedarray": "1.0.0", "isstream": "0.1.2", @@ -1047,6 +961,21 @@ "uuid": "3.2.1" } }, + "request-progress": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-3.0.0.tgz", + "integrity": "sha1-TKdUCBx/7GP1BeT6qCWqBs1mnb4=", + "requires": { + "throttleit": "1.0.0" + }, + "dependencies": { + "throttleit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", + "integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=" + } + } + }, "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", @@ -1087,15 +1016,6 @@ "resolved": "https://registry.npmjs.org/snekfetch/-/snekfetch-3.6.4.tgz", "integrity": "sha512-NjxjITIj04Ffqid5lqr7XdgwM7X61c/Dns073Ly170bPQHLm6jkmelye/eglS++1nfTWktpP6Y2bFXjdPlQqdw==" }, - "sntp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", - "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", - "dev": true, - "requires": { - "hoek": "4.2.1" - } - }, "spdx-correct": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.0.tgz", @@ -1138,7 +1058,6 @@ "version": "1.14.1", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz", "integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=", - "dev": true, "requires": { "asn1": "0.2.3", "assert-plus": "1.0.0", @@ -1230,7 +1149,6 @@ "version": "2.3.4", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", - "dev": true, "requires": { "punycode": "1.4.1" } @@ -1245,7 +1163,6 @@ "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "dev": true, "requires": { "safe-buffer": "5.1.2" } @@ -1254,7 +1171,6 @@ "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true, "optional": true }, "typedarray": { @@ -1278,8 +1194,7 @@ "uuid": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", - "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==", - "dev": true + "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==" }, "validate-npm-package-license": { "version": "3.0.3", @@ -1295,7 +1210,6 @@ "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "dev": true, "requires": { "assert-plus": "1.0.0", "core-util-is": "1.0.2", diff --git a/package.json b/package.json index 795cbfb..3398a7f 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,8 @@ "node_modules" ], "dependencies": { - "discord-rpc": "^3.0.0-beta.10" + "discord-rpc": "^3.0.0-beta.10", + "request": "^2.87.0", + "request-progress": "^3.0.0" } } diff --git a/src/main.ts b/src/main.ts index 40e999f..b9662dc 100644 --- a/src/main.ts +++ b/src/main.ts @@ -74,15 +74,12 @@ ipcMain.on('debug', (event:any, arg:any)=> { mainWindow.webContents.closeDevTools(); else mainWindow.webContents.openDevTools(); + + Status.setActivity("Debug menue Toggled") }); import {Status} from './main/status'; -ipcMain.on('play', (event:any, arg:any)=> { - console.log("play", arg); - Status.setPlaying(true); - Status.setProgress(500); - setTimeout(()=>{Status.setPlaying(false);Status.removeProgress();}, 10000); -}); + //import {quit as drpcQuit} from './main/richpresence'; @@ -90,3 +87,16 @@ ipcMain.on('play', (event:any, arg:any)=> { app.on('quit', () => { //drpcQuit(); }); + + +import { ManaPlus } from './main/manaplus/manaplus'; + +ManaPlus.init(); + +ipcMain.on('play', async (event:any, arg:any) => { + console.log("play", arg); + Status.setPlaying(true); + await ManaPlus.start(arg.server,arg.port,arg.engine,arg.username,arg.password); + //Status.showError("Failed To Launch Mana Plus","Not implemented yet!","Launch Manaplus faild: Not Implemented"); + return false; +}); diff --git a/src/main/manaplus/manaApp/manaApp.interface.ts b/src/main/manaplus/manaApp/manaApp.interface.ts index 81368e6..f70b26a 100644 --- a/src/main/manaplus/manaApp/manaApp.interface.ts +++ b/src/main/manaplus/manaApp/manaApp.interface.ts @@ -1,6 +1,8 @@ -export default interface ManaPlusApplication { - constructor():void, +export interface ManaPlusApp { run(parameters:string[]):void, getGameDir():string, - getVersion():Promise<string> + getVersion():Promise<string>, + isInstalled():boolean, + updateAvailible():Promise<{isNewVersion:boolean, newestVersion:string}>, + update():Promise<any> } diff --git a/src/main/manaplus/manaApp/windows.ts b/src/main/manaplus/manaApp/windows.ts new file mode 100644 index 0000000..0728e32 --- /dev/null +++ b/src/main/manaplus/manaApp/windows.ts @@ -0,0 +1,58 @@ +import { ManaPlusApp } from './manaApp.interface'; +import { app } from 'electron'; +//import * as path from 'path'; +import * as fs from 'fs'; +import { Status } from '../../status'; +import {download, Progress as ProgressType} from '../../util/downloader'; + +export class ManaPlusAppWindows implements ManaPlusApp { + private path:string; + + constructor(){ + const ManaPath = app.getPath('userData')+"\\manaplus"; + fs.existsSync(ManaPath) || fs.mkdirSync(ManaPath); + fs.existsSync(app.getPath('userData')+"\\temp") || fs.mkdirSync(app.getPath('userData')+"\\temp"); + this.path = ManaPath; + } + run(parameters: string[]): void { + + } + getGameDir(): string { + return this.path; + } + getVersion(): Promise<string> { + throw new Error("Not Installed."); + } + isInstalled(): boolean { + return fs.existsSync(this.path+"\\Mana\\manaplus.exe"); + } + + async update() { + // Get Update URL + Status.setProgress(500); + Status.setActivity("Fetching Download URL"); + //// TODO: Fetch update url + Status.setProgress(-1); + const downloadURL = 'https://[URL]/Mana.zip'; + try { + await download(downloadURL, `${app.getPath('userData')}\\temp\\update.zip`, (state:ProgressType) => { + Status.setProgress(Math.floor(state.percent*100)); + Status.setActivity(`Downloading ManaPlus... ${state.speed}`); + console.log(state); + }); + } catch (e){ + console.log(e); + Status.showError("ManaPlus download failed", e.message, `DL Failed: ${e.message}`); + throw new Error("Download Error"); + } + Status.setProgress(100); + Status.setActivity(`ManaPlus download completed`); + Status.showError("Unziping isn't implemented yet", "WIP", "not further implemented") + + + return 0; + } + updateAvailible(): Promise<{ isNewVersion: boolean; newestVersion: string; }> { + throw new Error("Method not implemented."); + } +} diff --git a/src/main/manaplus/manaplus.ts b/src/main/manaplus/manaplus.ts new file mode 100644 index 0000000..dfa86a7 --- /dev/null +++ b/src/main/manaplus/manaplus.ts @@ -0,0 +1,61 @@ +import { ManaPlusApp } from './ManaApp/manaApp.interface'; +import { ManaPlusAppWindows } from './ManaApp/windows'; +import * as os from 'os'; + +let ManaPlusInstance:ManaPlusApp; + +export namespace ManaPlus{ + + export const ERRORS = { + NOT_INITILIZED_YET_ERROR:new Error("The ManaPlus updater wasn't initilized") + } + + export function init(){ + if(os.platform() == "win32"){ + ManaPlusInstance = new ManaPlusAppWindows(); + console.log("GameDir:"+ManaPlusInstance.getGameDir()); + } + } + + export async function update(){ + if(!wasInitilized())throw ERRORS.NOT_INITILIZED_YET_ERROR; + + return await ManaPlusInstance.update(); + } + + export async function start(server: any,engine: any,port: any,username: any,password: any){ + + const params = makeParams(server,engine,port,username,password); + let willUpdate:boolean=false; + // check if it is installed + willUpdate = !ManaPlusInstance.isInstalled(); + //Check if update is availible and ask if the user wants to update + //TODO + + // Install/Update the gameclient if needed + if(willUpdate){ + await update(); + } + + //IDEA have client data updated here to, if needed + ManaPlusInstance.run(params); + + } +} + +function wasInitilized(){ + return typeof(ManaPlusInstance) !== "undefined" && typeof(ManaPlusInstance) !== "undefined"; +} + +function makeParams(server: any,engine: any,port: any,username: any,password: any):string[]{ + // TODO check if everything is there + var parameters = [ + "-s"+server, + "-y"+engine, + "-p"+port, + "-U"+username, + "-P"+password, + ]; + // TODO make this function real + return []; +} diff --git a/src/main/manaplus/update/updater.interface.ts b/src/main/manaplus/update/updater.interface.ts deleted file mode 100644 index 1524649..0000000 --- a/src/main/manaplus/update/updater.interface.ts +++ /dev/null @@ -1,6 +0,0 @@ -export default interface ManaUpdater { - constructor():void, - updateAvailible():Promise<{isNewVersion:boolean, newestVersion:string}>, - update():Promise<any>, - reinstall():Promise<any> -} diff --git a/src/main/status.ts b/src/main/status.ts index ffd6551..537e31b 100644 --- a/src/main/status.ts +++ b/src/main/status.ts @@ -1,8 +1,10 @@ import { mainWindow } from '../main'; +import { dialog } from 'electron'; type STATUS = { progress:number, activity:string, + ActivityIsError:boolean, playing:boolean, } @@ -10,6 +12,7 @@ const status:STATUS = { progress:null, activity:null, playing:false, //Is manaplus starting or started + ActivityIsError:false, } export namespace Status { @@ -23,10 +26,22 @@ export namespace Status { } export function setActivity(value: string){ status.activity=value; + status.ActivityIsError=false; updateStatus(); } - export function setPlaying(value: boolean){ - status.playing=value; + export function removeActivity(value: string){ + status.activity=null; + status.ActivityIsError=false; + updateStatus(); + } + export function showError(title:string, message:string, activityMsg:string=message){ + status.activity = activityMsg; + status.ActivityIsError = true; + updateStatus(); + setTimeout(()=>{dialog.showErrorBox(title, message);},300); + } + export function setPlaying(playing: boolean){ + status.playing=playing; updateStatus(); } export function getStatus():STATUS{ diff --git a/src/main/util/downloader.ts b/src/main/util/downloader.ts new file mode 100644 index 0000000..075097d --- /dev/null +++ b/src/main/util/downloader.ts @@ -0,0 +1,28 @@ +var fs = require('fs'); +var request = require('request'); +var progress = require('request-progress'); + +export type Progress = { + percent:number, + speed:number, + size:{ + total:number, + transfered:number + }, + time:{ + elapsed:number, + remaining:number + } +}; + +export function download(url:string,targetLocation:string,onprogress: (state:Progress)=>void):Promise<any>{ + return new Promise((resolve:any,reject:any)=>{ + progress(request(url), { + throttle: 500 + }) + .on('progress', onprogress) + .on('error', reject) + .on('end', resolve) + .pipe(fs.createWriteStream(targetLocation)); + }); +} diff --git a/src/renderer/index.ts b/src/renderer/index.ts index 944ee90..f83bd3f 100644 --- a/src/renderer/index.ts +++ b/src/renderer/index.ts @@ -18,7 +18,7 @@ document.ondragover = document.ondrop = (event) => { }; -const debugBtn = document.getElementById('debug'); +const debugBtn = document.getElementById('debug'); //debugBtn.hidden = true; @@ -26,3 +26,14 @@ debugBtn.addEventListener('click', () => { debugBtn.blur(); ipcRenderer.send('debug'); }); + +const activityLabel = document.getElementById('activity'); +const progressBar = document.getElementById('progress') as HTMLProgressElement; +ipcRenderer.on('status-update', (event:any, status:any) => { + activityLabel.innerText = status.activity; + if(status.ActivityIsError) + activityLabel.classList.add("error"); + else + activityLabel.classList.remove("error"); + progressBar.value = status.progress; +}) diff --git a/src/renderer/serverView.ts b/src/renderer/serverView.ts index 48ce923..3229187 100644 --- a/src/renderer/serverView.ts +++ b/src/renderer/serverView.ts @@ -104,8 +104,7 @@ function setBackground(){ } ipcRenderer.on('status-update', (event:any, status:any) => { - const message = `Asynchronous message reply: ${status}` - console.log(message, status); + // Everything that isnt server view related is in index.ts playBtn.disabled = status.playing; }) diff --git a/tsconfig.json b/tsconfig.json index e9a283b..3cec2f5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,8 @@ "baseUrl": ".", "paths": { "*": ["node_modules/*"] - } + }, + "lib": [ "es2016", "dom" ] }, "include": [ "src/**/*" |