Skip to content

Commit

Permalink
enable content encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Sep 3, 2023
1 parent 96f0ffa commit 4cd6ebd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions pkg/api/dms.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
restfulspec "github.com/emicklei/go-restful-openapi/v2"
"github.com/emicklei/go-restful/v3"
"github.com/jinzhu/gorm"

"github.com/xbapps/xbvr/pkg/common"
"github.com/xbapps/xbvr/pkg/models"
"github.com/xbapps/xbvr/pkg/session"
Expand All @@ -36,18 +37,22 @@ func (i DMSResource) WebService() *restful.WebService {

ws.Route(ws.GET("/file/{file-id}").To(i.getFile).
Param(ws.PathParameter("file-id", "File ID").DataType("int")).
ContentEncodingEnabled(false).
Metadata(restfulspec.KeyOpenAPITags, tags))

ws.Route(ws.GET("/file/{file-id}/{var:*}").To(i.getFile).
Param(ws.PathParameter("file-id", "File ID").DataType("int")).
ContentEncodingEnabled(false).
Metadata(restfulspec.KeyOpenAPITags, tags))

ws.Route(ws.GET("/heatmap/{file-id}").To(i.getHeatmap).
Param(ws.PathParameter("file-id", "File ID").DataType("int")).
ContentEncodingEnabled(false).
Metadata(restfulspec.KeyOpenAPITags, tags))

ws.Route(ws.GET("/preview/{scene-id}").To(i.getPreview).
Param(ws.PathParameter("scene-id", "Scene ID")).
ContentEncodingEnabled(false).
Metadata(restfulspec.KeyOpenAPITags, tags))

return ws
Expand Down
7 changes: 5 additions & 2 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"github.com/koding/websocketproxy"
"github.com/peterbourgon/diskv"
"github.com/rs/cors"
"willnorris.com/go/imageproxy"

"github.com/xbapps/xbvr/pkg/api"
"github.com/xbapps/xbvr/pkg/common"
"github.com/xbapps/xbvr/pkg/config"
Expand All @@ -28,7 +30,6 @@ import (
"github.com/xbapps/xbvr/pkg/session"
"github.com/xbapps/xbvr/pkg/tasks"
"github.com/xbapps/xbvr/ui"
"willnorris.com/go/imageproxy"
)

var (
Expand Down Expand Up @@ -63,6 +64,8 @@ func StartServer(version, commit, branch, date string) {

models.InitSites()

restful.DefaultContainer.EnableContentEncoding(true)

// API endpoints
ws := new(restful.WebService)
ws.Route(ws.GET("/").To(func(req *restful.Request, resp *restful.Response) {
Expand All @@ -88,7 +91,7 @@ func StartServer(version, commit, branch, date string) {
WebServices: restful.RegisteredWebServices(),
APIPath: "/api.json",
PostBuildSwaggerObjectHandler: func(swo *spec.Swagger) {
var e = spec.VendorExtensible{}
e := spec.VendorExtensible{}
e.AddExtension("x-logo", map[string]interface{}{
"url": "/ui/icons/xbvr-512.png",
})
Expand Down

0 comments on commit 4cd6ebd

Please sign in to comment.