diff --git a/lib/module/mhddosproxy.ts b/lib/module/mhddosproxy.ts index 5c31ae5..4378802 100644 --- a/lib/module/mhddosproxy.ts +++ b/lib/module/mhddosproxy.ts @@ -142,7 +142,7 @@ export class MHDDOSProxy extends Module { // Process statistics let lastStatisticsEvent = null as Date | null let statisticsBuffer = '' - handler.stderr.on('data', (data: Buffer) => { + handler.stdout.on('data', (data: Buffer) => { statisticsBuffer += data.toString() const lines = statisticsBuffer.trimEnd().split('\n') diff --git a/lib/module/module.ts b/lib/module/module.ts index 00cbf88..ba46491 100644 --- a/lib/module/module.ts +++ b/lib/module/module.ts @@ -8,6 +8,7 @@ import decompress from 'decompress' import { v4 as uuid4 } from 'uuid' import { Settings } from '../../src-electron/handlers/settings' import { getCPUArchitecture } from './archLib' +import { ca } from 'app/dist/electron/UnPackaged/assets/index.3949846e' export type ModuleName = 'DB1000N' | 'DISTRESS' | 'MHDDOS_PROXY' @@ -116,6 +117,8 @@ export abstract class Module { private _config?: ConfigType protected abstract get defaultConfig(): ConfigType + private autoupdateInterval?: NodeJS.Timeout + protected async getInstallationDirectory () { const settingsData = await this.settings.getData() return path.join(settingsData.modules.dataPath, this.name) @@ -366,6 +369,14 @@ export abstract class Module { config = await this.getConfig() } + this.autoupdateInterval = setInterval(async () => { + const updateConfig = await this.getConfig() + if (updateConfig.autoUpdate && await this.installLatestVersion() && this.isRunning) { + await this.stop() + await this.start() + } + }, 1000 * 60 * 30) // Try to autoupdate once in 30 minutes + const installDirectory = await this.getInstallationDirectory() if (config.selectedVersion === undefined) { @@ -401,6 +412,9 @@ export abstract class Module { } protected async stopExecutable (): Promise { + clearInterval(this.autoupdateInterval) + this.autoupdateInterval = undefined + const handler = this.executedProcessHandler // Copy handler, because other async task can chenage it in the meantime await new Promise((resolve, reject) => { diff --git a/package.json b/package.json index 0127be3..8d09a4a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "itarmykit", - "version": "1.3.6", + "version": "1.3.7", "description": "IT Army Kit", "productName": "IT Army Kit", "author": {