fix: report macos product version in presence

This commit is contained in:
Peter Steinberger
2025-12-28 14:34:07 +00:00
parent 255a875a2a
commit 3bb4c0c237
2 changed files with 9 additions and 1 deletions

View File

@@ -69,10 +69,17 @@ function initSelfPresence() {
}
return os.arch();
})();
const macOSVersion = () => {
const res = spawnSync("sw_vers", ["-productVersion"], {
encoding: "utf-8",
});
const out = typeof res.stdout === "string" ? res.stdout.trim() : "";
return out.length > 0 ? out : os.release();
};
const platform = (() => {
const p = os.platform();
const rel = os.release();
if (p === "darwin") return `macos ${rel}`;
if (p === "darwin") return `macos ${macOSVersion()}`;
if (p === "win32") return `windows ${rel}`;
return `${p} ${rel}`;
})();