Default dashboard thumbnails to PNG

PNG screenshots are now the default for dashboard previews,
with SVG available by setting WEBTERM_SCREENSHOT_MODE=svg.
Documentation and tests updated accordingly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
GitHub Copilot
2026-02-18 17:53:33 +00:00
parent 25049dd1b0
commit 7a2a7877c4
4 changed files with 11 additions and 12 deletions
+2 -2
View File
@@ -13,7 +13,7 @@ https://github.com/user-attachments/assets/62c52183-83a3-4fb5-97b1-ed001de4f53a
- Typeahead find for quickly finding and launching sessions with minimal friction
- Web terminal with reconnect support
- Ghostty WebAssembly terminal engine for fast rendering from [`ghostty-web`](https://github.com/rcarmo/ghostty-web)
- Session dashboard with live SVG (or optional PNG) screenshots from [`go-te`](https://github.com/rcarmo/go-te)
- Session dashboard with live PNG (or optional SVG) screenshots from [`go-te`](https://github.com/rcarmo/go-te)
- Docker watch mode (`webterm-command` / `webterm-theme` labels)
- Docker compose manifest ingestion
- CPU sparkline tiles for compose services
@@ -97,7 +97,7 @@ go run ./cmd/webterm -- --compose-manifest ./docker-compose.yaml
- `WEBTERM_DOCKER_USERNAME`: user for Docker exec sessions
- `WEBTERM_DOCKER_AUTO_COMMAND`: override auto command (`/bin/bash` default)
- `WEBTERM_SCREENSHOT_FORCE_REDRAW`: force redraw before screenshots (`true/1/yes/on`)
- `WEBTERM_SCREENSHOT_MODE`: screenshot format for dashboard thumbnails (`svg` default, set `png` to enable PNG)
- `WEBTERM_SCREENSHOT_MODE`: screenshot format for dashboard thumbnails (`png` default, set `svg` to use SVG)
- `DOCKER_HOST`: Docker daemon endpoint override
## Development (Makefile-first)
+1 -1
View File
@@ -35,7 +35,7 @@ webterm/server.go (LocalServer)
- live WS stream (`stdout`)
- replay buffer (reconnect support)
- terminal-state tracker (`go-te`) for screenshots
4. Dashboard pulls `/screenshot.svg` (default) or `/screenshot.png` when `WEBTERM_SCREENSHOT_MODE=png`, and listens on `/events` for activity.
4. Dashboard pulls `/screenshot.png` (default) or `/screenshot.svg` when `WEBTERM_SCREENSHOT_MODE=svg`, and listens on `/events` for activity.
## Static assets
+2 -2
View File
@@ -240,8 +240,8 @@ func NewLocalServer(config Config, options ServerOptions) *LocalServer {
fontSize = DefaultFontSize
}
screenshotMode := strings.ToLower(strings.TrimSpace(os.Getenv(ScreenshotModeEnv)))
if screenshotMode != "png" {
screenshotMode = "svg"
if screenshotMode != "svg" {
screenshotMode = "png"
}
apps := append([]App{}, config.Apps...)
for _, app := range options.LandingApps {
+6 -7
View File
@@ -456,7 +456,6 @@ func TestScreenshotAndETag(t *testing.T) {
}
func TestScreenshotPNGAndETag(t *testing.T) {
t.Setenv(ScreenshotModeEnv, "png")
server, httpServer, _ := newServerForTests(t, false)
if _, err := server.sessionManager.NewSession("shell", "sid", "shell", 80, 24); err != nil {
t.Fatalf("NewSession error = %v", err)
@@ -534,13 +533,13 @@ func TestDashboardIncludesContextMenuSanitizedDownload(t *testing.T) {
if !strings.Contains(text, "contextmenu") || !strings.Contains(text, "sanitize_font_urls=1&download=1") {
t.Fatalf("expected contextmenu sanitized download wiring in dashboard page")
}
if !strings.Contains(text, "screenshot.svg") {
t.Fatalf("expected dashboard to request svg screenshots by default")
if !strings.Contains(text, "screenshot.png") {
t.Fatalf("expected dashboard to request png screenshots by default")
}
}
func TestDashboardUsesPNGWhenEnabled(t *testing.T) {
t.Setenv(ScreenshotModeEnv, "png")
func TestDashboardUsesSVGWhenConfigured(t *testing.T) {
t.Setenv(ScreenshotModeEnv, "svg")
_, httpServer, _ := newServerForTests(t, true)
resp, err := http.Get(httpServer.URL + "/")
if err != nil {
@@ -549,8 +548,8 @@ func TestDashboardUsesPNGWhenEnabled(t *testing.T) {
body, _ := io.ReadAll(resp.Body)
_ = resp.Body.Close()
text := string(body)
if !strings.Contains(text, "screenshot.png") {
t.Fatalf("expected dashboard to request png screenshots when enabled")
if !strings.Contains(text, "screenshot.svg") {
t.Fatalf("expected dashboard to request svg screenshots when configured")
}
if !strings.Contains(text, "sanitize_font_urls=1&download=1") || !strings.Contains(text, "screenshot.svg") {
t.Fatalf("expected contextmenu downloads to use svg screenshots")