diff --git a/agent/app/api/v2/app.go b/agent/app/api/v2/app.go index c462e04447cb..5e0cd1df8ace 100644 --- a/agent/app/api/v2/app.go +++ b/agent/app/api/v2/app.go @@ -1,13 +1,14 @@ package v2 import ( + "net/http" + "time" + "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper" "github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto/request" "github.com/1Panel-dev/1Panel/agent/i18n" "github.com/gin-gonic/gin" - "net/http" - "time" ) // @Tags App @@ -28,7 +29,7 @@ func (b *BaseApi) SearchApp(c *gin.Context) { helper.InternalServer(c, err) return } - helper.SuccessWithData(c, list) + helper.SuccessWithDataGzipped(c, list) } // @Tags App diff --git a/agent/app/api/v2/dashboard.go b/agent/app/api/v2/dashboard.go index 64cde1294243..9cdc21a8ae3b 100644 --- a/agent/app/api/v2/dashboard.go +++ b/agent/app/api/v2/dashboard.go @@ -37,7 +37,7 @@ func (b *BaseApi) LoadAppLauncher(c *gin.Context) { helper.InternalServer(c, err) return } - helper.SuccessWithData(c, data) + helper.SuccessWithDataGzipped(c, data) } // @Tags Dashboard diff --git a/agent/app/api/v2/file.go b/agent/app/api/v2/file.go index 44753f332713..1e4bdacec41c 100644 --- a/agent/app/api/v2/file.go +++ b/agent/app/api/v2/file.go @@ -90,7 +90,7 @@ func (b *BaseApi) GetFileTree(c *gin.Context) { helper.InternalServer(c, err) return } - helper.SuccessWithData(c, tree) + helper.SuccessWithDataGzipped(c, tree) } // @Tags File @@ -265,7 +265,11 @@ func (b *BaseApi) GetContent(c *gin.Context) { helper.InternalServer(c, err) return } - helper.SuccessWithData(c, info) + if info.Size > 2*1024 && info.Size < 5*1024*1024 { + helper.SuccessWithDataGzipped(c, info) + } else { + helper.SuccessWithData(c, info) + } } // @Tags File diff --git a/agent/app/api/v2/monitor.go b/agent/app/api/v2/monitor.go index da122dd13558..a0b03ba21af2 100644 --- a/agent/app/api/v2/monitor.go +++ b/agent/app/api/v2/monitor.go @@ -28,7 +28,7 @@ func (b *BaseApi) LoadMonitor(c *gin.Context) { helper.InternalServer(c, err) return } - helper.SuccessWithData(c, data) + helper.SuccessWithDataGzipped(c, data) } // @Tags Monitor diff --git a/agent/app/api/v2/website_ssl.go b/agent/app/api/v2/website_ssl.go index ee0a91e97e17..b00d71f2c9a3 100644 --- a/agent/app/api/v2/website_ssl.go +++ b/agent/app/api/v2/website_ssl.go @@ -1,7 +1,6 @@ package v2 import ( - "github.com/1Panel-dev/1Panel/agent/app/model" "io" "mime/multipart" "net/http" @@ -9,6 +8,8 @@ import ( "reflect" "strconv" + "github.com/1Panel-dev/1Panel/agent/app/model" + "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper" "github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/dto/request" @@ -34,7 +35,7 @@ func (b *BaseApi) PageWebsiteSSL(c *gin.Context) { helper.InternalServer(c, err) return } - helper.SuccessWithData(c, dto.PageResult{ + helper.SuccessWithDataGzipped(c, dto.PageResult{ Total: total, Items: accounts, }) @@ -44,7 +45,7 @@ func (b *BaseApi) PageWebsiteSSL(c *gin.Context) { helper.InternalServer(c, err) return } - helper.SuccessWithData(c, list) + helper.SuccessWithDataGzipped(c, list) } }