feat: update fabfile

This commit is contained in:
Rogee
2025-05-06 15:19:38 +08:00
parent 4b08a8199b
commit a2c38833b0
3 changed files with 10 additions and 8 deletions

View File

@@ -133,11 +133,6 @@ func checkStaticFile(rootPath string) func(ctx fiber.Ctx) error {
f = "index.html"
}
ext := filepath.Ext(f)
mime := mime.TypeByExtension(ext)
log.Infof("admin mime type: %s %s", ext, mime)
ctx.Set(fiber.HeaderContentType, mime)
checkFiles := []string{f, "index.html"}
for _, checkFile := range checkFiles {
filePath := filepath.Join(rootPath, checkFile)
@@ -147,6 +142,13 @@ func checkStaticFile(rootPath string) func(ctx fiber.Ctx) error {
log.Warnf("file not found: %s", filePath)
continue
}
ext := filepath.Ext(filePath)
mime := mime.TypeByExtension(ext)
log.Infof("mime type: %s %s", ext, mime)
ctx.Set(fiber.HeaderContentType, mime)
return ctx.SendFile(file)
}
return ctx.SendStatus(fiber.StatusNotFound)

View File

@@ -27,7 +27,7 @@ require (
github.com/riverqueue/river v0.15.0
github.com/riverqueue/river/riverdriver/riverpgxv5 v0.15.0
github.com/riverqueue/river/rivertype v0.15.0
github.com/rogeecn/fabfile v1.6.0
github.com/rogeecn/fabfile v1.7.0
github.com/rogeecn/swag v1.0.1
github.com/samber/lo v1.49.1
github.com/sirupsen/logrus v1.9.3

View File

@@ -256,10 +256,10 @@ github.com/riverqueue/river/rivertype v0.15.0 h1:+TXRnvQv1ulV24uQnsuZmbb3yJdmbpi
github.com/riverqueue/river/rivertype v0.15.0/go.mod h1:4vpt5ZSdZ35mFbRAV4oXgeRdH3Mq5h1pUzQTvaGfCUA=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/rogeecn/fabfile v1.5.0 h1:I4yxvNRzsjEKMyq3opc32mmaBlfnZBjBUpjdMRR2zOM=
github.com/rogeecn/fabfile v1.5.0/go.mod h1:EPwX7TtVcIWSLJkJAqxSzYjM/aV1Q0wymcaXqnMgzas=
github.com/rogeecn/fabfile v1.6.0 h1:i0+Koa8yp3lsgEM8opcnya85cEohpGeGpm21xEekBmQ=
github.com/rogeecn/fabfile v1.6.0/go.mod h1:EPwX7TtVcIWSLJkJAqxSzYjM/aV1Q0wymcaXqnMgzas=
github.com/rogeecn/fabfile v1.7.0 h1:qtwkqaBsJjWrggbvznbd0HGyJ0ebBTOBE893JvD5Tng=
github.com/rogeecn/fabfile v1.7.0/go.mod h1:EPwX7TtVcIWSLJkJAqxSzYjM/aV1Q0wymcaXqnMgzas=
github.com/rogeecn/swag v1.0.1 h1:s1yxLgopqO1m8sqGjVmt6ocMBRubMPIh2JtIPG4xjQE=
github.com/rogeecn/swag v1.0.1/go.mod h1:flG2NXERPxlRl2VdpU2VXTO8iBnQiERyowOXSkZVMOc=
github.com/rogpeppe/clock v0.0.0-20190514195947-2896927a307a h1:3QH7VyOaaiUHNrA9Se4YQIRkDTCw1EJls9xTUCaCeRM=