From ca6d8c4f68b3d64e31b20bbd92d9a189e295b2f6 Mon Sep 17 00:00:00 2001 From: Patrick Mulligan Date: Sat, 28 Mar 2026 00:50:34 -0400 Subject: [PATCH] feat: add VITE_MAINTENANCE_MODE env var for service screen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Set VITE_MAINTENANCE_MODE=true in .env to show an "Under Service" screen and block all transactions. No hardware init, no Lightning connection — just a static screen. Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/machine/.env.example | 7 +++++++ apps/machine/electron/main.ts | 3 +++ apps/machine/electron/preload.ts | 1 + apps/machine/src/App.vue | 25 ++++++++++++++++++++++--- apps/machine/src/types/electron.d.ts | 1 + 5 files changed, 34 insertions(+), 3 deletions(-) diff --git a/apps/machine/.env.example b/apps/machine/.env.example index 8124aa4..1bc2c2e 100644 --- a/apps/machine/.env.example +++ b/apps/machine/.env.example @@ -49,6 +49,13 @@ VITE_ATM_PRIVATE_KEY= # (manual dispense, remote management). Decoupled from Lightning.Pub identity. # VITE_OPERATOR_PUBKEYS=abcd1234...,ef567890... +# ============================================================================= +# Maintenance Mode +# ============================================================================= + +# Show "Under Service" screen and block all transactions +# VITE_MAINTENANCE_MODE=true + # ============================================================================= # Mock Fallback (Production Safety) # ============================================================================= diff --git a/apps/machine/electron/main.ts b/apps/machine/electron/main.ts index 04c61db..875cf73 100644 --- a/apps/machine/electron/main.ts +++ b/apps/machine/electron/main.ts @@ -187,6 +187,9 @@ ipcMain.handle('get-config', () => { // Operator identity (comma-separated hex pubkeys) operatorPubkeys: process.env.VITE_OPERATOR_PUBKEYS || '', + + // Maintenance mode — show "out of service" screen + maintenanceMode: process.env.VITE_MAINTENANCE_MODE === 'true', } }) diff --git a/apps/machine/electron/preload.ts b/apps/machine/electron/preload.ts index 952ede7..17f3ab4 100644 --- a/apps/machine/electron/preload.ts +++ b/apps/machine/electron/preload.ts @@ -26,6 +26,7 @@ export interface RuntimeConfig { cassettes?: string allowMockFallback: boolean operatorPubkeys: string + maintenanceMode: boolean } /** diff --git a/apps/machine/src/App.vue b/apps/machine/src/App.vue index 4d06d80..c0d0bb1 100644 --- a/apps/machine/src/App.vue +++ b/apps/machine/src/App.vue @@ -33,6 +33,16 @@ onMounted(async () => { }) } + // Check maintenance mode before initializing anything + const config = isElectron ? await window.electronAPI?.getConfig() : null + const maintenanceMode = + config?.maintenanceMode || import.meta.env.VITE_MAINTENANCE_MODE === 'true' + + if (maintenanceMode) { + atmStore.initError = 'maintenance' + return + } + try { if (isElectron) { await atmStore.initializeForProduction() @@ -88,11 +98,20 @@ function toggleLiveServices() { -

ATM Unavailable

+

+ {{ atmStore.initError === 'maintenance' ? 'Under Service' : 'ATM Unavailable' }} +

- This machine is temporarily out of service. Please try again later or use another machine. + {{ + atmStore.initError === 'maintenance' + ? 'This machine is currently being serviced. We will be back shortly.' + : 'This machine is temporarily out of service. Please try again later or use another machine.' + }}

-

+

{{ atmStore.initError }}

diff --git a/apps/machine/src/types/electron.d.ts b/apps/machine/src/types/electron.d.ts index bccb0e8..7e13fb7 100644 --- a/apps/machine/src/types/electron.d.ts +++ b/apps/machine/src/types/electron.d.ts @@ -15,6 +15,7 @@ export interface RuntimeConfig { cassettes?: string allowMockFallback: boolean operatorPubkeys: string + maintenanceMode: boolean } export interface AtmSecrets {