From dbdc75627af2f7885c6df009004c0422a3561e42 Mon Sep 17 00:00:00 2001 From: Tobias Gesellchen Date: Sat, 6 Jun 2026 20:49:49 +0200 Subject: [PATCH] refactor(cli): call /api/setup/* from soundtouch-cli (refs #451) Point the CLI's service calls at the new canonical paths: tts speak (/api/setup/tts/speak) and the CA bundle fetch (/api/setup/ca.crt), plus the user-facing message and doc comment. No behavior change; legacy paths still work. Co-Authored-By: Claude Opus 4.8 (1M context) --- cmd/soundtouch-cli/cmd_setup.go | 6 +++--- cmd/soundtouch-cli/cmd_tts.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/soundtouch-cli/cmd_setup.go b/cmd/soundtouch-cli/cmd_setup.go index 75689c3..117e8f6 100644 --- a/cmd/soundtouch-cli/cmd_setup.go +++ b/cmd/soundtouch-cli/cmd_setup.go @@ -606,7 +606,7 @@ func setupInstallCACmd() *cli.Command { return err } - fmt.Printf("Fetched %d bytes of CA PEM from %s/setup/ca.crt\n", len(certPEM), serviceURL) + fmt.Printf("Fetched %d bytes of CA PEM from %s/api/setup/ca.crt\n", len(certPEM), serviceURL) m := setup.NewManager(serviceURL, nil, nil) @@ -627,11 +627,11 @@ func setupInstallCACmd() *cli.Command { } } -// fetchCACert pulls AfterTouch's CA bundle from /setup/ca.crt. On HTTP 401 +// fetchCACert pulls AfterTouch's CA bundle from /api/setup/ca.crt. On HTTP 401 // it prompts interactively for basic-auth credentials (or accepts --auth) // and retries once. func fetchCACert(serviceURL, authFlag string) ([]byte, error) { - url := serviceURL + "/setup/ca.crt" + url := serviceURL + "/api/setup/ca.crt" doRequest := func(user, pass string) (*http.Response, error) { req, err := http.NewRequest(http.MethodGet, url, nil) diff --git a/cmd/soundtouch-cli/cmd_tts.go b/cmd/soundtouch-cli/cmd_tts.go index 8b983de..d48cb58 100644 --- a/cmd/soundtouch-cli/cmd_tts.go +++ b/cmd/soundtouch-cli/cmd_tts.go @@ -101,7 +101,7 @@ func ttsCloud(c *cli.Context) error { return fmt.Errorf("marshal request: %w", err) } - req, err := http.NewRequest(http.MethodPost, serviceURL+"/setup/tts/speak", bytes.NewReader(body)) + req, err := http.NewRequest(http.MethodPost, serviceURL+"/api/setup/tts/speak", bytes.NewReader(body)) if err != nil { return fmt.Errorf("build request: %w", err) }