Skip to content

Commit 5979e5a

Browse files
author
Alberto Iannaccone
authored
add preference to set a custom update url (#865)
1 parent baa9b5f commit 5979e5a

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

Diff for: arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ export class ArduinoFrontendContribution
280280
}
281281

282282
this.updaterService.init(
283-
this.arduinoPreferences.get('arduino.ide.updateChannel')
283+
this.arduinoPreferences.get('arduino.ide.updateChannel'),
284+
this.arduinoPreferences.get('arduino.ide.updateBaseUrl')
284285
);
285286
this.updater.checkForUpdates(true).then(async (updateInfo) => {
286287
if (!updateInfo) return;

Diff for: arduino-ide-extension/src/browser/arduino-preferences.ts

+9
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ export const ArduinoConfigSchema: PreferenceSchema = {
7878
"Release channel to get updated from. 'stable' is the stable release, 'nightly' is the latest development build."
7979
),
8080
},
81+
'arduino.ide.updateBaseUrl': {
82+
type: 'string',
83+
default: 'https://downloads.arduino.cc/arduino-ide',
84+
description: nls.localize(
85+
'arduino/preferences/ide.updateBaseUrl',
86+
`The base URL where to download updates from. Defaults to 'https://downloads.arduino.cc/arduino-ide'`
87+
),
88+
},
8189
'arduino.board.certificates': {
8290
type: 'string',
8391
description: nls.localize(
@@ -178,6 +186,7 @@ export interface ArduinoConfiguration {
178186
'arduino.window.autoScale': boolean;
179187
'arduino.window.zoomLevel': number;
180188
'arduino.ide.updateChannel': UpdateChannel;
189+
'arduino.ide.updateBaseUrl': string;
181190
'arduino.board.certificates': string;
182191
'arduino.sketchbook.showAllFiles': boolean;
183192
'arduino.cloud.enabled': boolean;

Diff for: arduino-ide-extension/src/common/protocol/ide-updater.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export interface ProgressInfo {
4646
export const IDEUpdaterPath = '/services/ide-updater';
4747
export const IDEUpdater = Symbol('IDEUpdater');
4848
export interface IDEUpdater extends JsonRpcServer<IDEUpdaterClient> {
49-
init(channel: UpdateChannel): void;
49+
init(channel: UpdateChannel, baseUrl: string): void;
5050
checkForUpdates(initialCheck?: boolean): Promise<UpdateInfo | void>;
5151
downloadUpdate(): Promise<void>;
5252
quitAndInstall(): void;

Diff for: arduino-ide-extension/src/electron-main/ide-updater/ide-updater-impl.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
} from '../../common/protocol/ide-updater';
99

1010
const CHANGELOG_BASE_URL = 'https://downloads.arduino.cc/arduino-ide/changelog';
11-
const IDE_DOWNLOAD_BASE_URL = 'https://downloads.arduino.cc/arduino-ide';
1211

1312
@injectable()
1413
export class IDEUpdaterImpl implements IDEUpdater {
@@ -18,14 +17,12 @@ export class IDEUpdaterImpl implements IDEUpdater {
1817
protected theiaFEClient?: IDEUpdaterClient;
1918
protected clients: Array<IDEUpdaterClient> = [];
2019

21-
init(channel: UpdateChannel): void {
20+
init(channel: UpdateChannel, baseUrl: string): void {
2221
this.updater.autoDownload = false;
2322
this.updater.channel = channel;
2423
this.updater.setFeedURL({
2524
provider: 'generic',
26-
url: `${IDE_DOWNLOAD_BASE_URL}/${
27-
channel === UpdateChannel.Nightly ? 'nightly' : ''
28-
}`,
25+
url: `${baseUrl}/${channel === UpdateChannel.Nightly ? 'nightly' : ''}`,
2926
channel,
3027
});
3128

0 commit comments

Comments
 (0)