configure updater options

This commit is contained in:
Alberto Iannaccone
2021-12-21 12:56:23 +01:00
parent 44d31abc7f
commit db373c825c
2 changed files with 17 additions and 15 deletions

View File

@@ -1,4 +1,9 @@
import { Command, CommandContribution, CommandRegistry } from '@theia/core'; import {
Command,
CommandContribution,
CommandRegistry,
MessageService,
} from '@theia/core';
import { injectable, inject } from 'inversify'; import { injectable, inject } from 'inversify';
import { IDEUpdaterService } from '../../common/protocol/ide-updater-service'; import { IDEUpdaterService } from '../../common/protocol/ide-updater-service';
@@ -6,7 +11,9 @@ import { IDEUpdaterService } from '../../common/protocol/ide-updater-service';
export class IDEUpdaterCommands implements CommandContribution { export class IDEUpdaterCommands implements CommandContribution {
constructor( constructor(
@inject(IDEUpdaterService) @inject(IDEUpdaterService)
private readonly updater: IDEUpdaterService private readonly updater: IDEUpdaterService,
@inject(MessageService)
protected readonly messageService: MessageService
) {} ) {}
registerCommands(registry: CommandRegistry): void { registerCommands(registry: CommandRegistry): void {
@@ -24,8 +31,9 @@ export class IDEUpdaterCommands implements CommandContribution {
}); });
} }
checkForUpdates() { async checkForUpdates() {
this.updater.checkForUpdates(); const info = await this.updater.checkForUpdates();
this.messageService.info(`version ${info.version} available`);
} }
downloadUpdate() { downloadUpdate() {

View File

@@ -1,5 +1,5 @@
import { injectable } from '@theia/core/shared/inversify'; import { injectable } from '@theia/core/shared/inversify';
import { AllPublishOptions } from 'builder-util-runtime'; import { GenericServerOptions } from 'builder-util-runtime';
import { import {
AppUpdater, AppUpdater,
AppImageUpdater, AppImageUpdater,
@@ -21,17 +21,11 @@ export class IDEUpdaterServiceImpl implements IDEUpdaterService {
protected theiaFEClient?: IDEUpdaterServiceClient; protected theiaFEClient?: IDEUpdaterServiceClient;
constructor() { constructor() {
const options: AllPublishOptions = { const options: GenericServerOptions = {
provider: 's3', provider: 'generic',
bucket: '', url: 'https://downloads.arduino.cc/arduino-ide/nightly/test/',
region: '', channel: 'beta',
acl: 'public-read',
endpoint: 'https://{service}.{region}.amazonaws.com',
channel: '',
}; };
// TODO: Search S3 bucket name for the two channels
// https://downloads.arduino.cc/arduino-ide/arduino-ide_2.0.0-rc2_Linux_64bit.zip
// https://downloads.arduino.cc/arduino-ide/nightly/arduino-ide_nightly-latest_Linux_64bit.zip
this.cancellationToken = new CancellationToken(); this.cancellationToken = new CancellationToken();
if (process.platform === 'win32') { if (process.platform === 'win32') {