fix: report authoritative Electron architecture
This commit is contained in:
@@ -96,6 +96,7 @@ if (Number.isFinite(macosMajor) && macosMajor > 0) {
|
||||
|
||||
contextBridge.exposeInMainWorld('__OPENCHAMBER_ELECTRON__', {
|
||||
runtime: 'electron',
|
||||
arch: process.arch,
|
||||
macVibrancy: hasMacVibrancy,
|
||||
macVibrancySupported,
|
||||
trayEnabled,
|
||||
|
||||
@@ -227,6 +227,7 @@ type DesktopBridgeGlobal = {
|
||||
|
||||
type ElectronRuntimeGlobal = {
|
||||
runtime?: string;
|
||||
arch?: string;
|
||||
macVibrancy?: boolean;
|
||||
macVibrancySupported?: boolean;
|
||||
trayEnabled?: boolean;
|
||||
|
||||
@@ -67,6 +67,12 @@ function detectDeviceClass(): 'mobile' | 'tablet' | 'desktop' | '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'
|
||||
? (window as { __VSCODE_CONFIG__?: { arch?: string } }).__VSCODE_CONFIG__?.arch?.toLowerCase?.()
|
||||
: undefined;
|
||||
|
||||
Vendored
+1
-1
@@ -5,7 +5,7 @@ declare global {
|
||||
__OPENCHAMBER_HOME__?: string;
|
||||
__OPENCHAMBER_MACOS_MAJOR__?: number;
|
||||
__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_DESKTOP_BOOT_OUTCOME__?: DesktopBootOutcome;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user