From 81a30b3a7674d037ece151c3330e39813479500e Mon Sep 17 00:00:00 2001 From: zackees Date: Thu, 11 Jun 2026 17:05:57 -0700 Subject: [PATCH] release: v2.0.11 with viewer fix #157 and viewer URL regression gate Bumps workspace version 2.0.10 -> 2.0.11 so the auto-release workflow ships the first release containing 0332caf (#157), which points the Tauri viewer at the HTTP server instead of serving files from disk. Adds a fail-loud http(s) URL check in launch_tauri_viewer plus unit tests rejecting directory paths and fastled:// URLs, so a regression back to disk-backed viewing fails tests instead of shipping a dead "Not Found" window. Closes #160 Refs #151 Co-Authored-By: Claude Opus 4.7 --- crates/fastled-cli/src/viewer.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/crates/fastled-cli/src/viewer.rs b/crates/fastled-cli/src/viewer.rs index 7e439def..89a5ae9f 100644 --- a/crates/fastled-cli/src/viewer.rs +++ b/crates/fastled-cli/src/viewer.rs @@ -346,7 +346,18 @@ fn spawn_hidden_viewer(binary: &Path, url: &str) -> Result { /// viewer/WebView2 process tree is torn down too. /// /// Returns a process handle whose lifetime controls the viewer lifetime. +/// +/// Fails loudly when `url` is not an http(s) URL. The viewer must always be +/// pointed at the embedded HTTP server (which serves the loading page and +/// reloads on build completion); pointing it at a directory or `fastled://` +/// path regresses to a dead "Not Found" page (issues #151/#160). pub fn launch_tauri_viewer(url: &str) -> Result { + if !url.starts_with("http://") && !url.starts_with("https://") { + anyhow::bail!( + "viewer must be launched with an http(s) URL pointing at the FastLED server, got: {url}" + ); + } + let binary = find_tauri_viewer().context("fastled binary not found; cannot launch Tauri viewer")?; @@ -520,6 +531,24 @@ mod tests { assert_eq!(args, vec!["--internal-viewer", "http://127.0.0.1:8089"]); } + #[test] + fn test_launch_tauri_viewer_rejects_directory_path() { + // Regression gate for #151/#160: the viewer must never be pointed at + // a filesystem path; it must load the FastLED HTTP server URL. + match launch_tauri_viewer("examples/TwinkleFox/fastled_js") { + Ok(_) => panic!("directory path must be rejected"), + Err(err) => assert!(err.to_string().contains("http(s) URL"), "got: {err}"), + } + } + + #[test] + fn test_launch_tauri_viewer_rejects_fastled_protocol() { + match launch_tauri_viewer("fastled://localhost/index.html") { + Ok(_) => panic!("fastled:// protocol must be rejected"), + Err(err) => assert!(err.to_string().contains("http(s) URL"), "got: {err}"), + } + } + #[test] #[cfg(windows)] fn test_viewer_uses_hidden_process_creation_flags() {