fix: use existing getPlatform() so the OS based CPU readback check also works in the browser
This commit is contained in:
@@ -3,7 +3,7 @@ let cachedPlatform: string | null = null;
|
||||
/**
|
||||
* Gets the current platform from Electron
|
||||
*/
|
||||
const getPlatform = async (): Promise<string> => {
|
||||
export const getPlatform = async (): Promise<string> => {
|
||||
if (cachedPlatform) return cachedPlatform;
|
||||
|
||||
try {
|
||||
@@ -14,9 +14,14 @@ const getPlatform = async (): Promise<string> => {
|
||||
console.warn("Failed to get platform from Electron, falling back to navigator:", error);
|
||||
// Fallback for development/testing
|
||||
let fallbackPlatform = "win32";
|
||||
if (typeof navigator !== "undefined" && /Mac|iPhone|iPad|iPod/.test(navigator.platform)) {
|
||||
fallbackPlatform = "darwin";
|
||||
if (typeof navigator !== "undefined") {
|
||||
if (/Mac|iPhone|iPad|iPod/.test(navigator.platform)) {
|
||||
fallbackPlatform = "darwin";
|
||||
} else if (/Linux/.test(navigator.platform)) {
|
||||
fallbackPlatform = "linux";
|
||||
}
|
||||
}
|
||||
|
||||
cachedPlatform = fallbackPlatform;
|
||||
return fallbackPlatform;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user