Fix desktop crate build; simplify tray/menu and telemetry reconnect
Real bugs found by actually compiling the Tauri crate for the first time: - Cargo.toml declared a [lib] with no src/lib.rs (cargo refused to parse the manifest) — added the standard Tauri 2 main.rs/lib.rs split. - generate_context!() needs real icon files; icons/ only had a .gitkeep. Added placeholder PNG/ICO/ICNS icons. Also simplified: dropped the tray icon + menu (one more moving part not needed yet), and the telemetry store's exponential backoff is now a fixed 3s retry, matching the same simplification made to continuum-proxy's uplink client. Fixed two real TS bugs while typechecking apps/web for the first time (missing @types/node for nuxt.config.ts's process.env access, untyped useFetch call inferring 'never'). Verified: cargo check (desktop), vue-tsc --noEmit (web + ui packages) all clean.
This commit is contained in:
@@ -14,15 +14,15 @@ interface TelemetryState {
|
||||
socket: WebSocket | null;
|
||||
connected: boolean;
|
||||
printers: Record<string, PrinterTelemetry>;
|
||||
reconnectAttempt: number;
|
||||
}
|
||||
|
||||
const RECONNECT_DELAY_MS = 3_000;
|
||||
|
||||
export const useTelemetryStore = defineStore("telemetry", {
|
||||
state: (): TelemetryState => ({
|
||||
socket: null,
|
||||
connected: false,
|
||||
printers: {},
|
||||
reconnectAttempt: 0,
|
||||
}),
|
||||
|
||||
getters: {
|
||||
@@ -48,7 +48,6 @@ export const useTelemetryStore = defineStore("telemetry", {
|
||||
|
||||
socket.onopen = () => {
|
||||
this.connected = true;
|
||||
this.reconnectAttempt = 0;
|
||||
};
|
||||
|
||||
socket.onmessage = (event) => {
|
||||
@@ -65,9 +64,7 @@ export const useTelemetryStore = defineStore("telemetry", {
|
||||
socket.onclose = () => {
|
||||
this.connected = false;
|
||||
this.socket = null;
|
||||
const delay = Math.min(30_000, 1_000 * 2 ** this.reconnectAttempt);
|
||||
this.reconnectAttempt += 1;
|
||||
setTimeout(() => this.connect(), delay);
|
||||
setTimeout(() => this.connect(), RECONNECT_DELAY_MS);
|
||||
};
|
||||
|
||||
socket.onerror = () => {
|
||||
|
||||
Reference in New Issue
Block a user