From 99abad660f089d0cab9c0babf8377af65dc48f21 Mon Sep 17 00:00:00 2001 From: Frans Allen Date: Mon, 16 Nov 2026 11:21:35 +0700 Subject: [PATCH 01/46] fix(api): ask to set up tailscale when it makes no auth key --- crates/pyo-api/src/ops.rs | 2 +- crates/pyo-api/src/sandbox/mod.rs | 8 ++++++-- crates/pyo-api/src/tailscale.rs | 18 ++++++++++++------ 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/crates/pyo-api/src/ops.rs b/crates/pyo-api/src/ops.rs index 9536807..3410f4b 100644 --- a/crates/pyo-api/src/ops.rs +++ b/crates/pyo-api/src/ops.rs @@ -742,7 +742,7 @@ async fn reach( let api = crate::web::tailnet_api_url().ok_or_else(|| { ApiError::conflict("Pyo's server isn't on your tailnet yet. Try again in a minute.") })?; - let key = crate::tailscale::join_key(s, what).await?; + let key = crate::tailscale::join_key(s, what, "this server").await?; let door = crate::join::friendly(&deploy::registry_push()); let registry = if door.is_empty() { None diff --git a/crates/pyo-api/src/sandbox/mod.rs b/crates/pyo-api/src/sandbox/mod.rs index 1011d8e..5152fd3 100644 --- a/crates/pyo-api/src/sandbox/mod.rs +++ b/crates/pyo-api/src/sandbox/mod.rs @@ -1046,8 +1046,12 @@ pub async fn add_server(s: &AppState, user: &User, req: AddServer) -> ApiResult< }; let code = join::new_code(); join::keep(&mut tx, &id, &code).await?; - let ts_key = - crate::tailscale::join_key(s, &format!("Pyo: sandbox server {}", req.name)).await?; + let ts_key = crate::tailscale::join_key( + s, + &format!("Pyo: sandbox server {}", req.name), + "a sandbox server", + ) + .await?; if let Some(t) = &req.team_id { crate::ops::log_activity( &mut tx, diff --git a/crates/pyo-api/src/tailscale.rs b/crates/pyo-api/src/tailscale.rs index 8cc7448..bc411fa 100644 --- a/crates/pyo-api/src/tailscale.rs +++ b/crates/pyo-api/src/tailscale.rs @@ -1008,17 +1008,23 @@ pub async fn wanted_for( /// Tailscale made no auth key: the details go to the log, the user gets one /// plain sentence and where to look. -fn no_auth_key(e: anyhow::Error) -> ApiError { - tracing::warn!(error = %format!("{e:#}"), "Tailscale made no auth key"); - ApiError::bad_request("Tailscale made no auth key. Check the Tailscale setup in Integrations.") +/// `server` names what is being added, e.g. "a sandbox server". +fn no_auth_key(server: &'static str) -> impl FnOnce(anyhow::Error) -> ApiError { + move |e| { + tracing::warn!(error = %format!("{e:#}"), "Tailscale made no auth key"); + ApiError::bad_request(format!("Set up Tailscale in Integrations to add {server}.")) + } } /// A join command's auth key: single-use, preauthorized, tag:pyo, an hour. -pub async fn join_key(s: &AppState, what: &str) -> ApiResult { +pub async fn join_key(s: &AppState, what: &str, server: &'static str) -> ApiResult { let Some((_, c)) = saved_client(s).await? else { return Err(ApiError::bad_request(NEEDED)); }; - c.auth_key(what).await.map(|(_, k)| k).map_err(no_auth_key) + c.auth_key(what) + .await + .map(|(_, k)| k) + .map_err(no_auth_key(server)) } /// Whether a tailnet domain someone typed can be had: Pyo's reserved names @@ -1335,7 +1341,7 @@ pub async fn host_report( let (_, key) = c .auth_key("Pyo: its own server") .await - .map_err(no_auth_key)?; + .map_err(no_auth_key("this server"))?; tracing::info!("this machine: joining the tailnet"); Ok(json!({ "state": "join", "authKey": key })) } From 0e142c0ea375a0a57db1c9e7c2ad6900076ba4cc Mon Sep 17 00:00:00 2001 From: Frans Allen Date: Mon, 16 Nov 2026 11:24:44 +0700 Subject: [PATCH 02/46] feat(dash): link tailscale in the add sandbox server error --- dash/src/components/pyo/sandbox/common.tsx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/dash/src/components/pyo/sandbox/common.tsx b/dash/src/components/pyo/sandbox/common.tsx index 83b9b5a..ecc5ac8 100644 --- a/dash/src/components/pyo/sandbox/common.tsx +++ b/dash/src/components/pyo/sandbox/common.tsx @@ -1,6 +1,7 @@ import { CheckCircleIcon, CircleNotchIcon } from "@phosphor-icons/react"; import { useEffect, useState } from "react"; import { NeedsTailscale } from "~/components/pyo/Tailscale"; +import { AppLink } from "~/components/ui/AppLink"; import { LiveCommand } from "~/components/pyo/LiveCommand"; import { Badge, Dot } from "~/components/ui/Badge"; import { Button } from "~/components/ui/Button"; @@ -85,6 +86,9 @@ export function serverUse(x: SandboxServer) { return { used: Math.min(usable, c.memoryCommitted), total: usable }; } +/** How Pyo's "set up Tailscale" errors start: the word Tailscale links to its card. */ +const TAILSCALE = "Set up Tailscale"; + /** What sandbox.sh takes for --edge-domain. */ const EDGE_DOMAIN = /^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z][a-z0-9-]{0,62}$/; @@ -210,7 +214,21 @@ export function AddSandboxServer({ onDone }: { onDone?: () => void }) { )} - {error ? {error} : null} + {error ? ( + + {error.startsWith(TAILSCALE) ? ( + <> + Set up{" "} + + Tailscale + + {error.slice(TAILSCALE.length)} + + ) : ( + error + )} + + ) : null} From 2042b90170ebc10667767ef15eeba2f77707e97d Mon Sep 17 00:00:00 2001 From: Frans Allen Date: Mon, 16 Nov 2026 11:31:30 +0700 Subject: [PATCH 03/46] fix(api): drop characters tailscale rejects from auth key descriptions Tailscale answers 400 "description had invalid characters" to the colon in "Pyo: join web-1", so adding a cluster or sandbox server failed on every install since 0.3.0. --- crates/pyo-api/src/tailscale.rs | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/crates/pyo-api/src/tailscale.rs b/crates/pyo-api/src/tailscale.rs index bc411fa..e6a4019 100644 --- a/crates/pyo-api/src/tailscale.rs +++ b/crates/pyo-api/src/tailscale.rs @@ -461,7 +461,7 @@ impl Client { let body = json!({ "capabilities": { "devices": { "create": { "reusable": false, "ephemeral": false, "preauthorized": true, "tags": [TAG] } } }, "expirySeconds": 3600, - "description": description, + "description": key_description(description), }); let v = self .call(reqwest::Method::POST, "/tailnet/-/keys", Some(&body)) @@ -483,6 +483,19 @@ impl Client { } } +/// What Tailscale takes as a key's description: letters, digits, spaces, +/// dashes and underscores, at most 50 characters. "Pyo: join web-1" +/// becomes "Pyo join web-1". +fn key_description(s: &str) -> String { + let kept: String = s + .chars() + .filter(|c| c.is_ascii_alphanumeric() || matches!(c, ' ' | '-' | '_')) + .collect(); + let mut out = kept.split_whitespace().collect::>().join(" "); + out.truncate(50); + out.trim_end().to_owned() +} + /// A machine on the tailnet ([`Client::device_details`]). #[derive(Debug, Clone, PartialEq)] pub struct Device { @@ -1348,6 +1361,19 @@ pub async fn host_report( #[cfg(test)] mod tests { + #[test] + fn key_descriptions_are_what_tailscale_takes() { + use super::key_description; + assert_eq!(key_description("Pyo: join web-1"), "Pyo join web-1"); + assert_eq!( + key_description("Pyo: sandbox server sbx_1"), + "Pyo sandbox server sbx_1" + ); + assert_eq!(key_description("Pyo: its own server"), "Pyo its own server"); + let long = key_description(&format!("Pyo: join {}", "a".repeat(80))); + assert_eq!(long.len(), 50); + } + use super::*; /// A mock Tailscale API: a Service ("docker", someone else's) that the From bd2708ef484bd6cd3255d5afc95ed19aa01dc334 Mon Sep 17 00:00:00 2001 From: Frans Allen Date: Mon, 16 Nov 2026 11:36:48 +0700 Subject: [PATCH 04/46] feat(dash): show integrations as cards with filters and search Each integration is a card with its category, a real stat and status when connected, and what it enables plus a setup guide when not. A segmented filter by category and a search sit on top. Settings move into dialogs from each card's menu, and /integrations# scrolls to a card and opens them. --- dash/src/components/pyo/Cloudflare.tsx | 10 +- dash/src/components/pyo/GitConnections.tsx | 2 +- dash/src/components/pyo/Hetzner.tsx | 10 +- dash/src/components/pyo/IntegrationCard.tsx | 149 +++++ dash/src/components/pyo/RegistryLogins.tsx | 24 +- dash/src/components/pyo/SecretStores.tsx | 41 +- dash/src/components/pyo/Tailscale.tsx | 32 +- dash/src/routes/_app/$team/integrations.tsx | 676 +++++++++++++++++--- 8 files changed, 792 insertions(+), 152 deletions(-) create mode 100644 dash/src/components/pyo/IntegrationCard.tsx diff --git a/dash/src/components/pyo/Cloudflare.tsx b/dash/src/components/pyo/Cloudflare.tsx index 49cbfd5..40580f5 100644 --- a/dash/src/components/pyo/Cloudflare.tsx +++ b/dash/src/components/pyo/Cloudflare.tsx @@ -6,7 +6,6 @@ import { AppLink } from "~/components/ui/AppLink"; import { Button } from "~/components/ui/Button"; import { ConfirmDialog } from "~/components/ui/Dialog"; import { SecretInput, Switch } from "~/components/ui/Field"; -import { Panel } from "~/components/ui/Panel"; import { timeAgo } from "~/lib/pyo/format"; import { isFreeDomain } from "~/lib/pyo/freeDomain"; import { @@ -26,7 +25,7 @@ import type { Application, Domain } from "~/lib/pyo/types"; const isAdmin = (role?: string) => role === "owner" || role === "admin"; /** Integrations › Cloudflare: connect, test, replace and remove the token. */ -export function CloudflarePanel() { +export function CloudflareSettings() { const s = usePyo(); const account = cloudflareIn(s); const admin = isAdmin(roleIn(s)); @@ -100,10 +99,7 @@ export function CloudflarePanel() { ); return ( - + <>