fix(desktop): report real hostname/platform/arch in heartbeat
Renderer was registering clients with navigator.platform ("MacIntel") and
a hardcoded "renderer-preview" cpu_arch. Source device info from the main
process (os.hostname + process.platform/arch) via a new device-info IPC,
and let heartbeats always send the authoritative runtime values so stale
registrations self-heal.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { hostname } from "node:os";
|
||||
import { join } from "node:path";
|
||||
|
||||
import { BrowserWindow, WebContentsView, app, ipcMain, nativeTheme } from "electron/main";
|
||||
@@ -125,6 +126,11 @@ function safeHandle<Args extends unknown[], Result>(
|
||||
|
||||
function registerBridgeHandlers(): void {
|
||||
ipcMain.handle("desktop:ping", () => "pong");
|
||||
ipcMain.handle("desktop:device-info", () => ({
|
||||
device_name: hostname() || `Desktop ${process.platform}`,
|
||||
os: process.platform,
|
||||
cpu_arch: process.arch,
|
||||
}));
|
||||
ipcMain.handle("desktop:runtime-snapshot", () => createRuntimeSnapshot());
|
||||
safeHandle("desktop:bind-publish-account", async (_event, platformId: string) => {
|
||||
const account = (await bindPublishAccount(platformId)) as DesktopAccountInfo;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { hostname } from "node:os";
|
||||
|
||||
import { ApiClientError } from "@geo/http-client";
|
||||
import type {
|
||||
DesktopArticleContent,
|
||||
@@ -489,9 +491,9 @@ async function sendHeartbeat(source: "startup" | "timer"): Promise<void> {
|
||||
|
||||
try {
|
||||
const response = await heartbeatDesktopClient({
|
||||
device_name: state.client?.device_name ?? `Desktop ${process.platform}`,
|
||||
os: state.client?.os ?? process.platform,
|
||||
cpu_arch: state.client?.cpu_arch ?? process.arch,
|
||||
device_name: hostname() || state.client?.device_name || `Desktop ${process.platform}`,
|
||||
os: process.platform,
|
||||
cpu_arch: process.arch,
|
||||
client_version: state.client?.client_version ?? "0.1.0-dev",
|
||||
channel: state.client?.channel ?? "dev",
|
||||
account_ids: state.accounts.filter((account) => account.health === "live").map((account) => account.id),
|
||||
|
||||
Reference in New Issue
Block a user