fix: report authoritative Electron architecture
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Vendored
+1
-1
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user