mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-24 14:47:23 +00:00
The web player is intrinsically LAN-resident: it reaches speakers directly and only delegates cloud-only features (e.g. TTS) to a possibly-remote AfterTouch service via --service-url. That is exactly what a cloud-hosted soundtouch-service cannot do, so the standalone player binary stays useful and is not being deprecated. Rename it to state its purpose, with a transition window so existing downloads keep working. - cmd/soundtouch-web -> cmd/soundtouch-player; CLI name is now soundtouch-player. When the binary is invoked under its old name it prints a one-line rename notice (filepath.Base(os.Args[0])). - Build/release both names from the same source: Makefile (build-player + build-web alias, dev-player* targets), Dockerfile (soundtouch-player image + transitional soundtouch-web image), release.yml and ci.yml (player + web artifacts, checksums, Docker images; release notes announce the rename). The soundtouch-web binary, image, and install script remain a transitional alias to be dropped in a future release (which will break stale fetch scripts and nudge users to the release notes). - scripts/raspberry-pi/install-player.sh is canonical; install-web.sh keeps working but warns. - Sweep docs, code comments, user-facing strings, and assets (soundtouch-web-ui.png, soundtouch-web-tunein.png, soundtouch-web-roadmap.md) to soundtouch-player; README documents the rename and why the player remains separate from the embedded /app. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
50 lines
1.4 KiB
Go
50 lines
1.4 KiB
Go
package soundtouchweb
|
|
|
|
import (
|
|
"crypto/tls"
|
|
"crypto/x509"
|
|
"fmt"
|
|
"net/http"
|
|
"os"
|
|
"time"
|
|
)
|
|
|
|
// NewServiceHTTPClient builds an *http.Client that trusts the AfterTouch
|
|
// service's CA certificate (PEM at caPath) in addition to the system trust
|
|
// store. soundtouch-player uses it for the only server-side call it makes to the
|
|
// service (the TTS proxy in handlers_tts.go): the service serves a self-signed
|
|
// certificate signed by its own "AfterTouch Local Root CA", which isn't in any
|
|
// system trust store, so http.DefaultClient would reject it with
|
|
// "x509: certificate signed by unknown authority".
|
|
//
|
|
// The CA is appended to a copy of the system pool (not a fresh empty one) so a
|
|
// deployment whose service URL happens to use a publicly trusted certificate
|
|
// keeps working.
|
|
func NewServiceHTTPClient(caPath string) (*http.Client, error) {
|
|
pem, err := os.ReadFile(caPath)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("read CA: %w", err)
|
|
}
|
|
|
|
pool, err := x509.SystemCertPool()
|
|
if err != nil || pool == nil {
|
|
pool = x509.NewCertPool()
|
|
}
|
|
|
|
if !pool.AppendCertsFromPEM(pem) {
|
|
return nil, fmt.Errorf("no valid certificate found in %s", caPath)
|
|
}
|
|
|
|
return &http.Client{
|
|
// TTS round-trips through Google Cloud synthesis and speaker playback,
|
|
// so allow more than the bare connect time.
|
|
Timeout: 30 * time.Second,
|
|
Transport: &http.Transport{
|
|
TLSClientConfig: &tls.Config{
|
|
RootCAs: pool,
|
|
MinVersion: tls.VersionTLS12,
|
|
},
|
|
},
|
|
}, nil
|
|
}
|