File tree Expand file tree Collapse file tree 5 files changed +16
-10
lines changed
Expand file tree Collapse file tree 5 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 11package v2
22
33import (
4+ "net/http"
5+ "time"
6+
47 "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
58 "github.com/1Panel-dev/1Panel/agent/app/dto"
69 "github.com/1Panel-dev/1Panel/agent/app/dto/request"
710 "github.com/1Panel-dev/1Panel/agent/i18n"
811 "github.com/gin-gonic/gin"
9- "net/http"
10- "time"
1112)
1213
1314// @Tags App
@@ -28,7 +29,7 @@ func (b *BaseApi) SearchApp(c *gin.Context) {
2829 helper .InternalServer (c , err )
2930 return
3031 }
31- helper .SuccessWithData (c , list )
32+ helper .SuccessWithDataGzipped (c , list )
3233}
3334
3435// @Tags App
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ func (b *BaseApi) LoadAppLauncher(c *gin.Context) {
3737 helper .InternalServer (c , err )
3838 return
3939 }
40- helper .SuccessWithData (c , data )
40+ helper .SuccessWithDataGzipped (c , data )
4141}
4242
4343// @Tags Dashboard
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ func (b *BaseApi) GetFileTree(c *gin.Context) {
9090 helper .InternalServer (c , err )
9191 return
9292 }
93- helper .SuccessWithData (c , tree )
93+ helper .SuccessWithDataGzipped (c , tree )
9494}
9595
9696// @Tags File
@@ -265,7 +265,11 @@ func (b *BaseApi) GetContent(c *gin.Context) {
265265 helper .InternalServer (c , err )
266266 return
267267 }
268- helper .SuccessWithData (c , info )
268+ if info .Size > 2 * 1024 && info .Size < 5 * 1024 * 1024 {
269+ helper .SuccessWithDataGzipped (c , info )
270+ } else {
271+ helper .SuccessWithData (c , info )
272+ }
269273}
270274
271275// @Tags File
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ func (b *BaseApi) LoadMonitor(c *gin.Context) {
2828 helper .InternalServer (c , err )
2929 return
3030 }
31- helper .SuccessWithData (c , data )
31+ helper .SuccessWithDataGzipped (c , data )
3232}
3333
3434// @Tags Monitor
Original file line number Diff line number Diff line change 11package v2
22
33import (
4- "github.com/1Panel-dev/1Panel/agent/app/model"
54 "io"
65 "mime/multipart"
76 "net/http"
87 "net/url"
98 "reflect"
109 "strconv"
1110
11+ "github.com/1Panel-dev/1Panel/agent/app/model"
12+
1213 "github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
1314 "github.com/1Panel-dev/1Panel/agent/app/dto"
1415 "github.com/1Panel-dev/1Panel/agent/app/dto/request"
@@ -34,7 +35,7 @@ func (b *BaseApi) PageWebsiteSSL(c *gin.Context) {
3435 helper .InternalServer (c , err )
3536 return
3637 }
37- helper .SuccessWithData (c , dto.PageResult {
38+ helper .SuccessWithDataGzipped (c , dto.PageResult {
3839 Total : total ,
3940 Items : accounts ,
4041 })
@@ -44,7 +45,7 @@ func (b *BaseApi) PageWebsiteSSL(c *gin.Context) {
4445 helper .InternalServer (c , err )
4546 return
4647 }
47- helper .SuccessWithData (c , list )
48+ helper .SuccessWithDataGzipped (c , list )
4849 }
4950}
5051
You can’t perform that action at this time.
0 commit comments