From 1169cd74a08e903cd3987af4ff25c3b3a2480f82 Mon Sep 17 00:00:00 2001 From: mstar Date: Wed, 11 Jun 2025 16:19:25 +0200 Subject: [PATCH] Remove one of the duck embeds, go mod tidy Seriously, why did I still have the duck image embedded twice when only the fs embed was used? --- go.mod | 2 +- main.go | 4 ---- web/public/server.go | 7 +++---- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index db01805..75ea6b3 100644 --- a/go.mod +++ b/go.mod @@ -14,6 +14,7 @@ require ( github.com/jackc/pgx/v5 v5.7.4 github.com/kohkimakimoto/gluatemplate v0.0.0-20160815033744-d9e2c9d6b00f github.com/layeh/gopher-json v0.0.0-20201124131017-552bb3c4c3bf + github.com/minio/minio-go/v7 v7.0.92 github.com/mitchellh/mapstructure v1.5.0 github.com/nrednav/cuid2 v1.0.1 github.com/pquerna/otp v1.4.0 @@ -68,7 +69,6 @@ require ( github.com/miekg/dns v1.1.64 // indirect github.com/minio/crc64nvme v1.0.1 // indirect github.com/minio/md5-simd v1.1.2 // indirect - github.com/minio/minio-go/v7 v7.0.92 // indirect github.com/onsi/ginkgo/v2 v2.9.5 // indirect github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c // indirect github.com/quic-go/qpack v0.5.1 // indirect diff --git a/main.go b/main.go index 9dc9dff..96b131b 100644 --- a/main.go +++ b/main.go @@ -34,9 +34,6 @@ import ( //go:embed frontend-noscript // var nojsFS embed.FS -//go:embed duck.webp -var defaultDuck string - //go:embed duck.webp var duckFS embed.FS @@ -131,7 +128,6 @@ func newServer() { } public := webpublic.New( fmt.Sprintf(":%v", config.GlobalConfig.General.PrivatePort), - &defaultDuck, duckFS, ) go func() { diff --git a/web/public/server.go b/web/public/server.go index 5520212..944f716 100644 --- a/web/public/server.go +++ b/web/public/server.go @@ -46,7 +46,7 @@ type Server struct { quicServer *http3.Server } -func New(addr string, duckImg *string, duckFs fs.FS) *Server { +func New(addr string, duckFs fs.FS) *Server { handler := http.NewServeMux() handler.Handle("/api/", http.StripPrefix("/api", api.BuildApiRouter())) handler.HandleFunc("GET /.well-known/webfinger", api.WellKnownWebfinger) @@ -54,8 +54,8 @@ func New(addr string, duckImg *string, duckFs fs.FS) *Server { handler.HandleFunc("GET /nodeinfo/2.1", api.NodeInfo21) handler.HandleFunc("GET /nodeinfo/2.0", api.NodeInfo20) handler.HandleFunc("GET /errors/{name}", errorTypeHandler) - handler.HandleFunc("GET /default-image", buildServeDefaultImage(duckImg, duckFs)) - handler.HandleFunc("GET /default-image.webp", buildServeDefaultImage(duckImg, duckFs)) + handler.HandleFunc("GET /default-image", buildServeDefaultImage(duckFs)) + handler.HandleFunc("GET /default-image.webp", buildServeDefaultImage(duckFs)) rootHandler := webutils.ChainMiddlewares( handler, webutils.BuildLoggingMiddleware( @@ -145,7 +145,6 @@ func (s *Server) Stop() error { } func buildServeDefaultImage( - duckImg *string, duckFs fs.FS, ) func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {