mirror of
https://github.com/garethgeorge/backrest.git
synced 2026-08-27 19:36:29 +00:00
fix: use github.com/vearutop/statigz to embed webUI srcs and improve Accept-Encoding handling
This commit is contained in:
@@ -71,6 +71,7 @@ require (
|
||||
github.com/prometheus/procfs v0.16.1 // indirect
|
||||
github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
github.com/vearutop/statigz v1.5.0 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||
go.opentelemetry.io/otel v1.35.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.35.0 // indirect
|
||||
|
||||
@@ -164,6 +164,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/vearutop/statigz v1.5.0 h1:FuWwZiT82yBw4xbWdWIawiP2XFTyEPhIo8upRxiKLqk=
|
||||
github.com/vearutop/statigz v1.5.0/go.mod h1:oHmjFf3izfCO804Di1ZjB666P3fAlVzJEx2k6jNt/Gk=
|
||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0=
|
||||
go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I=
|
||||
|
||||
@@ -53,12 +53,12 @@ func (r *Repo) commandWithContext(ctx context.Context, args []string, opts ...Ge
|
||||
resolveOpts(opt, r.opts)
|
||||
resolveOpts(opt, opts)
|
||||
|
||||
fullCmd := append([]string{r.cmd}, args...)
|
||||
|
||||
if len(opt.prefixCmd) > 0 {
|
||||
fullCmd = append(slices.Clone(opt.prefixCmd), fullCmd...)
|
||||
var fullCmd []string
|
||||
fullCmd = append(fullCmd, opt.prefixCmd...)
|
||||
if r.cmd != "" {
|
||||
fullCmd = append(fullCmd, r.cmd)
|
||||
}
|
||||
|
||||
fullCmd = append(fullCmd, args...)
|
||||
fullCmd = append(fullCmd, opt.extraArgs...)
|
||||
|
||||
cmd := exec.CommandContext(ctx, fullCmd[0], fullCmd[1:]...)
|
||||
|
||||
+3
-1
@@ -2,8 +2,10 @@ package webui
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/vearutop/statigz"
|
||||
)
|
||||
|
||||
func Handler() http.Handler {
|
||||
|
||||
return statigz.FileServer(content, statigz.FSPrefix(contentPrefix))
|
||||
}
|
||||
|
||||
+2
-2
@@ -38,9 +38,9 @@ func TestServeIndexNoGzip(t *testing.T) {
|
||||
|
||||
// Windows doesn't have the gzip binary, so we skip compression during the
|
||||
// go:generate step on Windows
|
||||
if runtime.GOOS != "windows" && rr.Header().Get("Content-Encoding") != "gzip" {
|
||||
if runtime.GOOS != "windows" && rr.Header().Get("Content-Encoding") != "" {
|
||||
t.Errorf("handler returned wrong content encoding: got %v want %v",
|
||||
rr.Header().Get("Content-Encoding"), "gzip")
|
||||
rr.Header().Get("Content-Encoding"), "")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user