fix: pre-validate Cloudflare tunnel token by spawning cloudflared (#446)

* fix: pre-validate Cloudflare tunnel token by spawning cloudflared

After format validation passes, spawn `cloudflared tunnel run` briefly
with a dummy URL and watch stderr for up to 10s. If an error appears
before a connection URL, report it and offer "Save anyway?". This
catches bad tokens during setup instead of at runtime 30s later.

Closes #440

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* fix: tighten cloudflared output matching in live validation

- Check for cfargotunnel.com/trycloudflare.com in success detection
- Use starts_with("err") instead of contains("err") to avoid false
  positives on words like "stderr"

Co-Authored-By: Claude Opus 4.6 <[email protected]>

---------

Co-authored-by: Claude Opus 4.6 <[email protected]>
This commit is contained in:
Zaki Manian
2026-03-01 16:36:35 -08:00
committed by GitHub
co-authored by Claude Opus 4.6
parent 293a700b69
commit bb279ad822
2 changed files with 91 additions and 4 deletions
+1 -1
View File
@@ -1502,7 +1502,7 @@ impl SetupWizard {
/// Step 6: Channel configuration.
async fn step_channels(&mut self) -> Result<(), SetupError> {
// First, configure tunnel (shared across all channels that need webhooks)
match setup_tunnel(&self.settings) {
match setup_tunnel(&self.settings).await {
Ok(tunnel_settings) => {
self.settings.tunnel = tunnel_settings;
}