47 lines
1.4 KiB
Go
Raw Normal View History

2024-04-29 23:59:09 +08:00
package static
2024-04-29 23:09:19 +08:00
import (
"github.com/labstack/echo/v4"
"net/http"
)
2024-04-30 22:11:21 +08:00
func Login(c echo.Context) error {
c.Response().Header().Set("Content-Type", "text/html; charset=utf-8")
c.Response().Header().Set("Cache-Control", "max-age=3600")
return c.Blob(http.StatusOK, "text/html; charset=utf-8", pageMap["login.html"])
}
func Chat(c echo.Context) error {
c.Response().Header().Set("Content-Type", "text/html; charset=utf-8")
c.Response().Header().Set("Cache-Control", "max-age=3600")
return c.Blob(http.StatusOK, "text/html; charset=utf-8", pageMap["ai-chat.html"])
}
2024-04-29 23:09:19 +08:00
func InitStaticGroup(g *echo.Group) {
2024-04-29 23:59:09 +08:00
2024-04-29 23:09:19 +08:00
g.GET("login.html", func(c echo.Context) error {
c.Response().Header().Set("Content-Type", "text/html; charset=utf-8")
c.Response().Header().Set("Cache-Control", "max-age=3600")
2024-04-29 23:59:09 +08:00
return c.Blob(http.StatusOK, "text/html; charset=utf-8", pageMap["login.html"])
2024-04-29 23:09:19 +08:00
})
g.GET("css/login.css", func(c echo.Context) error {
c.Response().Header().Set("Cache-Control", "max-age=3600")
2024-04-30 00:01:49 +08:00
data, _ := cssMap["login.css"]
2024-04-30 00:08:26 +08:00
return c.Blob(http.StatusOK, "text/css; charset=utf-8", data)
2024-04-29 23:09:19 +08:00
})
g.GET("img/003.jpeg", func(c echo.Context) error {
c.Response().Header().Set("Cache-Control", "max-age=3600")
2024-04-30 00:08:26 +08:00
return c.Blob(http.StatusOK, "image/jpeg", imgMap()["003.jpeg"])
2024-04-29 23:09:19 +08:00
})
g.GET("/aa", func(c echo.Context) error {
c.Response().Header().Set("Content-Type", "text/html; charset=utf-8")
return c.String(http.StatusOK, `<p>html代码</p>`)
})
}