Merge pull request #4002 from balena-io/aethernet/remove-getconfig

Remove configuration remote update
This commit is contained in:
Balena CI 2023-02-02 15:04:10 +02:00 committed by GitHub
commit 10e2da2c00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 44 deletions

View File

@ -138,7 +138,8 @@ const translation = {
autoUpdate: 'Auto-updates enabled', autoUpdate: 'Auto-updates enabled',
settings: 'Settings', settings: 'Settings',
systemInformation: 'System Information', 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: { menu: {
edit: 'Edit', edit: 'Edit',

View File

@ -17,10 +17,10 @@
import { Dictionary } from 'lodash'; import { Dictionary } from 'lodash';
type BalenaTag = { type BalenaTag = {
id: number, id: number;
name: string, name: string;
value: string value: string;
} };
export class EtcherPro { export class EtcherPro {
private supervisorAddr: string; private supervisorAddr: string;

View File

@ -26,7 +26,6 @@ import './app/i18n';
import { packageType, version } from '../../package.json'; import { packageType, version } from '../../package.json';
import * as EXIT_CODES from '../shared/exit-codes'; import * as EXIT_CODES from '../shared/exit-codes';
import { delay, getConfig } from '../shared/utils';
import * as settings from './app/models/settings'; import * as settings from './app/models/settings';
import { buildWindowMenu } from './menu'; import { buildWindowMenu } from './menu';
import * as i18n from 'i18next'; 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; return mainWindow;
} }

View File

@ -32,16 +32,6 @@ export function percentageToFloat(percentage: any) {
return percentage / 100; return percentage / 100;
} }
/**
* @summary Get etcher configs stored online
* @param {String} - url where config.json is stored
*/
export async function getConfig(configUrl?: string): Promise<Dictionary<any>> {
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<void> { export async function delay(duration: number): Promise<void> {
await new Promise((resolve) => { await new Promise((resolve) => {
setTimeout(resolve, duration); setTimeout(resolve, duration);

View File

@ -23,7 +23,11 @@ import * as path from 'path';
import { env } from 'process'; import { env } from 'process';
import * as SimpleProgressWebpackPlugin from 'simple-progress-webpack-plugin'; import * as SimpleProgressWebpackPlugin from 'simple-progress-webpack-plugin';
import * as TerserPlugin from 'terser-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 PnpWebpackPlugin from 'pnp-webpack-plugin';
import * as tsconfigRaw from './tsconfig.webpack.json'; import * as tsconfigRaw from './tsconfig.webpack.json';
@ -327,7 +331,7 @@ const commonConfig = {
// See https://github.com/aws/aws-sdk-js-v3/issues/3025 // See https://github.com/aws/aws-sdk-js-v3/issues/3025
new IgnorePlugin({ new IgnorePlugin({
resourceRegExp: /^aws-crt$/, resourceRegExp: /^aws-crt$/,
}) }),
], ],
resolveLoader: { resolveLoader: {
plugins: [PnpWebpackPlugin.moduleLoader(module)], plugins: [PnpWebpackPlugin.moduleLoader(module)],