mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-20 17:46:19 +00:00
Move soundtouch-web from Bootstrap+vanilla JS to an embedded-asset Go service using Preact+htm (no build step). Implements Stockholm UI parity: device list, now playing, transport controls, presets, sources, and TuneIn browser. - Relocate handlers/websocket/webtypes to pkg/service/soundtouchweb/ - Replace old static/ with CSS-custom-property design system (dark mode) - Add Preact component tree: DeviceList, NowPlaying, Controls, Presets, Sources, TuneInBrowser - Wire WebSocket for real-time device status updates - Slim cmd/soundtouch-web/main.go to a thin CLI wrapper Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
56 lines
1.1 KiB
Go
56 lines
1.1 KiB
Go
// Package main provides a web UI for controlling Bose SoundTouch devices.
|
|
package main
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
"os"
|
|
|
|
"github.com/gesellix/bose-soundtouch/pkg/service/soundtouchweb"
|
|
"github.com/go-chi/chi/v5"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
func main() {
|
|
app := &cli.App{
|
|
Name: "soundtouch-web",
|
|
Usage: "Web UI for controlling Bose SoundTouch devices",
|
|
Flags: []cli.Flag{
|
|
&cli.StringFlag{
|
|
Name: "port",
|
|
Aliases: []string{"p"},
|
|
Usage: "HTTP port to listen on",
|
|
Value: "8080",
|
|
EnvVars: []string{"PORT"},
|
|
},
|
|
&cli.StringFlag{
|
|
Name: "bind",
|
|
Usage: "Network interface to bind to",
|
|
EnvVars: []string{"BIND_ADDR"},
|
|
},
|
|
},
|
|
Action: func(c *cli.Context) error {
|
|
port := c.String("port")
|
|
bindAddr := c.String("bind")
|
|
|
|
addr := ":" + port
|
|
if bindAddr != "" {
|
|
addr = bindAddr + ":" + port
|
|
}
|
|
|
|
webApp := soundtouchweb.New()
|
|
|
|
r := chi.NewRouter()
|
|
webApp.Mount(r)
|
|
|
|
log.Printf("SoundTouch Web UI starting on http://%s", addr)
|
|
|
|
return http.ListenAndServe(addr, r)
|
|
},
|
|
}
|
|
|
|
if err := app.Run(os.Args); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|