From 85a49a221fa7fc9b1943dc8ed43b29995f9d8260 Mon Sep 17 00:00:00 2001 From: Edwin Joassart Date: Wed, 1 Feb 2023 15:05:27 +0100 Subject: [PATCH] Remove configuration remote update Change-type: patch --- lib/gui/app/i18n/en.ts | 3 ++- lib/gui/app/utils/etcher-pro-specific.ts | 8 +++---- lib/gui/etcher.ts | 27 ------------------------ lib/shared/utils.ts | 10 --------- webpack.config.ts | 8 +++++-- 5 files changed, 12 insertions(+), 44 deletions(-) diff --git a/lib/gui/app/i18n/en.ts b/lib/gui/app/i18n/en.ts index eb7abb61..4d6fd34f 100644 --- a/lib/gui/app/i18n/en.ts +++ b/lib/gui/app/i18n/en.ts @@ -138,7 +138,8 @@ const translation = { autoUpdate: 'Auto-updates enabled', settings: 'Settings', systemInformation: 'System Information', - trimExtPartitions: 'Trim unallocated space on raw images (in ext-type partitions)', + trimExtPartitions: + 'Trim unallocated space on raw images (in ext-type partitions)', }, menu: { edit: 'Edit', diff --git a/lib/gui/app/utils/etcher-pro-specific.ts b/lib/gui/app/utils/etcher-pro-specific.ts index f59a2f32..fd4a1f1f 100644 --- a/lib/gui/app/utils/etcher-pro-specific.ts +++ b/lib/gui/app/utils/etcher-pro-specific.ts @@ -17,10 +17,10 @@ import { Dictionary } from 'lodash'; type BalenaTag = { - id: number, - name: string, - value: string -} + id: number; + name: string; + value: string; +}; export class EtcherPro { private supervisorAddr: string; diff --git a/lib/gui/etcher.ts b/lib/gui/etcher.ts index e27b0868..56f0caea 100644 --- a/lib/gui/etcher.ts +++ b/lib/gui/etcher.ts @@ -26,7 +26,6 @@ import './app/i18n'; import { packageType, version } from '../../package.json'; import * as EXIT_CODES from '../shared/exit-codes'; -import { delay, getConfig } from '../shared/utils'; import * as settings from './app/models/settings'; import { buildWindowMenu } from './menu'; import * as i18n from 'i18next'; @@ -206,32 +205,6 @@ async function createMainWindow() { )}`, ); - const page = mainWindow.webContents; - - page.once('did-frame-finish-load', async () => { - console.log('packageUpdatable', packageUpdatable); - autoUpdater.on('error', (err) => { - logMainProcessException(err); - }); - if (packageUpdatable) { - try { - const configUrl = await settings.get('configUrl'); - const onlineConfig = await getConfig(configUrl); - const autoUpdaterConfig: AutoUpdaterConfig = onlineConfig?.autoUpdates - ?.autoUpdaterConfig ?? { - autoDownload: false, - }; - for (const [key, value] of Object.entries(autoUpdaterConfig)) { - autoUpdater[key as keyof AutoUpdaterConfig] = value; - } - const checkForUpdatesTimer = - onlineConfig?.autoUpdates?.checkForUpdatesTimer ?? 300000; - checkForUpdates(checkForUpdatesTimer); - } catch (err) { - logMainProcessException(err); - } - } - }); return mainWindow; } diff --git a/lib/shared/utils.ts b/lib/shared/utils.ts index b1299a8d..258d74ef 100755 --- a/lib/shared/utils.ts +++ b/lib/shared/utils.ts @@ -32,16 +32,6 @@ export function percentageToFloat(percentage: any) { return percentage / 100; } -/** - * @summary Get etcher configs stored online - * @param {String} - url where config.json is stored - */ -export async function getConfig(configUrl?: string): Promise> { - configUrl = configUrl ?? 'https://balena.io/etcher/static/config.json'; - const response = await axios.get(configUrl, { responseType: 'json' }); - return response.data; -} - export async function delay(duration: number): Promise { await new Promise((resolve) => { setTimeout(resolve, duration); diff --git a/webpack.config.ts b/webpack.config.ts index d5831d9f..256f4611 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -23,7 +23,11 @@ import * as path from 'path'; import { env } from 'process'; import * as SimpleProgressWebpackPlugin from 'simple-progress-webpack-plugin'; import * as TerserPlugin from 'terser-webpack-plugin'; -import { BannerPlugin, IgnorePlugin, NormalModuleReplacementPlugin } from 'webpack'; +import { + BannerPlugin, + IgnorePlugin, + NormalModuleReplacementPlugin, +} from 'webpack'; import * as PnpWebpackPlugin from 'pnp-webpack-plugin'; import * as tsconfigRaw from './tsconfig.webpack.json'; @@ -327,7 +331,7 @@ const commonConfig = { // See https://github.com/aws/aws-sdk-js-v3/issues/3025 new IgnorePlugin({ resourceRegExp: /^aws-crt$/, - }) + }), ], resolveLoader: { plugins: [PnpWebpackPlugin.moduleLoader(module)],