fix: report authoritative Electron architecture

This commit is contained in:
Bohdan Triapitsyn
2026-07-28 19:29:34 +03:00
parent d50cb5becc
commit 23e6083162
4 changed files with 9 additions and 1 deletions
+1
View File
@@ -96,6 +96,7 @@ if (Number.isFinite(macosMajor) && macosMajor > 0) {
contextBridge.exposeInMainWorld('__OPENCHAMBER_ELECTRON__', { contextBridge.exposeInMainWorld('__OPENCHAMBER_ELECTRON__', {
runtime: 'electron', runtime: 'electron',
arch: process.arch,
macVibrancy: hasMacVibrancy, macVibrancy: hasMacVibrancy,
macVibrancySupported, macVibrancySupported,
trayEnabled, trayEnabled,
+1
View File
@@ -227,6 +227,7 @@ type DesktopBridgeGlobal = {
type ElectronRuntimeGlobal = { type ElectronRuntimeGlobal = {
runtime?: string; runtime?: string;
arch?: string;
macVibrancy?: boolean; macVibrancy?: boolean;
macVibrancySupported?: boolean; macVibrancySupported?: boolean;
trayEnabled?: boolean; trayEnabled?: boolean;
+6
View File
@@ -67,6 +67,12 @@ function detectDeviceClass(): 'mobile' | 'tablet' | 'desktop' | 'unknown' {
} }
function detectArch(): 'arm64' | 'x64' | 'unknown' { function detectArch(): 'arm64' | 'x64' | 'unknown' {
const electronArch = typeof window !== 'undefined'
? window.__OPENCHAMBER_ELECTRON__?.arch?.toLowerCase?.()
: undefined;
if (electronArch === 'arm64' || electronArch === 'aarch64') return 'arm64';
if (electronArch === 'x64' || electronArch === 'amd64' || electronArch === 'x86_64') return 'x64';
const vscodeArch = typeof window !== 'undefined' const vscodeArch = typeof window !== 'undefined'
? (window as { __VSCODE_CONFIG__?: { arch?: string } }).__VSCODE_CONFIG__?.arch?.toLowerCase?.() ? (window as { __VSCODE_CONFIG__?: { arch?: string } }).__VSCODE_CONFIG__?.arch?.toLowerCase?.()
: undefined; : undefined;
+1 -1
View File
@@ -5,7 +5,7 @@ declare global {
__OPENCHAMBER_HOME__?: string; __OPENCHAMBER_HOME__?: string;
__OPENCHAMBER_MACOS_MAJOR__?: number; __OPENCHAMBER_MACOS_MAJOR__?: number;
__OPENCHAMBER_LOCAL_ORIGIN__?: string; __OPENCHAMBER_LOCAL_ORIGIN__?: string;
__OPENCHAMBER_ELECTRON__?: { runtime?: string; macVibrancy?: boolean; macVibrancySupported?: boolean; trayEnabled?: boolean }; __OPENCHAMBER_ELECTRON__?: { runtime?: string; arch?: string; macVibrancy?: boolean; macVibrancySupported?: boolean; trayEnabled?: boolean };
__OPENCHAMBER_PLATFORM__?: string; __OPENCHAMBER_PLATFORM__?: string;
__OPENCHAMBER_DESKTOP_BOOT_OUTCOME__?: DesktopBootOutcome; __OPENCHAMBER_DESKTOP_BOOT_OUTCOME__?: DesktopBootOutcome;
} }