diff --git a/api/http/handler/handler.go b/api/http/handler/handler.go index 3ebe57a5b..0036af8b3 100644 --- a/api/http/handler/handler.go +++ b/api/http/handler/handler.go @@ -23,7 +23,6 @@ import ( "github.com/portainer/portainer/api/http/handler/settings" "github.com/portainer/portainer/api/http/handler/stacks" "github.com/portainer/portainer/api/http/handler/status" - "github.com/portainer/portainer/api/http/handler/support" "github.com/portainer/portainer/api/http/handler/tags" "github.com/portainer/portainer/api/http/handler/teammemberships" "github.com/portainer/portainer/api/http/handler/teams" @@ -55,7 +54,6 @@ type Handler struct { SettingsHandler *settings.Handler StackHandler *stacks.Handler StatusHandler *status.Handler - SupportHandler *support.Handler TagHandler *tags.Handler TeamMembershipHandler *teammemberships.Handler TeamHandler *teams.Handler @@ -116,8 +114,6 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { http.StripPrefix("/api", h.StackHandler).ServeHTTP(w, r) case strings.HasPrefix(r.URL.Path, "/api/status"): http.StripPrefix("/api", h.StatusHandler).ServeHTTP(w, r) - case strings.HasPrefix(r.URL.Path, "/api/support"): - http.StripPrefix("/api", h.SupportHandler).ServeHTTP(w, r) case strings.HasPrefix(r.URL.Path, "/api/tags"): http.StripPrefix("/api", h.TagHandler).ServeHTTP(w, r) case strings.HasPrefix(r.URL.Path, "/api/templates"): diff --git a/api/http/handler/support/handler.go b/api/http/handler/support/handler.go deleted file mode 100644 index 1ac8de22a..000000000 --- a/api/http/handler/support/handler.go +++ /dev/null @@ -1,26 +0,0 @@ -package support - -import ( - "net/http" - - httperror "github.com/portainer/libhttp/error" - - "github.com/gorilla/mux" - "github.com/portainer/portainer/api/http/security" -) - -// Handler is the HTTP handler used to handle support operations. -type Handler struct { - *mux.Router -} - -// NewHandler returns a new Handler -func NewHandler(bouncer *security.RequestBouncer) *Handler { - h := &Handler{ - Router: mux.NewRouter(), - } - h.Handle("/support", - bouncer.AuthenticatedAccess(httperror.LoggerHandler(h.supportList))).Methods(http.MethodGet) - - return h -} diff --git a/api/http/handler/support/support_list.go b/api/http/handler/support/support_list.go deleted file mode 100644 index a16d8dafd..000000000 --- a/api/http/handler/support/support_list.go +++ /dev/null @@ -1,39 +0,0 @@ -package support - -import ( - "encoding/json" - - httperror "github.com/portainer/libhttp/error" - portainer "github.com/portainer/portainer/api" - - "net/http" - - "github.com/portainer/portainer/api/http/client" - - "github.com/portainer/libhttp/response" -) - -type supportProduct struct { - ID int `json:"Id"` - Name string `json:"Name"` - ShortDescription string `json:"ShortDescription"` - Price string `json:"Price"` - PriceDescription string `json:"PriceDescription"` - Description string `json:"Description"` - ProductID string `json:"ProductId"` -} - -func (handler *Handler) supportList(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { - supportData, err := client.Get(portainer.SupportProductsURL, 30) - if err != nil { - return &httperror.HandlerError{http.StatusInternalServerError, "Unable to fetch support options", err} - } - - var supportProducts []supportProduct - err = json.Unmarshal(supportData, &supportProducts) - if err != nil { - return &httperror.HandlerError{http.StatusInternalServerError, "Unable to fetch support options", err} - } - - return response.JSON(w, supportProducts) -} diff --git a/api/http/server.go b/api/http/server.go index 4d5fd263a..8f83529f1 100644 --- a/api/http/server.go +++ b/api/http/server.go @@ -28,7 +28,6 @@ import ( "github.com/portainer/portainer/api/http/handler/settings" "github.com/portainer/portainer/api/http/handler/stacks" "github.com/portainer/portainer/api/http/handler/status" - "github.com/portainer/portainer/api/http/handler/support" "github.com/portainer/portainer/api/http/handler/tags" "github.com/portainer/portainer/api/http/handler/teammemberships" "github.com/portainer/portainer/api/http/handler/teams" @@ -173,8 +172,6 @@ func (server *Server) Start() error { var statusHandler = status.NewHandler(requestBouncer, server.Status) - var supportHandler = support.NewHandler(requestBouncer) - var templatesHandler = templates.NewHandler(requestBouncer) templatesHandler.DataStore = server.DataStore templatesHandler.FileService = server.FileService @@ -217,7 +214,6 @@ func (server *Server) Start() error { SettingsHandler: settingsHandler, StatusHandler: statusHandler, StackHandler: stackHandler, - SupportHandler: supportHandler, TagHandler: tagHandler, TeamHandler: teamHandler, TeamMembershipHandler: teamMembershipHandler, diff --git a/api/portainer.go b/api/portainer.go index f1887f28c..8e03fb709 100644 --- a/api/portainer.go +++ b/api/portainer.go @@ -1123,8 +1123,6 @@ const ( MessageOfTheDayURL = AssetsServerURL + "/motd.json" // VersionCheckURL represents the URL used to retrieve the latest version of Portainer VersionCheckURL = "https://api.github.com/repos/portainer/portainer/releases/latest" - // SupportProductsURL represents the URL where Portainer support products can be retrieved - SupportProductsURL = AssetsServerURL + "/support.json" // PortainerAgentHeader represents the name of the header available in any agent response PortainerAgentHeader = "Portainer-Agent" // PortainerAgentEdgeIDHeader represent the name of the header containing the Edge ID associated to an agent/agent cluster