fix: issues

This commit is contained in:
Rogee
2024-12-15 00:07:15 +08:00
parent 721b14372b
commit ed3d8b0e6c
3 changed files with 17 additions and 8 deletions

View File

@@ -18,6 +18,7 @@ import (
"git.ipao.vip/rogeecn/atom"
"git.ipao.vip/rogeecn/atom/container"
"git.ipao.vip/rogeecn/atom/contracts"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/fiber/v3/middleware/favicon"
"github.com/gofiber/fiber/v3/middleware/static"
log "github.com/sirupsen/logrus"
@@ -77,14 +78,22 @@ func Serve(cmd *cobra.Command, args []string) error {
engine.Use(mid.WeChatVerify)
engine.Use([]string{"/t/:tenant", "/t/:tenant/*"}, mid.WeChatAuth, http.Wechat.Render)
engine.Get("/posters/:tenant/:hash.jpg", func(c fiber.Ctx) error {
tenant := c.Params("tenant")
hash := c.Params("hash")
return c.SendFile(filepath.Join(
http.Storage.Path,
tenant,
"posters",
hash+".jpg",
))
})
http.Service.Engine.Use(favicon.New(favicon.Config{
Data: []byte{},
}))
http.Service.Engine.Use("/static", static.New(http.Storage.Path, static.Config{
Browse: http.App.IsDevMode(),
}))
http.Service.Engine.Use("/assets", static.New(filepath.Join(http.Storage.Asset, "assets"), static.Config{
Browse: http.App.IsDevMode(),
}))