Seriously, why did I still have the duck image embedded twice when only the fs embed was used?
This commit is contained in:
parent
9afb2d36f0
commit
1169cd74a0
3 changed files with 4 additions and 9 deletions
2
go.mod
2
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
|
||||
|
|
4
main.go
4
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() {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue