From 5def7c7962db09d8297b0591767af6b919b9d498 Mon Sep 17 00:00:00 2001 From: UnchartedBull Date: Tue, 30 Jun 2020 16:25:45 +0200 Subject: [PATCH 1/9] updated update notifier --- src/app/app.service.ts | 11 +++++------ src/app/main-menu/main-menu.component.html | 1 + src/app/main-menu/main-menu.component.scss | 10 ++++++++++ src/app/main-menu/main-menu.component.ts | 4 ++++ src/app/settings/settings.component.html | 20 +++++++++++++------- src/app/settings/settings.component.scss | 9 ++++++++- src/app/settings/settings.component.ts | 2 +- src/assets/made-in-berlin.png | Bin 10671 -> 8496 bytes 8 files changed, 42 insertions(+), 15 deletions(-) diff --git a/src/app/app.service.ts b/src/app/app.service.ts index 14a70c27f..1f7216161 100644 --- a/src/app/app.service.ts +++ b/src/app/app.service.ts @@ -14,6 +14,7 @@ export class AppService { private ipc: any; private version: string; private latestVersion: string; + public updateAvailable = false; public constructor( private configService: ConfigService, @@ -62,18 +63,16 @@ export class AppService { }); this.ipc.on("customStylesError", (_, customCSSError: string): void => { - this.notificationService.setError("Can't get custom styles!", customCSSError); + this.notificationService.setError("Can't load custom styles!", customCSSError); }); } private checkUpdate(): void { this.http.get("https://api.github.com/repos/UnchartedBull/OctoDash/releases/latest").subscribe( (data: GitHubReleaseInformation): void => { - if (this.version !== data.name.replace("v", "")) { - this.notificationService.setUpdate( - "It's time for an update", - `Version ${data.name} is available now, while you're on v${this.version}. Consider updating :)` - ); + //FIXME + if (this.version !== data.name.replace("va", "")) { + this.updateAvailable = true; } this.latestVersion = data.name.replace("v", ""); }, diff --git a/src/app/main-menu/main-menu.component.html b/src/app/main-menu/main-menu.component.html index b232f5dae..53ff1f1da 100644 --- a/src/app/main-menu/main-menu.component.html +++ b/src/app/main-menu/main-menu.component.html @@ -3,6 +3,7 @@ >OctoDash. + - + diff --git a/src/app/main-screen/main-screen.component.html b/src/app/main-screen/main-screen.component.html index 01fa8007d..516091925 100644 --- a/src/app/main-screen/main-screen.component.html +++ b/src/app/main-screen/main-screen.component.html @@ -1,11 +1,14 @@ -
+ +
+
-
+
+ diff --git a/src/app/settings/settings.component.html b/src/app/settings/settings.component.html index b4bcbadd4..794c7596b 100644 --- a/src/app/settings/settings.component.html +++ b/src/app/settings/settings.component.html @@ -547,11 +547,15 @@
- v1.5.0 + v{{ service.version }} - © 2019-2020 UnchartedBull @@ -601,3 +605,4 @@
+ diff --git a/src/app/settings/settings.component.ts b/src/app/settings/settings.component.ts index 7eb2c6dfa..01e4f07d6 100644 --- a/src/app/settings/settings.component.ts +++ b/src/app/settings/settings.component.ts @@ -10,7 +10,7 @@ import { NotificationService } from "../notification/notification.service"; styleUrls: ["./settings.component.scss"], }) export class SettingsComponent implements OnInit { - @Output() private closeFunction = new EventEmitter(); + @Output() closeFunction = new EventEmitter(); @ViewChild("settingsMain") private settingsMain: ElementRef; @ViewChild("settingsGeneral") private settingsGeneral: ElementRef; @ViewChild("settingsOctoDash") private settingsOctoDash: ElementRef; @@ -27,11 +27,11 @@ export class SettingsComponent implements OnInit { "Bottom Left", "Bottom Right", ]; - public version: string; private overwriteNoSave = false; private pages = []; // eslint-disable-next-line @typescript-eslint/no-explicit-any private ipc: any; + public update = false; public constructor( private configService: ConfigService, @@ -40,23 +40,13 @@ export class SettingsComponent implements OnInit { ) { this.config = this.configService.getCurrentConfig(); this.config = this.configService.revertConfigForInput(this.config); - this.getVersion(); - if (window.require) { - try { - this.ipc = window.require("electron").ipcRenderer; - } catch (e) { - this.notificationService.setError( - "Can't connect to backend", - "Please open an issue for GitHub as this shouldn't happen." - ); - } - } - } - - private getVersion(): void { - this.version = this.service.getVersion(); - if (this.version === undefined) { - setTimeout(this.getVersion.bind(this), 3500); + try { + this.ipc = window.require("electron").ipcRenderer; + } catch (e) { + this.notificationService.setError( + "Can't connect to backend", + "Please restart your system. If the issue persists open an issue on GitHub." + ); } } @@ -114,4 +104,12 @@ export class SettingsComponent implements OnInit { this.configService.updateConfig(); this.ipc.send("reload", ""); } + + public showUpdate(): void { + this.update = true; + } + + public hideUpdate(): void { + this.update = false; + } } diff --git a/src/app/update/update.component.html b/src/app/update/update.component.html new file mode 100644 index 000000000..01e6cb07d --- /dev/null +++ b/src/app/update/update.component.html @@ -0,0 +1,8 @@ +
+ downloading update ... +
+
0.4 MB/s
+
+ 115.5MB + 01:25 minutes left +
diff --git a/src/app/update/update.component.scss b/src/app/update/update.component.scss new file mode 100644 index 000000000..b6bb6e10e --- /dev/null +++ b/src/app/update/update.component.scss @@ -0,0 +1,57 @@ +.update { + &-container { + position: absolute; + z-index: 20; + top: 10vh; + left: 20vw; + height: 81vh; + width: 60vw; + background-color: #353b48; + border-radius: 2vw; + } + + &-progress-bar { + height: 5.5vh; + border-radius: 2vh; + background-color: #44bd32; + width: 25vw; + transition: width 0.7s ease-in-out; + font-size: 0.5rem; + text-align: right; + vertical-align: center; + padding-top: 1.5vh; + padding-right: 1vw; + + &__wrapper { + background-color: #718093; + width: 50vw; + margin: 14vh auto 3vh; + display: block; + height: 7vh; + background-color: transparent; + border: 3px solid #f5f6fa; + border-radius: 3vh; + } + } + + &-heading { + display: block; + text-align: center; + margin-top: 12vh; + } + + &-size__total { + display: block; + text-align: right; + font-size: 0.6rem; + margin-right: 5vw; + margin-top: -2vh; + opacity: 0.6; + } + + &-time__remaining { + display: block; + text-align: center; + margin-top: 10vh; + } +} diff --git a/src/app/update/update.component.ts b/src/app/update/update.component.ts new file mode 100644 index 000000000..adb97f344 --- /dev/null +++ b/src/app/update/update.component.ts @@ -0,0 +1,45 @@ +import { Component, EventEmitter, OnInit, Output } from "@angular/core"; + +import { AppService } from "../app.service"; +import { NotificationService } from "../notification/notification.service"; + +@Component({ + selector: "app-update", + templateUrl: "./update.component.html", + styleUrls: ["./update.component.scss"], +}) +export class UpdateComponent implements OnInit { + @Output() closeFunction = new EventEmitter(true); + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + private ipc: any; + + constructor(public service: AppService, private notificationService: NotificationService) { + try { + this.ipc = window.require("electron").ipcRenderer; + } catch (e) { + this.notificationService.setError( + "Can't connect to backend", + "Please restart your system. If the issue persists open an issue on GitHub." + ); + } + } + + ngOnInit(): void { + if (!this.service.latestVersion || this.service.getLatestVersionAssetsURL()) { + this.notificationService.setWarning( + "Can't initiate update!", + "Some information is missing, please try again in an hour or update manually." + ); + this.closeFunction.emit(); + } else { + this.update(this.service.getLatestVersionAssetsURL()); + } + } + + private update(assetsURL: string): void { + this.ipc.send("update", { + assetsURL: assetsURL, + }); + } +} From d7334a4c378c2eb1897b42cc89f15e1f67024660 Mon Sep 17 00:00:00 2001 From: UnchartedBull Date: Fri, 10 Jul 2020 22:20:12 +0200 Subject: [PATCH 4/9] error handling --- main.js | 11 +++++------ src/app/main-screen/main-screen.component.html | 8 ++++---- src/app/update/update.component.ts | 16 +++++++++++++++- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/main.js b/main.js index 87d26cb27..c01de1497 100644 --- a/main.js +++ b/main.js @@ -142,12 +142,11 @@ function sendVersionInfo() { } function downloadUpdate(updateInfo) { - exec("arch", (err, stdout, stderr) => { - if (err) { - console.log(err); - } - if (stderr) { - console.error(stderr); + exec("archs", (err, stdout, stderr) => { + if (err || stderr) { + window.webContents.send("updateError", { + error: err ? err : { message: stderr }, + }); } console.log(stdout); console.log(updateInfo); diff --git a/src/app/main-screen/main-screen.component.html b/src/app/main-screen/main-screen.component.html index 516091925..07eec8f31 100644 --- a/src/app/main-screen/main-screen.component.html +++ b/src/app/main-screen/main-screen.component.html @@ -1,14 +1,14 @@ -
- + +
-
- + +
diff --git a/src/app/update/update.component.ts b/src/app/update/update.component.ts index adb97f344..b35016f20 100644 --- a/src/app/update/update.component.ts +++ b/src/app/update/update.component.ts @@ -26,20 +26,34 @@ export class UpdateComponent implements OnInit { } ngOnInit(): void { - if (!this.service.latestVersion || this.service.getLatestVersionAssetsURL()) { + if (!this.service.latestVersion || !this.service.getLatestVersionAssetsURL()) { this.notificationService.setWarning( "Can't initiate update!", "Some information is missing, please try again in an hour or update manually." ); this.closeFunction.emit(); } else { + this.setupListeners(); this.update(this.service.getLatestVersionAssetsURL()); } } + private setupListeners(): void { + this.ipc.on("updateError", (_, updateError: UpdateError): void => { + this.notificationService.setError("Can't install update!", updateError.error.message); + }); + } + private update(assetsURL: string): void { this.ipc.send("update", { assetsURL: assetsURL, }); } } + +interface UpdateError { + error: { + message: string; + stack?: string; + }; +} From 2872a33d6459c2ac4713282e284e2e68b9aceb59 Mon Sep 17 00:00:00 2001 From: UnchartedBull Date: Wed, 15 Jul 2020 19:11:54 +0200 Subject: [PATCH 5/9] automatically retrieve download url for arch --- main.js | 38 +- package-lock.json | 462 ++++++++++++++---- package.json | 1 + .../main-screen/main-screen.component.html | 8 +- src/app/update/update.component.ts | 1 + 5 files changed, 415 insertions(+), 95 deletions(-) diff --git a/main.js b/main.js index c01de1497..bfd9c9832 100644 --- a/main.js +++ b/main.js @@ -1,17 +1,19 @@ /* eslint-disable no-undef */ /* eslint-disable @typescript-eslint/no-var-requires */ const { app, BrowserWindow, ipcMain } = require("electron"); -const url = require("url"); -const path = require("path"); +const electronStore = require("electron-store"); const fs = require("fs"); -const Store = require("electron-store"); +const got = require('got'); +const path = require("path"); +const url = require("url"); -const store = new Store(); const exec = require("child_process").exec; +const store = new electronStore(); + const args = process.argv.slice(1); -const dev = args.some((val) => val === "--serve"); const big = args.some((val) => val === "--big"); +const dev = args.some((val) => val === "--serve"); app.commandLine.appendSwitch("touch-events", "enabled"); app.allowRendererProcessReuse = true; @@ -142,14 +144,34 @@ function sendVersionInfo() { } function downloadUpdate(updateInfo) { - exec("archs", (err, stdout, stderr) => { + exec("arch", (err, stdout, stderr) => { if (err || stderr) { window.webContents.send("updateError", { error: err ? err : { message: stderr }, }); } - console.log(stdout); - console.log(updateInfo); + got(updateInfo.assetsURL) + .then((releaseFiles) => { + let downloadURL; + for (let package of JSON.parse(releaseFiles.body)) { + //FIXME + // if (package.name.includes(stdout)) downloadURL = package.browser_download_url; + if (package.name.includes("armv7l")) downloadURL = package.browser_download_url; + } + if (downloadURL) { + console.log(downloadURL) + } else { + window.webContents.send("updateError", { + error: { + message: `Can't find matching package for architecture ${stdout}.` + } + }) + } + }) + .catch((error) => { + error.message = `Can't load releases. ${error.message}`; + window.webContents.send("updateError", {error}); + }) }); } diff --git a/package-lock.json b/package-lock.json index e8a99d6c3..fdd423980 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1825,6 +1825,68 @@ "sumchecker": "^3.0.1" }, "dependencies": { + "@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", + "dev": true + }, + "@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "dev": true, + "requires": { + "defer-to-connect": "^1.0.1" + } + }, + "cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "dev": true, + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "dependencies": { + "get-stream": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", + "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true + } + } + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "defer-to-connect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", + "dev": true + }, "fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -1835,6 +1897,73 @@ "jsonfile": "^4.0.0", "universalify": "^0.1.0" } + }, + "got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "dev": true, + "requires": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + } + }, + "http-cache-semantics": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "dev": true + }, + "json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", + "dev": true + }, + "keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "dev": true, + "requires": { + "json-buffer": "3.0.0" + } + }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true + }, + "normalize-url": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", + "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", + "dev": true + }, + "p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", + "dev": true + }, + "responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "dev": true, + "requires": { + "lowercase-keys": "^1.0.0" + } } } }, @@ -2151,18 +2280,16 @@ } }, "@sindresorhus/is": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", - "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", - "dev": true + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-3.0.0.tgz", + "integrity": "sha512-kqA5I6Yun7PBHk8WN9BBP1c7FfN2SrD05GuVSEYPqDb4nerv7HqYfgBfMIKmT/EuejURkJKLZuLyGKGs6WEG9w==" }, "@szmarczak/http-timer": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", - "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", - "dev": true, + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.5.tgz", + "integrity": "sha512-PyRA9sm1Yayuj5OIoJ1hGt2YISX45w9WcFbh6ddT0Z/0yaFxOtGLInr4jUfU1EAFVs0Yfyfev4RNwBlUaHdlDQ==", "requires": { - "defer-to-connect": "^1.0.1" + "defer-to-connect": "^2.0.0" } }, "@types/ajv": { @@ -2174,6 +2301,17 @@ "ajv": "*" } }, + "@types/cacheable-request": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.1.tgz", + "integrity": "sha512-ykFq2zmBGOCbpIXtoVbz4SKY5QriWPh3AjyU4G74RYbtt5yOc5OfaY75ftjg7mikMOla1CTGpX3lLbuJh8DTrQ==", + "requires": { + "@types/http-cache-semantics": "*", + "@types/keyv": "*", + "@types/node": "*", + "@types/responselike": "*" + } + }, "@types/color-name": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", @@ -2211,6 +2349,11 @@ "@types/node": "*" } }, + "@types/http-cache-semantics": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.0.tgz", + "integrity": "sha512-c3Xy026kOF7QOTn00hbIllV1dLR9hG9NkSrLQgCVs8NF6sBU+VGWjD3wLPhmh1TYAc7ugCFsvHYMN4VcBN1U1A==" + }, "@types/json-schema": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.4.tgz", @@ -2223,6 +2366,14 @@ "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", "dev": true }, + "@types/keyv": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.1.tgz", + "integrity": "sha512-MPtoySlAZQ37VoLaPcTHCu1RWJ4llDkULYZIzOYxlhxBqYPB0RsRlmMU0R6tahtFe27mIdkHV+551ZWV4PLmVw==", + "requires": { + "@types/node": "*" + } + }, "@types/lodash": { "version": "4.14.157", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.157.tgz", @@ -2238,8 +2389,7 @@ "@types/node": { "version": "14.0.14", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.14.tgz", - "integrity": "sha512-syUgf67ZQpaJj01/tRTknkMNoBBLWJOBODF0Zm4NrXmiSuxjymFrxnTu1QVYRubhVkRcZLYZG8STTwJRdVm/WQ==", - "dev": true + "integrity": "sha512-syUgf67ZQpaJj01/tRTknkMNoBBLWJOBODF0Zm4NrXmiSuxjymFrxnTu1QVYRubhVkRcZLYZG8STTwJRdVm/WQ==" }, "@types/q": { "version": "1.5.4", @@ -2247,6 +2397,14 @@ "integrity": "sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==", "dev": true }, + "@types/responselike": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", + "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", + "requires": { + "@types/node": "*" + } + }, "@types/source-list-map": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/@types/source-list-map/-/source-list-map-0.1.2.tgz", @@ -4082,26 +4240,29 @@ "unset-value": "^1.0.0" } }, + "cacheable-lookup": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.3.tgz", + "integrity": "sha512-W+JBqF9SWe18A72XFzN/V/CULFzPm7sBXzzR6ekkE+3tLG72wFZrBiBZhrZuDoYexop4PHJVdFAKb/Nj9+tm9w==" + }, "cacheable-request": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", - "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", - "dev": true, + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.1.tgz", + "integrity": "sha512-lt0mJ6YAnsrBErpTMWeu5kl/tg9xMAWjavYTN6VQXM1A/teBITuNcccXsCxF0tDQQJf9DfAaX5O4e0zp0KlfZw==", "requires": { "clone-response": "^1.0.2", "get-stream": "^5.1.0", "http-cache-semantics": "^4.0.0", - "keyv": "^3.0.0", + "keyv": "^4.0.0", "lowercase-keys": "^2.0.0", "normalize-url": "^4.1.0", - "responselike": "^1.0.2" + "responselike": "^2.0.0" }, "dependencies": { "get-stream": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", - "dev": true, "requires": { "pump": "^3.0.0" } @@ -4109,20 +4270,12 @@ "http-cache-semantics": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", - "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", - "dev": true - }, - "lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", - "dev": true + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==" }, "normalize-url": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", - "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", - "dev": true + "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==" } } }, @@ -4378,7 +4531,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", - "dev": true, "requires": { "mimic-response": "^1.0.0" } @@ -5251,12 +5403,18 @@ "dev": true }, "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "dev": true, + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", "requires": { - "mimic-response": "^1.0.0" + "mimic-response": "^3.1.0" + }, + "dependencies": { + "mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==" + } } }, "deep-equal": { @@ -5313,10 +5471,9 @@ } }, "defer-to-connect": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", - "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", - "dev": true + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.0.tgz", + "integrity": "sha512-bYL2d05vOSf1JEZNx5vSAtPuBMkX8K9EUutg7zlKvTqKXHt7RhWJFbmd7qakVuf13i+IkGmp6FwSsONOf6VYIg==" }, "define-properties": { "version": "1.1.3", @@ -6140,7 +6297,6 @@ "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, "requires": { "once": "^1.4.0" } @@ -7577,22 +7733,21 @@ } }, "got": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", - "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", - "dev": true, - "requires": { - "@sindresorhus/is": "^0.14.0", - "@szmarczak/http-timer": "^1.1.2", - "cacheable-request": "^6.0.0", - "decompress-response": "^3.3.0", - "duplexer3": "^0.1.4", - "get-stream": "^4.1.0", - "lowercase-keys": "^1.0.1", - "mimic-response": "^1.0.1", - "p-cancelable": "^1.0.0", - "to-readable-stream": "^1.0.0", - "url-parse-lax": "^3.0.0" + "version": "11.5.0", + "resolved": "https://registry.npmjs.org/got/-/got-11.5.0.tgz", + "integrity": "sha512-vOZEcEaK0b6x11uniY0HcblZObKPRO75Jvz53VKuqGSaKCM/zEt0sj2LGYVdqDYJzO3wYdG+FPQQ1hsgoXy7vQ==", + "requires": { + "@sindresorhus/is": "^3.0.0", + "@szmarczak/http-timer": "^4.0.5", + "@types/cacheable-request": "^6.0.1", + "@types/responselike": "^1.0.0", + "cacheable-lookup": "^5.0.3", + "cacheable-request": "^7.0.1", + "decompress-response": "^6.0.0", + "http2-wrapper": "^1.0.0-beta.4.8", + "lowercase-keys": "^2.0.0", + "p-cancelable": "^2.0.0", + "responselike": "^2.0.0" } }, "graceful-fs": { @@ -8003,6 +8158,15 @@ "sshpk": "^1.7.0" } }, + "http2-wrapper": { + "version": "1.0.0-beta.5.2", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.0-beta.5.2.tgz", + "integrity": "sha512-xYz9goEyBnC8XwXDTuC/MZ6t+MrKVQZOk4s7+PaDkwIsQd8IwqvM+0M6bA/2lvG8GHXcPdf+MejTUeO2LCPCeQ==", + "requires": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.0.0" + } + }, "https-browserify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", @@ -8772,10 +8936,9 @@ "dev": true }, "json-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", - "dev": true + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" }, "json-parse-better-errors": { "version": "1.0.2", @@ -8863,12 +9026,11 @@ } }, "keyv": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", - "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", - "dev": true, + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.0.1.tgz", + "integrity": "sha512-xz6Jv6oNkbhrFCvCP7HQa8AaII8y8LRpoSm661NOKLr4uHuBwhX4epXrPQgF3+xdJnN4Esm5X0xwY4bOlALOtw==", "requires": { - "json-buffer": "3.0.0" + "json-buffer": "3.0.1" } }, "killable": { @@ -9123,10 +9285,9 @@ } }, "lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "dev": true + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" }, "lru-cache": { "version": "5.1.1", @@ -9427,8 +9588,7 @@ "mimic-response": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", - "dev": true + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" }, "mini-css-extract-plugin": { "version": "0.9.0", @@ -10207,7 +10367,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "requires": { "wrappy": "1" } @@ -10393,10 +10552,9 @@ } }, "p-cancelable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", - "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", - "dev": true + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.0.0.tgz", + "integrity": "sha512-wvPXDmbMmu2ksjkB4Z3nZWTSkJEb9lqVdMaCKpZUGJG9TMiNp9XcbG3fn9fPKjem04fJMJnXoyFPk2FmgiaiNg==" }, "p-defer": { "version": "1.0.0", @@ -10465,6 +10623,137 @@ "registry-auth-token": "^4.0.0", "registry-url": "^5.0.0", "semver": "^6.2.0" + }, + "dependencies": { + "@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", + "dev": true + }, + "@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "dev": true, + "requires": { + "defer-to-connect": "^1.0.1" + } + }, + "cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "dev": true, + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "dependencies": { + "get-stream": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", + "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true + } + } + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "defer-to-connect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", + "dev": true + }, + "got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "dev": true, + "requires": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + } + }, + "http-cache-semantics": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "dev": true + }, + "json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", + "dev": true + }, + "keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "dev": true, + "requires": { + "json-buffer": "3.0.0" + } + }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true + }, + "normalize-url": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", + "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", + "dev": true + }, + "p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", + "dev": true + }, + "responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "dev": true, + "requires": { + "lowercase-keys": "^1.0.0" + } + } } }, "pacote": { @@ -11606,7 +11895,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, "requires": { "end-of-stream": "^1.1.0", "once": "^1.3.1" @@ -11689,6 +11977,11 @@ "integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==", "dev": true }, + "quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==" + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -12142,6 +12435,11 @@ "path-parse": "^1.0.6" } }, + "resolve-alpn": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.0.0.tgz", + "integrity": "sha512-rTuiIEqFmGxne4IovivKSDzld2lWW9QCjqv80SYjPgf+gS35eaCAjaP54CCwGAwBtnCsvNLYtqxe1Nw+i6JEmA==" + }, "resolve-cwd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", @@ -12164,12 +12462,11 @@ "dev": true }, "responselike": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", - "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", - "dev": true, + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.0.tgz", + "integrity": "sha512-xH48u3FTB9VsZw7R+vvgaKeLKzT6jOogbQhEe/jewwnZgzPcnyWui2Av6JpoYZF/91uueC+lqhWqeURw5/qhCw==", "requires": { - "lowercase-keys": "^1.0.0" + "lowercase-keys": "^2.0.0" } }, "restore-cursor": { @@ -15540,8 +15837,7 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "write": { "version": "1.0.3", diff --git a/package.json b/package.json index 4dfdb4fa7..6966ea373 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,7 @@ "ajv": "^6.12.2", "angular-svg-round-progressbar": "^3.0.1", "electron-store": "^5.2.0", + "got": "^11.5.0", "lodash": "^4.17.15", "ngx-spinner": "^9.0.2", "rxjs": "~6.5.5", diff --git a/src/app/main-screen/main-screen.component.html b/src/app/main-screen/main-screen.component.html index 07eec8f31..516091925 100644 --- a/src/app/main-screen/main-screen.component.html +++ b/src/app/main-screen/main-screen.component.html @@ -1,14 +1,14 @@ - -
+
+
- -
+
+ diff --git a/src/app/update/update.component.ts b/src/app/update/update.component.ts index b35016f20..af4a9c8d2 100644 --- a/src/app/update/update.component.ts +++ b/src/app/update/update.component.ts @@ -41,6 +41,7 @@ export class UpdateComponent implements OnInit { private setupListeners(): void { this.ipc.on("updateError", (_, updateError: UpdateError): void => { this.notificationService.setError("Can't install update!", updateError.error.message); + this.closeFunction.emit(); }); } From 9f0fe7800c44f63e14087497bb634bb5d5b87bdc Mon Sep 17 00:00:00 2001 From: UnchartedBull Date: Thu, 16 Jul 2020 00:53:18 +0200 Subject: [PATCH 6/9] download working --- main.js | 54 ++++++++++++++++++++++++++-- package-lock.json | 50 ++++++++++++++------------ package.json | 3 +- src/app/update/update.component.html | 12 +++++-- src/app/update/update.component.scss | 4 +-- src/app/update/update.component.ts | 34 ++++++++++++++++-- 6 files changed, 124 insertions(+), 33 deletions(-) diff --git a/main.js b/main.js index bfd9c9832..7d4d2cc31 100644 --- a/main.js +++ b/main.js @@ -6,6 +6,9 @@ const fs = require("fs"); const got = require('got'); const path = require("path"); const url = require("url"); +const stream = require('stream'); +const {promisify} = require('util'); +const progress = require('progress-stream'); const exec = require("child_process").exec; @@ -144,6 +147,8 @@ function sendVersionInfo() { } function downloadUpdate(updateInfo) { + const downloadPath = "/tmp/octodash.deb"; + exec("arch", (err, stdout, stderr) => { if (err || stderr) { window.webContents.send("updateError", { @@ -152,14 +157,59 @@ function downloadUpdate(updateInfo) { } got(updateInfo.assetsURL) .then((releaseFiles) => { + const reducer = (accumulator, currentValue) => accumulator + currentValue; + let averageETA = []; let downloadURL; + let packageSize; for (let package of JSON.parse(releaseFiles.body)) { //FIXME // if (package.name.includes(stdout)) downloadURL = package.browser_download_url; - if (package.name.includes("armv7l")) downloadURL = package.browser_download_url; + if (package.name.includes("armv7l")) { + downloadURL = package.browser_download_url; + packageSize = package.size; + } } if (downloadURL) { - console.log(downloadURL) + const downloadPipeline = promisify(stream.pipeline); + let downloadProgress = progress({ + length: packageSize, + time: 300, + }); + + downloadProgress.on('progress', (progress) => { + averageETA.push(progress.eta); + if (averageETA.length > 4) averageETA.shift(); + window.webContents.send("updateDownloadProgress", { + percentage: progress.percentage, + transferred: (progress.transferred / 100000).toFixed(1), + total: (progress.length / 1000000).toFixed(1), + remaining: (progress.remaining / 100000).toFixed(1), + eta: new Date(averageETA.reduce(reducer) * 1000).toISOString().substr(14, 5), + runtime: new Date(progress.runtime * 1000).toISOString().substr(14, 5), + delta: (progress.delta / 100000).toFixed(1), + speed: (progress.speed / 1000000).toFixed(2), + }) + }) + + try { + if (fs.existsSync(downloadPath)) fs.unlinkSync(downloadPath) + } catch { + // no need to handle this properly + } + + downloadPipeline( + got.stream(downloadURL), + downloadProgress, + fs.createWriteStream(downloadPath) + ).catch((error) => { + window.webContents.send("updateError", { + error: { + message: `Can't download package! ${error.message}.` + } + }) + }).then(() => { + console.log("DONE") + }) } else { window.webContents.send("updateError", { error: { diff --git a/package-lock.json b/package-lock.json index fdd423980..4a015d2a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4974,8 +4974,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 + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "cosmiconfig": { "version": "5.2.1", @@ -8335,8 +8334,7 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "ini": { "version": "1.3.5", @@ -8815,8 +8813,7 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isbinaryfile": { "version": "4.0.6", @@ -9238,9 +9235,9 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==" }, "lodash.clonedeep": { "version": "4.5.0", @@ -10101,9 +10098,9 @@ } }, "npm-registry-fetch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-4.0.4.tgz", - "integrity": "sha512-6jb34hX/iYNQebqWUHtU8YF6Cjb1H6ouTFPClYsyiW6lpFkljTpdeftm53rRojtja1rKAvKNIIiTS5Sjpw4wsA==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-4.0.5.tgz", + "integrity": "sha512-yQ0/U4fYpCCqmueB2g8sc+89ckQ3eXpmU4+Yi2j5o/r0WkKvE2+Y0tK3DEILAtn2UaQTkjTHxIXe2/CSdit+/Q==", "dev": true, "requires": { "JSONStream": "^1.3.4", @@ -11788,8 +11785,7 @@ "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, "progress": { "version": "2.0.3", @@ -11797,6 +11793,15 @@ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "dev": true }, + "progress-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress-stream/-/progress-stream-2.0.0.tgz", + "integrity": "sha1-+sY6Cz0R3qy7CWmrzJOyFLzhntU=", + "requires": { + "speedometer": "~1.0.0", + "through2": "~2.0.3" + } + }, "promise": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", @@ -12212,7 +12217,6 @@ "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -12596,8 +12600,7 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "safe-regex": { "version": "1.1.0", @@ -13403,6 +13406,11 @@ "chalk": "^2.0.1" } }, + "speedometer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/speedometer/-/speedometer-1.0.0.tgz", + "integrity": "sha1-zWccsGdSwivKM3Di8zREC+T8YuI=" + }, "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", @@ -13589,7 +13597,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, "requires": { "safe-buffer": "~5.1.0" } @@ -14086,7 +14093,6 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "dev": true, "requires": { "readable-stream": "~2.3.6", "xtend": "~4.0.1" @@ -14663,8 +14669,7 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "util-promisify": { "version": "2.1.0", @@ -15877,8 +15882,7 @@ "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "dev": true + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" }, "y18n": { "version": "4.0.0", diff --git a/package.json b/package.json index 6966ea373..0f36f6c68 100644 --- a/package.json +++ b/package.json @@ -81,8 +81,9 @@ "angular-svg-round-progressbar": "^3.0.1", "electron-store": "^5.2.0", "got": "^11.5.0", - "lodash": "^4.17.15", + "lodash": "^4.17.19", "ngx-spinner": "^9.0.2", + "progress-stream": "^2.0.0", "rxjs": "~6.5.5", "tslib": "^1.13.0", "zone.js": "~0.10.3" diff --git a/src/app/update/update.component.html b/src/app/update/update.component.html index 01e6cb07d..18bf9b7cc 100644 --- a/src/app/update/update.component.html +++ b/src/app/update/update.component.html @@ -1,8 +1,14 @@
downloading update ...
-
0.4 MB/s
+
+ {{ updateProgress.speed }} MB/s  +
- 115.5MB - 01:25 minutes left + {{ updateProgress.total }} MB + {{ updateProgress.eta }} minutes left
diff --git a/src/app/update/update.component.scss b/src/app/update/update.component.scss index b6bb6e10e..0cec0bf17 100644 --- a/src/app/update/update.component.scss +++ b/src/app/update/update.component.scss @@ -18,9 +18,9 @@ transition: width 0.7s ease-in-out; font-size: 0.5rem; text-align: right; - vertical-align: center; padding-top: 1.5vh; - padding-right: 1vw; + overflow: visible; + white-space: nowrap; &__wrapper { background-color: #718093; diff --git a/src/app/update/update.component.ts b/src/app/update/update.component.ts index af4a9c8d2..03d54f02b 100644 --- a/src/app/update/update.component.ts +++ b/src/app/update/update.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, OnInit, Output } from "@angular/core"; +import { ChangeDetectorRef, Component, EventEmitter, OnInit, Output } from "@angular/core"; import { AppService } from "../app.service"; import { NotificationService } from "../notification/notification.service"; @@ -13,8 +13,22 @@ export class UpdateComponent implements OnInit { // eslint-disable-next-line @typescript-eslint/no-explicit-any private ipc: any; + public updateProgress: UpdateDownloadProgress = { + percentage: 0, + transferred: 0, + total: "--.-", + remaining: 0, + eta: "--:--", + runtime: "--:--", + delta: 0, + speed: "--.-", + }; - constructor(public service: AppService, private notificationService: NotificationService) { + constructor( + public service: AppService, + private notificationService: NotificationService, + private changeDetector: ChangeDetectorRef + ) { try { this.ipc = window.require("electron").ipcRenderer; } catch (e) { @@ -43,6 +57,11 @@ export class UpdateComponent implements OnInit { this.notificationService.setError("Can't install update!", updateError.error.message); this.closeFunction.emit(); }); + + this.ipc.on("updateDownloadProgress", (_, updateDownloadProgress: UpdateDownloadProgress): void => { + this.updateProgress = updateDownloadProgress; + this.changeDetector.detectChanges(); + }); } private update(assetsURL: string): void { @@ -58,3 +77,14 @@ interface UpdateError { stack?: string; }; } + +interface UpdateDownloadProgress { + percentage: number; + transferred: number; + total: number | string; + remaining: number; + eta: string; + runtime: string; + delta: number; + speed: number | string; +} From 6b119be0fdb63463fbc4eb41a1bd9e642e9ffbe4 Mon Sep 17 00:00:00 2001 From: UnchartedBull Date: Thu, 30 Jul 2020 15:22:44 +0200 Subject: [PATCH 7/9] download and installation working --- main.js | 39 ++++++++++++++++-------- src/app/update/update.component.html | 37 ++++++++++++++++------- src/app/update/update.component.scss | 45 ++++++++++++++++++++++++++++ src/app/update/update.component.ts | 36 ++++++++++++++++++++-- 4 files changed, 133 insertions(+), 24 deletions(-) diff --git a/main.js b/main.js index 7d4d2cc31..76f3a4fd6 100644 --- a/main.js +++ b/main.js @@ -9,6 +9,7 @@ const url = require("url"); const stream = require('stream'); const {promisify} = require('util'); const progress = require('progress-stream'); +const { windowsStore } = require("process"); const exec = require("child_process").exec; @@ -163,7 +164,7 @@ function downloadUpdate(updateInfo) { let packageSize; for (let package of JSON.parse(releaseFiles.body)) { //FIXME - // if (package.name.includes(stdout)) downloadURL = package.browser_download_url; + // if (package.name.includes(stdout)) { if (package.name.includes("armv7l")) { downloadURL = package.browser_download_url; packageSize = package.size; @@ -197,19 +198,33 @@ function downloadUpdate(updateInfo) { // no need to handle this properly } - downloadPipeline( - got.stream(downloadURL), - downloadProgress, - fs.createWriteStream(downloadPath) - ).catch((error) => { - window.webContents.send("updateError", { - error: { - message: `Can't download package! ${error.message}.` + setTimeout(() => { + window.webContents.send("updateDownloadFinished"); + exec('~/Desktop/tmp.sh', (err, _, stderr) => { + if (err || stderr) { + window.webContents.send("updateError", { + error: err ? err : { message: stderr }, + }); + } else { + window.webContents.send("updateInstalled"); } }) - }).then(() => { - console.log("DONE") - }) + }, 100) + + + // downloadPipeline( + // got.stream(downloadURL), + // downloadProgress, + // fs.createWriteStream(downloadPath) + // ).catch((error) => { + // window.webContents.send("updateError", { + // error: { + // message: `Can't download package! ${error.message}.` + // } + // }) + // }).then(() => { + // // TODO HERE + // }) } else { window.webContents.send("updateError", { error: { diff --git a/src/app/update/update.component.html b/src/app/update/update.component.html index 18bf9b7cc..290c9087d 100644 --- a/src/app/update/update.component.html +++ b/src/app/update/update.component.html @@ -1,14 +1,31 @@
- downloading update ... -
-
- {{ updateProgress.speed }} MB/s  +
+ downloading update ... +
+
+ {{ updateProgress.speed }} MB/s  +
+
+ {{ updateProgress.total }} MB + {{ updateProgress.eta }} minutes left +
+
+ installing update ... +
+
+
+ this might take a while +
+
+ v{{ service.version }} installed + would you like to reboot now to activate the latest version? +
+ +
- {{ updateProgress.total }} MB - {{ updateProgress.eta }} minutes left
diff --git a/src/app/update/update.component.scss b/src/app/update/update.component.scss index 0cec0bf17..dcb2fc0fc 100644 --- a/src/app/update/update.component.scss +++ b/src/app/update/update.component.scss @@ -22,6 +22,12 @@ overflow: visible; white-space: nowrap; + &-no-percentage { + width: 10vw; + transition: margin-left 2s ease-in-out; + margin-left: 0vw; + } + &__wrapper { background-color: #718093; width: 50vw; @@ -54,4 +60,43 @@ text-align: center; margin-top: 10vh; } + + &-notice { + display: block; + text-align: center; + font-size: 0.5rem; + margin-top: 20vh; + } + + &-restart { + display: block; + text-align: center; + font-size: 0.65rem; + margin-top: 10vh; + margin-bottom: 8vw; + + &-button { + padding: 1.4vh 2vw; + border-radius: 1vw; + box-shadow: 0 10px 19px -8px rgba(0, 0, 0, 0.75); + font-size: 0.7rem; + outline: 0; + border: 0; + margin: 7vh 2vw; + + &__no { + background-color: #718093; + opacity: 0.8; + } + + &__yes { + background-color: #44bd32; + } + + &__wrapper { + display: block; + text-align: center; + } + } + } } diff --git a/src/app/update/update.component.ts b/src/app/update/update.component.ts index 03d54f02b..e78b384eb 100644 --- a/src/app/update/update.component.ts +++ b/src/app/update/update.component.ts @@ -2,6 +2,7 @@ import { ChangeDetectorRef, Component, EventEmitter, OnInit, Output } from "@ang import { AppService } from "../app.service"; import { NotificationService } from "../notification/notification.service"; +import { OctoprintService } from "../octoprint.service"; @Component({ selector: "app-update", @@ -13,6 +14,7 @@ export class UpdateComponent implements OnInit { // eslint-disable-next-line @typescript-eslint/no-explicit-any private ipc: any; + private installationAnimationInterval: number; public updateProgress: UpdateDownloadProgress = { percentage: 0, transferred: 0, @@ -23,10 +25,12 @@ export class UpdateComponent implements OnInit { delta: 0, speed: "--.-", }; + public page = 1; constructor( public service: AppService, private notificationService: NotificationService, + private octoprintService: OctoprintService, private changeDetector: ChangeDetectorRef ) { try { @@ -45,7 +49,7 @@ export class UpdateComponent implements OnInit { "Can't initiate update!", "Some information is missing, please try again in an hour or update manually." ); - this.closeFunction.emit(); + this.closeUpdateWindow(); } else { this.setupListeners(); this.update(this.service.getLatestVersionAssetsURL()); @@ -55,13 +59,36 @@ export class UpdateComponent implements OnInit { private setupListeners(): void { this.ipc.on("updateError", (_, updateError: UpdateError): void => { this.notificationService.setError("Can't install update!", updateError.error.message); - this.closeFunction.emit(); + this.closeUpdateWindow(); }); this.ipc.on("updateDownloadProgress", (_, updateDownloadProgress: UpdateDownloadProgress): void => { this.updateProgress = updateDownloadProgress; this.changeDetector.detectChanges(); }); + + this.ipc.on("updateDownloadFinished", (): void => { + this.page = 2; + this.changeDetector.detectChanges(); + setTimeout(() => { + const updateProgressBar = document.getElementById("installUpdateProgress"); + updateProgressBar.style.marginLeft = "40vw"; + this.installationAnimationInterval = setInterval(() => { + updateProgressBar.style.marginLeft = updateProgressBar.style.marginLeft === "0vw" ? "40vw" : "0vw"; + }, 2000); + }, 250); + }); + + this.ipc.on("updateInstalled", (): void => { + this.page = 3; + this.changeDetector.detectChanges(); + clearInterval(this.installationAnimationInterval); + }); + } + + private closeUpdateWindow(): void { + this.page = 1; + this.closeFunction.emit(); } private update(assetsURL: string): void { @@ -69,6 +96,11 @@ export class UpdateComponent implements OnInit { assetsURL: assetsURL, }); } + + public reboot(): void { + console.log("reboot"); + // this.octoprintService.sendSystemCommand("reboot"); + } } interface UpdateError { From bbf746c535779e52bc674cac0660a430378cfe7d Mon Sep 17 00:00:00 2001 From: UnchartedBull Date: Fri, 31 Jul 2020 21:58:29 +0200 Subject: [PATCH 8/9] finished and tested --- main.js | 36 ++++++++----------- scripts/install.sh | 19 ++++++++++ .../main-screen/main-screen.component.html | 7 ++-- src/app/update/update.component.ts | 7 ++-- 4 files changed, 38 insertions(+), 31 deletions(-) diff --git a/main.js b/main.js index 76f3a4fd6..c1831379f 100644 --- a/main.js +++ b/main.js @@ -9,7 +9,6 @@ const url = require("url"); const stream = require('stream'); const {promisify} = require('util'); const progress = require('progress-stream'); -const { windowsStore } = require("process"); const exec = require("child_process").exec; @@ -163,9 +162,7 @@ function downloadUpdate(updateInfo) { let downloadURL; let packageSize; for (let package of JSON.parse(releaseFiles.body)) { - //FIXME - // if (package.name.includes(stdout)) { - if (package.name.includes("armv7l")) { + if (package.name.includes(stdout.trim())) { downloadURL = package.browser_download_url; packageSize = package.size; } @@ -198,9 +195,19 @@ function downloadUpdate(updateInfo) { // no need to handle this properly } - setTimeout(() => { + downloadPipeline( + got.stream(downloadURL), + downloadProgress, + fs.createWriteStream(downloadPath) + ).catch((error) => { + window.webContents.send("updateError", { + error: { + message: `Can't download package! ${error.message}.` + } + }) + }).then(() => { window.webContents.send("updateDownloadFinished"); - exec('~/Desktop/tmp.sh', (err, _, stderr) => { + exec('sudo ~/scripts/update-octodash', (err, _, stderr) => { if (err || stderr) { window.webContents.send("updateError", { error: err ? err : { message: stderr }, @@ -209,22 +216,7 @@ function downloadUpdate(updateInfo) { window.webContents.send("updateInstalled"); } }) - }, 100) - - - // downloadPipeline( - // got.stream(downloadURL), - // downloadProgress, - // fs.createWriteStream(downloadPath) - // ).catch((error) => { - // window.webContents.send("updateError", { - // error: { - // message: `Can't download package! ${error.message}.` - // } - // }) - // }).then(() => { - // // TODO HERE - // }) + }) } else { window.webContents.send("updateError", { error: { diff --git a/scripts/install.sh b/scripts/install.sh index cd9277472..464abd05e 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -757,6 +757,25 @@ EOF echo "OctoDash will start automatically on next reboot. Please ensure that auto-login is enabled!" fi +list_input "Should I setup the update script? This will allow installing '~/tmp/octodash.deb' without sudo or root access. For more info visit the Update section of the wiki. " yes_no update +if [ $update == 'yes' ]; then + mkdir -p ~/scripts + echo "Setting up update script ..." + cat < ~/scripts/update-octodash +#!/bin/bash + +dpkg -i /tmp/octodash.deb +rm /tmp/octodash.deb +EOF + + sudo chmod +x ~/scripts/update-octodash + + sudo bash -c 'cat >> /etc/sudoers.d/update-octodash' < -
- +
-
- +
diff --git a/src/app/update/update.component.ts b/src/app/update/update.component.ts index e78b384eb..50bf316f1 100644 --- a/src/app/update/update.component.ts +++ b/src/app/update/update.component.ts @@ -75,19 +75,19 @@ export class UpdateComponent implements OnInit { updateProgressBar.style.marginLeft = "40vw"; this.installationAnimationInterval = setInterval(() => { updateProgressBar.style.marginLeft = updateProgressBar.style.marginLeft === "0vw" ? "40vw" : "0vw"; - }, 2000); + }, 2050); }, 250); }); this.ipc.on("updateInstalled", (): void => { this.page = 3; this.changeDetector.detectChanges(); - clearInterval(this.installationAnimationInterval); }); } private closeUpdateWindow(): void { this.page = 1; + clearInterval(this.installationAnimationInterval); this.closeFunction.emit(); } @@ -98,8 +98,7 @@ export class UpdateComponent implements OnInit { } public reboot(): void { - console.log("reboot"); - // this.octoprintService.sendSystemCommand("reboot"); + this.octoprintService.sendSystemCommand("reboot"); } } From 11473e95e5d9d70b466cd328ea3b10ea44596046 Mon Sep 17 00:00:00 2001 From: UnchartedBull Date: Fri, 31 Jul 2020 22:01:01 +0200 Subject: [PATCH 9/9] codefactor --- src/app/update/update.component.scss | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/update/update.component.scss b/src/app/update/update.component.scss index dcb2fc0fc..bc4a39535 100644 --- a/src/app/update/update.component.scss +++ b/src/app/update/update.component.scss @@ -25,11 +25,10 @@ &-no-percentage { width: 10vw; transition: margin-left 2s ease-in-out; - margin-left: 0vw; + margin-left: 0; } &__wrapper { - background-color: #718093; width: 50vw; margin: 14vh auto 3vh; display: block;