mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-14 14:56:33 +00:00
add preference to set a custom update url (#865)
This commit is contained in:
parent
baa9b5f7ab
commit
5979e5aad2
@ -280,7 +280,8 @@ export class ArduinoFrontendContribution
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.updaterService.init(
|
this.updaterService.init(
|
||||||
this.arduinoPreferences.get('arduino.ide.updateChannel')
|
this.arduinoPreferences.get('arduino.ide.updateChannel'),
|
||||||
|
this.arduinoPreferences.get('arduino.ide.updateBaseUrl')
|
||||||
);
|
);
|
||||||
this.updater.checkForUpdates(true).then(async (updateInfo) => {
|
this.updater.checkForUpdates(true).then(async (updateInfo) => {
|
||||||
if (!updateInfo) return;
|
if (!updateInfo) return;
|
||||||
|
@ -78,6 +78,14 @@ export const ArduinoConfigSchema: PreferenceSchema = {
|
|||||||
"Release channel to get updated from. 'stable' is the stable release, 'nightly' is the latest development build."
|
"Release channel to get updated from. 'stable' is the stable release, 'nightly' is the latest development build."
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
'arduino.ide.updateBaseUrl': {
|
||||||
|
type: 'string',
|
||||||
|
default: 'https://downloads.arduino.cc/arduino-ide',
|
||||||
|
description: nls.localize(
|
||||||
|
'arduino/preferences/ide.updateBaseUrl',
|
||||||
|
`The base URL where to download updates from. Defaults to 'https://downloads.arduino.cc/arduino-ide'`
|
||||||
|
),
|
||||||
|
},
|
||||||
'arduino.board.certificates': {
|
'arduino.board.certificates': {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: nls.localize(
|
description: nls.localize(
|
||||||
@ -178,6 +186,7 @@ export interface ArduinoConfiguration {
|
|||||||
'arduino.window.autoScale': boolean;
|
'arduino.window.autoScale': boolean;
|
||||||
'arduino.window.zoomLevel': number;
|
'arduino.window.zoomLevel': number;
|
||||||
'arduino.ide.updateChannel': UpdateChannel;
|
'arduino.ide.updateChannel': UpdateChannel;
|
||||||
|
'arduino.ide.updateBaseUrl': string;
|
||||||
'arduino.board.certificates': string;
|
'arduino.board.certificates': string;
|
||||||
'arduino.sketchbook.showAllFiles': boolean;
|
'arduino.sketchbook.showAllFiles': boolean;
|
||||||
'arduino.cloud.enabled': boolean;
|
'arduino.cloud.enabled': boolean;
|
||||||
|
@ -46,7 +46,7 @@ export interface ProgressInfo {
|
|||||||
export const IDEUpdaterPath = '/services/ide-updater';
|
export const IDEUpdaterPath = '/services/ide-updater';
|
||||||
export const IDEUpdater = Symbol('IDEUpdater');
|
export const IDEUpdater = Symbol('IDEUpdater');
|
||||||
export interface IDEUpdater extends JsonRpcServer<IDEUpdaterClient> {
|
export interface IDEUpdater extends JsonRpcServer<IDEUpdaterClient> {
|
||||||
init(channel: UpdateChannel): void;
|
init(channel: UpdateChannel, baseUrl: string): void;
|
||||||
checkForUpdates(initialCheck?: boolean): Promise<UpdateInfo | void>;
|
checkForUpdates(initialCheck?: boolean): Promise<UpdateInfo | void>;
|
||||||
downloadUpdate(): Promise<void>;
|
downloadUpdate(): Promise<void>;
|
||||||
quitAndInstall(): void;
|
quitAndInstall(): void;
|
||||||
|
@ -8,7 +8,6 @@ import {
|
|||||||
} from '../../common/protocol/ide-updater';
|
} from '../../common/protocol/ide-updater';
|
||||||
|
|
||||||
const CHANGELOG_BASE_URL = 'https://downloads.arduino.cc/arduino-ide/changelog';
|
const CHANGELOG_BASE_URL = 'https://downloads.arduino.cc/arduino-ide/changelog';
|
||||||
const IDE_DOWNLOAD_BASE_URL = 'https://downloads.arduino.cc/arduino-ide';
|
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class IDEUpdaterImpl implements IDEUpdater {
|
export class IDEUpdaterImpl implements IDEUpdater {
|
||||||
@ -18,14 +17,12 @@ export class IDEUpdaterImpl implements IDEUpdater {
|
|||||||
protected theiaFEClient?: IDEUpdaterClient;
|
protected theiaFEClient?: IDEUpdaterClient;
|
||||||
protected clients: Array<IDEUpdaterClient> = [];
|
protected clients: Array<IDEUpdaterClient> = [];
|
||||||
|
|
||||||
init(channel: UpdateChannel): void {
|
init(channel: UpdateChannel, baseUrl: string): void {
|
||||||
this.updater.autoDownload = false;
|
this.updater.autoDownload = false;
|
||||||
this.updater.channel = channel;
|
this.updater.channel = channel;
|
||||||
this.updater.setFeedURL({
|
this.updater.setFeedURL({
|
||||||
provider: 'generic',
|
provider: 'generic',
|
||||||
url: `${IDE_DOWNLOAD_BASE_URL}/${
|
url: `${baseUrl}/${channel === UpdateChannel.Nightly ? 'nightly' : ''}`,
|
||||||
channel === UpdateChannel.Nightly ? 'nightly' : ''
|
|
||||||
}`,
|
|
||||||
channel,
|
channel,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user