Files
buzz/desktop
Matt Toohey 1b171e833b fix(desktop): allow the configured dev URL in allow_webview_navigation
The Canvas navigation policy only allowed `http://localhost:1420` in debug
builds, but every `just` desktop recipe derives a per-worktree Vite port from
a hash of the worktree root (`scripts/instance-env.sh`) and injects it as
`build.devUrl`. `1420` is only what a bare `pnpm tauri dev` would use.

Because wry installs the navigation delegate before it issues the first
`loadRequest`, the cancelled navigation was the *initial* page load, not a
later link: WKWebView returned `WKNavigationActionPolicy::Cancel`, the bundle
never fetched, React never mounted, and the reveal timer gave up with
"initial render did not commit before reveal timeout" and showed an empty
window. `just dev`, `just staging`, and `just production` all opened blank on
macOS; the plugin is macOS-only, so Linux and Windows were unaffected.

Take the dev URL as a parameter and compare origins instead of hardcoding a
port. `lib.rs` passes `webview.config().build.dev_url`, which is the same
config the app was built with — `--config` merges into it via `TAURI_CONFIG`
at build time, so it is the origin the webview is actually pointed at.
Comparing full origins keeps the containment the old predicate had: a
different port, a different host spelling, and a non-http scheme are all
still refused, and release builds have no `devUrl`, so plain http stays
blocked there.

Two regression tests bind the guard to that seam — the configured origin is
allowed, and `localhost:1420`, `127.0.0.1` on the same port, and a missing
dev URL are not. Reverting to the hardcoded port fails the first one.

Verified with `just desktop-standalone`: the app boots on this worktree's
port 30164, the webview's Vite HMR client connects and forwards frontend
console output, and the reveal-timeout line is gone. Tauri fmt, clippy, and
the file-size gate pass; the Tauri suite passes 3059 tests. One unrelated
test (`forced_discovery::cheap_discovery_reports_absent_before_any_forced_probe`)
fails only under the full parallel run and passes in isolation.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
2026-09-01 11:20:52 +10:00
..
…

Buzz

Desktop chat shell with:

  • Tauri + React + TypeScript + Vite
  • Tailwind CSS
  • shadcn/ui-ready shared components
  • Biome (lint/format/check)
  • Feature-driven frontend structure

Scripts

  • pnpm dev - run the web frontend
  • pnpm tauri dev - run the desktop app
  • pnpm build - typecheck and build frontend
  • pnpm typecheck - TypeScript checks
  • pnpm lint - Biome lint
  • pnpm format - Biome format (write)
  • pnpm check - Biome check

Structure

  • src/shared - reusable app-wide code (ui, lib, styles)
  • src/features - feature modules (vertical slices)
  • src/app - top-level app composition