提交 691c9aeb 编写于 作者: H HFO4

Feat: gzip support for static files

上级 f594d0ab
Subproject commit fdf67a42027207cfef168b439706406620e7ee06
Subproject commit a576b16440a9fc8268685a7120069443907a4de4
......@@ -9,6 +9,7 @@ require (
github.com/duo-labs/webauthn v0.0.0-20191119193225-4bf9a0f776d4
github.com/fatih/color v1.7.0
github.com/gin-contrib/cors v1.3.0
github.com/gin-contrib/gzip v0.0.2-0.20200226035851-25bef2ef21e8 // indirect
github.com/gin-contrib/sessions v0.0.1
github.com/gin-contrib/static v0.0.0-20191128031702-f81c604d8ac2
github.com/gin-gonic/gin v1.5.0
......
......@@ -8,6 +8,7 @@ import (
"github.com/HFO4/cloudreve/pkg/util"
"github.com/HFO4/cloudreve/routers/controllers"
"github.com/gin-contrib/cors"
"github.com/gin-contrib/gzip"
"github.com/gin-contrib/static"
"github.com/gin-gonic/gin"
)
......@@ -78,6 +79,7 @@ func InitMasterRouter() *gin.Engine {
/*
静态资源
*/
r.Use(gzip.Gzip(gzip.DefaultCompression, gzip.WithExcludedPaths([]string{"/api/"})))
r.Use(static.Serve("/", bootstrap.StaticFS))
r.GET("manifest.json", controllers.Manifest)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册