bruschetta

A simple golang web based file browser
Log | Files | Refs | LICENSE

commit 4432b0e264dfe29ef6a5911bc29d062631d97264
parent 6ab1f4000be90bd2b8b5ecb22cc38e6375720a64
Author: Peter <peter@minskio.co.uk>
Date:   Mon, 16 Nov 2026 13:15:22 +0000

Support more video formats in thumbnailer

Diffstat:
Mmain.go | 12++++++++++--
Mreadme.md | 2+-
2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/main.go b/main.go @@ -524,7 +524,7 @@ func thumbHandler(w http.ResponseWriter, r *http.Request) { var img image.Image - if strings.EqualFold(filepath.Ext(fsPath), ".webm") { + if isVideoExt(strings.ToLower(strings.TrimPrefix(filepath.Ext(fsPath), "."))) { f.Close() cmd := exec.Command( @@ -618,7 +618,15 @@ func buildTree(basePath, urlBase string) []*TreeNode { func isImageExt(ext string) bool { switch ext { - case "jpg", "jpeg", "png", "gif", "webp", "bmp", "avif", "webm": + case "jpg", "jpeg", "png", "gif", "webp", "bmp", "avif": + return true + } + return isVideoExt(ext) +} + +func isVideoExt(ext string) bool { + switch ext { + case "webm", "mp4", "m4v", "mkv", "mov", "avi", "wmv", "flv", "mpg", "mpeg", "3gp", "ogv", "mts", "m2ts": return true } return false diff --git a/readme.md b/readme.md @@ -22,7 +22,7 @@ The application is also buildable via your usual `go build -o bruschetta .`. * Dotfiles are hidden, but still accessible * Collapsable folder tree * Sortable Name, Size and Modified columns -* No dependencies outside stdlib, does require `ffmpeg` for webm thumbnails +* No dependencies outside stdlib and `ffmpeg` for video thumbnails * Renders `index.htm(l)` files in directories instead of listing ## Screenshot