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:
committed by
GitHub
co-authored by
Bohdan Triapitsyn
parent
c924e85a29
commit
a23f5e7545
@@ -234,6 +234,7 @@ export class AgentManagerPanelProvider {
|
||||
initialStatus: this._cachedStatus,
|
||||
cliAvailable,
|
||||
panelType: 'agentManager',
|
||||
extensionVersion: String(this._context.extension?.packageJSON?.version || ''),
|
||||
devServerUrl: this._webviewDevServerUrl,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -406,6 +406,7 @@ export class ChatViewProvider implements vscode.WebviewViewProvider {
|
||||
workspaceFolder,
|
||||
initialStatus,
|
||||
cliAvailable,
|
||||
extensionVersion: String(this._context.extension?.packageJSON?.version || ''),
|
||||
devServerUrl: this._webviewDevServerUrl,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -273,6 +273,7 @@ export class SessionEditorPanelProvider {
|
||||
panelType: 'chat',
|
||||
initialSessionId: sessionId ?? undefined,
|
||||
viewMode: 'editor',
|
||||
extensionVersion: String(this._context.extension?.packageJSON?.version || ''),
|
||||
devServerUrl: this._webviewDevServerUrl,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ export async function handleSystemBridgeMessage(
|
||||
const body = (payload && typeof payload === 'object' ? payload : {}) as Record<string, unknown>;
|
||||
const currentVersion = typeof body.currentVersion === 'string' && body.currentVersion.trim().length > 0
|
||||
? body.currentVersion.trim()
|
||||
: 'unknown';
|
||||
: String(ctx?.context?.extension?.packageJSON?.version || 'unknown');
|
||||
const instanceMode = typeof body.instanceMode === 'string' && body.instanceMode.trim().length > 0
|
||||
? body.instanceMode.trim()
|
||||
: 'local';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as vscode from 'vscode';
|
||||
import * as os from 'os';
|
||||
import { getThemeKindName } from './theme';
|
||||
import type { ConnectionStatus } from './opencode';
|
||||
|
||||
@@ -14,6 +15,7 @@ export interface WebviewHtmlOptions {
|
||||
initialSessionId?: string;
|
||||
viewMode?: 'sidebar' | 'editor';
|
||||
devServerUrl?: string | null;
|
||||
extensionVersion?: string;
|
||||
}
|
||||
|
||||
const asCspToken = (value: string | null | undefined): string | null => {
|
||||
@@ -50,6 +52,7 @@ export function getWebviewHtml(options: WebviewHtmlOptions): string {
|
||||
initialSessionId,
|
||||
viewMode = 'sidebar',
|
||||
devServerUrl,
|
||||
extensionVersion = '',
|
||||
} = options;
|
||||
|
||||
const scriptPath = vscode.Uri.joinPath(extensionUri, 'dist', 'webview', 'assets', 'index.js');
|
||||
@@ -166,6 +169,9 @@ export function getWebviewHtml(options: WebviewHtmlOptions): string {
|
||||
theme: "${themeKind}",
|
||||
connectionStatus: "${initialStatus}",
|
||||
cliAvailable: ${cliAvailable},
|
||||
extensionVersion: "${extensionVersion.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}",
|
||||
platform: "${os.platform()}",
|
||||
arch: "${os.arch()}",
|
||||
panelType: "${panelType}",
|
||||
viewMode: "${viewMode}",
|
||||
initialSessionId: ${initialSessionId ? `"${initialSessionId.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"` : 'null'},
|
||||
|
||||
Reference in New Issue
Block a user