From 9360f9521bfa726753dc56bf36cdd606981773f9 Mon Sep 17 00:00:00 2001 From: David Montero Date: Mon, 15 Jun 2026 20:04:42 +0200 Subject: [PATCH] revert(sim): drop the WiFi run-gate seam (WiFi becomes freemium) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The proWifiGate seam blocked a free user from running ANY Pico W WiFi sketch. The product model changed: LOCAL WiFi (the chip associating to the simulator's virtual AP) is now FREE — only REAL internet (the backend bridge) and the IoT gateway are paid, gated inside the pro overlay's Cyw43PioPeripheral / backend. So a free user must be allowed to run WiFi sketches. Remove the gate seam and its two store call sites. The board-kind firmware variant + the run-time peripheral re-attach (which fixed the plain-firmware import-network crash) stay. --- frontend/src/lib/proWifiGate.ts | 58 --------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 frontend/src/lib/proWifiGate.ts diff --git a/frontend/src/lib/proWifiGate.ts b/frontend/src/lib/proWifiGate.ts deleted file mode 100644 index 89ff568b..00000000 --- a/frontend/src/lib/proWifiGate.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Pro WiFi-gate registry. - * - * Pico W (CYW43439) WiFi emulation is a paid overlay feature. Unlike - * `proBoardGate` (which gates whole Pro boards: STM32 / QEMU Raspberry Pi), - * the Pico W BOARD itself is free — it runs as a plain Pico in the browser. - * ONLY WiFi is gated, so this doorbell fires only when a Pico W sketch - * actually USES WiFi (so a free user can still blink an LED on a Pico W). - * - * Mirrors the other OSS->Pro seams (`proBoardGate.ts`, `proSaveAction.ts`, - * `proSession.ts`): the OSS app defines a stable doorbell and hands over the - * sketch files; the overlay plugs in the real decision. - * - * - OSS without an overlay -> default 'allow'. Self-hosted builds have no - * WiFi engine at all; a Pico W simulates as a plain Pico. - * - With the pro overlay -> 'block' for a WiFi-using sketch run by a - * non-paid web user; the caller fires the upgrade prompt and skips the run - * (so it never boots the plain-Pico firmware and crashes on - * `import network`). - */ - -import type { BoardKind } from '../types/board'; - -export type WifiGateDecision = 'allow' | 'block'; - -type WifiGateFile = { name: string; content: string }; -type WifiGateImpl = (kind: BoardKind | string, files: WifiGateFile[]) => WifiGateDecision; - -let _impl: WifiGateImpl | null = null; - -/** Installed by the pro overlay (mountPro). Pass null to clear (hot reload). */ -export function installWifiGateImpl(impl: WifiGateImpl | null): void { - _impl = impl; -} - -/** Whether the pro overlay has installed a WiFi gate. */ -export function hasWifiGateImpl(): boolean { - return _impl !== null; -} - -/** - * Decide whether running `kind` with these source files is allowed. With no - * overlay the OSS default is 'allow'. The overlay's impl sniffs the files for - * WiFi usage and checks the signed-in user's entitlement. - */ -export function wifiGateDecision( - kind: BoardKind | string, - files: WifiGateFile[], -): WifiGateDecision { - if (!_impl) return 'allow'; - try { - return _impl(kind, files); - } catch (err) { - // eslint-disable-next-line no-console - console.warn('[oss] wifi-gate impl threw:', err); - return 'allow'; - } -}