diff --git a/patches/11-update-use-github-release.patch b/patches/11-update-use-github-release.patch index 4622142..cb43178 100644 --- a/patches/11-update-use-github-release.patch +++ b/patches/11-update-use-github-release.patch @@ -49,7 +49,7 @@ index 1afbb0d3..87c877fd 100644 + | "user"; \ No newline at end of file diff --git a/src/vs/platform/update/electron-main/abstractUpdateService.ts b/src/vs/platform/update/electron-main/abstractUpdateService.ts -index 09971caf..92552866 100644 +index 09971caf..9ae70a23 100644 --- a/src/vs/platform/update/electron-main/abstractUpdateService.ts +++ b/src/vs/platform/update/electron-main/abstractUpdateService.ts @@ -19,3 +19,3 @@ import { ILogService } from '../../log/common/log.js'; @@ -57,13 +57,12 @@ index 09971caf..92552866 100644 -import { IRequestService } from '../../request/common/request.js'; +import { asJson, IRequestService, NO_FETCH_TELEMETRY } from '../../request/common/request.js'; import { StorageScope, StorageTarget } from '../../storage/common/storage.js'; -@@ -23,3 +23,4 @@ import { IApplicationStorageMainService } from '../../storage/electron-main/stor +@@ -23,3 +23,3 @@ import { IApplicationStorageMainService } from '../../storage/electron-main/stor import { ITelemetryService } from '../../telemetry/common/telemetry.js'; -import { AvailableForDownload, DisablementReason, IUpdateService, State, StateType, UpdateType } from '../common/update.js'; +import { Architecture, AvailableForDownload, DisablementReason, IUpdate, IUpdateService, Platform, State, StateType, Target, UpdateType } from '../common/update.js'; -+import * as semver from 'semver'; -@@ -32,12 +33,8 @@ export interface IUpdateURLOptions { +@@ -32,12 +32,8 @@ export interface IUpdateURLOptions { -export function createUpdateURL(baseUpdateUrl: string, platform: string, quality: string, commit: string, options?: IUpdateURLOptions): string { - const url = new URL(`${baseUpdateUrl}/api/update/${platform}/${quality}/${commit}`); @@ -81,12 +80,32 @@ index 09971caf..92552866 100644 - - return url.toString(); } -@@ -535,3 +532,3 @@ export abstract class AbstractUpdateService extends Disposable implements IUpdat +@@ -98,2 +94,19 @@ function isCancellableState(type: StateType): boolean { + ++// Dotted-numeric version compare (release versions only — no prerelease or ++// build-metadata handling needed for the normalized x.y.z strings compared ++// below). Local so the packaged main process doesn't need the `semver` ++// package, which is no longer in upstream's production dependency tree. ++function compareVersions(a: string, b: string): number { ++ const pa = a.split('-')[0].split('.').map(Number); ++ const pb = b.split('-')[0].split('.').map(Number); ++ for (let i = 0; i < Math.max(pa.length, pb.length); i++) { ++ const na = pa[i] ?? 0; ++ const nb = pb[i] ?? 0; ++ if (na !== nb) { ++ return na < nb ? -1 : 1; ++ } ++ } ++ return 0; ++} ++ + export abstract class AbstractUpdateService extends Disposable implements IUpdateService { +@@ -535,3 +548,3 @@ export abstract class AbstractUpdateService extends Disposable implements IUpdat - if (mode === 'none') { + if (mode === 'none' || mode === 'manual') { return undefined; -@@ -545,17 +542,37 @@ export abstract class AbstractUpdateService extends Disposable implements IUpdat +@@ -545,17 +558,37 @@ export abstract class AbstractUpdateService extends Disposable implements IUpdat + return this._isLatestVersion(url, false) + .then((result) => { @@ -131,7 +150,7 @@ index 09971caf..92552866 100644 + + this.logService.info('update#isLatestVersion() - found version', fetchedVersion, currentVersion); + -+ const lastest = semver.compareBuild(currentVersion, fetchedVersion) >= 0; ++ const lastest = compareVersions(currentVersion, fetchedVersion) >= 0; + + return Promise.resolve({ lastest, update }); + })