refactor(cpu_dialog): more mentions of rosetta

This commit is contained in:
Elian Doran 2025-06-12 22:53:15 +03:00
parent c6c59c63bb
commit 9713864bb6
No known key found for this signature in database
3 changed files with 7 additions and 10 deletions

View File

@ -10,19 +10,17 @@ export class StartupChecks extends Component {
constructor() { constructor() {
super(); super();
this.checkRosetta2Warning(); this.checkCpuArchMismatch();
} }
async checkRosetta2Warning() { async checkCpuArchMismatch() {
try { try {
// Check if running under Rosetta 2 by calling the server
const response = await server.get("system-checks") as CpuArchResponse; const response = await server.get("system-checks") as CpuArchResponse;
if (response.isCpuArchMismatch) { if (response.isCpuArchMismatch) {
// Trigger the Rosetta 2 warning dialog
this.triggerCommand("showCpuArchWarning", {}); this.triggerCommand("showCpuArchWarning", {});
} }
} catch (error) { } catch (error) {
console.warn("Could not check Rosetta 2 status:", error); console.warn("Could not check CPU arch status:", error);
} }
} }
} }

View File

@ -28,7 +28,7 @@ const TPL = /*html*/`
</div> </div>
</div>`; </div>`;
export default class RosettaWarningDialog extends BasicWidget { export default class IncorrectCpuArchDialog extends BasicWidget {
private modal!: Modal; private modal!: Modal;
private $downloadButton!: JQuery<HTMLElement>; private $downloadButton!: JQuery<HTMLElement>;

View File

@ -9,10 +9,9 @@ function systemChecks() {
} }
/** /**
* Detects if the application is running under Rosetta 2 translation on Apple Silicon. * Detects if the application is running under emulation on Apple Silicon or Windows on ARM.
* This happens when an x64 version of the app is run on an M1/M2/M3 Mac. * This happens when an x64 version of the app is run on an M1/M2/M3 Mac or on a Windows Snapdragon chip.
* Uses the macOS sysctl.proc_translated to properly detect translation. * @returns true if running on x86 emulation on ARM, false otherwise.
* @returns true if running under Rosetta 2, false otherwise
*/ */
export const isCpuArchMismatch = () => { export const isCpuArchMismatch = () => {
if (isMac) { if (isMac) {