fix: cross-verify update API claims against npm registry (#1082)

* fix: cross-verify update API claims against npm registry

* Update packages/web/server/lib/package-manager.js

Signed-off-by: Islam Nofl <islamnofl.official@gmail.com>

* fix: show live server version in AboutDialog instead of stale build-time constant

* fix: add comment to empty catch block to satisfy lint no-empty rule

* fix: preserve live about dialog version in electron

* fix: scope update checks by runtime

---------

Signed-off-by: Islam Nofl <islamnofl.official@gmail.com>
Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
Islam Nofl
2026-05-01 12:23:58 +03:00
committed by GitHub
co-authored by Bohdan Triapitsyn
parent c924e85a29
commit a23f5e7545
11 changed files with 340 additions and 23 deletions
+9 -2
View File
@@ -29,7 +29,7 @@ function getOpenChamberConfigDir() {
}
function sanitizeInstallScope(scope) {
if (scope === 'desktop-tauri' || scope === 'vscode' || scope === 'web') return scope;
if (scope === 'desktop-electron' || scope === 'desktop-tauri' || scope === 'vscode' || scope === 'web') return scope;
return 'web';
}
@@ -65,7 +65,7 @@ function mapArch(value) {
}
function normalizeAppType(value) {
if (value === 'web' || value === 'desktop-tauri' || value === 'vscode') return value;
if (value === 'web' || value === 'desktop-electron' || value === 'desktop-tauri' || value === 'vscode') return value;
return 'web';
}
@@ -701,10 +701,17 @@ export async function fetchChangelogNotes(fromVersion, toVersion) {
export async function checkForUpdates(options = {}) {
const currentVersion = options.currentVersion || getCurrentVersion();
const pm = detectPackageManager();
const appType = normalizeAppType(options.appType);
if (currentVersion !== 'unknown') {
const remote = await checkForUpdatesFromApi(currentVersion, options);
if (remote) {
if (remote.available && appType === 'web') {
const npmLatest = await getLatestVersion();
if (!npmLatest || compareVersions(npmLatest, remote.version) < 0) {
remote.available = false;
}
}
return {
...remote,
packageManager: pm,