feat: add Honcho Cloud connection preset

Adds a "choose-type" step to the settings flow so users can pick between
Honcho Cloud (https://api.honcho.dev, API key required) and Self-Hosted
(URL + optional token) when creating a connection. Multi-instance support
already exists in the data layer, so cloud and self-hosted instances can
coexist.

- new HONCHO_CLOUD_URL constant and isCloudInstance helper in config.ts
- SettingsForm accepts a preset prop; cloud variant locks the endpoint
  and enforces an API key
- InstancesManager gains a ConnectionTypeChooser entry point and renders
  a Cloud icon for cloud instances in the list
- unit tests for both preset paths and cloud edit-mode detection
This commit is contained in:
Claude
2026-05-14 23:21:28 +00:00
parent 4fc54a3581
commit f0717624eb
6 changed files with 315 additions and 49 deletions

View File

@@ -4,6 +4,16 @@ import { httpFetch } from "@/lib/http";
const LEGACY_KEY = "openconcho:config";
const STORE_KEY = "openconcho:instances";
export const HONCHO_CLOUD_URL = "https://api.honcho.dev";
function normalizeBaseUrl(url: string): string {
return url.trim().replace(/\/+$/, "").toLowerCase();
}
export function isCloudInstance(instance: Pick<Instance, "baseUrl">): boolean {
return normalizeBaseUrl(instance.baseUrl) === HONCHO_CLOUD_URL;
}
export const configSchema = z.object({
baseUrl: z.string().url({ message: "Must be a valid URL" }),
token: z.string().optional().default(""),