MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / pluginManagementNoRoute

Method pluginManagementNoRoute

internal/api/server.go:813–849  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

811}
812
813func (s *Server) pluginManagementNoRoute(c *gin.Context) {
814 if s == nil || c == nil || c.Request == nil || c.Request.URL == nil {
815 if c != nil {
816 c.AbortWithStatus(http.StatusNotFound)
817 }
818 return
819 }
820 path := c.Request.URL.Path
821 if strings.HasPrefix(path, "/v0/resource/plugins/") {
822 s.pluginResourceNoRoute(c)
823 return
824 }
825 if path != "/v0/management" && !strings.HasPrefix(path, "/v0/management/") {
826 c.AbortWithStatus(http.StatusNotFound)
827 return
828 }
829 if s.pluginHost == nil || s.mgmt == nil {
830 c.AbortWithStatus(http.StatusNotFound)
831 return
832 }
833 if !s.managementAvailable(c) {
834 return
835 }
836 s.mgmt.Middleware()(c)
837 if c.IsAborted() {
838 return
839 }
840 if s.mgmt.ServePluginAuthURL(c) {
841 c.Abort()
842 return
843 }
844 if s.pluginHost.ServeManagementHTTP(c.Writer, c.Request) {
845 c.Abort()
846 return
847 }
848 c.AbortWithStatus(http.StatusNotFound)
849}
850
851func (s *Server) pluginResourceNoRoute(c *gin.Context) {
852 if s == nil || c == nil || c.Request == nil || c.Request.URL == nil {

Callers

nothing calls this directly

Calls 5

pluginResourceNoRouteMethod · 0.95
managementAvailableMethod · 0.95
MiddlewareMethod · 0.80
ServePluginAuthURLMethod · 0.80
ServeManagementHTTPMethod · 0.80

Tested by

no test coverage detected