diff --git a/rest/router.go b/rest/router.go index 53e69f3..77a37b7 100644 --- a/rest/router.go +++ b/rest/router.go @@ -22,7 +22,6 @@ func (c *Context) getRouter(assets fs.FS, indexHtml []byte) *http.ServeMux { mux.Handle("/api/authmethods", http.HandlerFunc(c.authMethods)) mux.Handle("/api/authmethods/{method}/{id}", http.HandlerFunc(c.authMethodsByID)) mux.Handle("/api/authmethods/{id}", http.HandlerFunc(c.authMethodsByID)) - mux.Handle("/api/version", http.HandlerFunc(c.version)) mux.Handle("/api/upgrade", http.HandlerFunc(c.upgrade)) mux.Handle("/", returnIndexOrNotFound(indexHtml)) diff --git a/rest/version.go b/rest/version.go index e56cbf9..498cd82 100644 --- a/rest/version.go +++ b/rest/version.go @@ -2,35 +2,14 @@ package rest import ( _ "embed" - "encoding/json" "fmt" "io" "net/http" - "strings" "time" ) -//go:generate cp -r ../../latest ./resources/version -//go:embed resources/version - -var version string - const UPGRADESERVER_URI = "127.0.0.1:8081" -func (c *Context) version(w http.ResponseWriter, r *http.Request) { - switch r.Method { - case http.MethodGet: - out, err := json.Marshal(map[string]string{"version": strings.TrimSpace(version)}) - if err != nil { - c.returnError(w, fmt.Errorf("version marshal error: %s", err), http.StatusBadRequest) - return - } - c.write(w, out) - default: - c.returnError(w, fmt.Errorf("method not supported"), http.StatusBadRequest) - } -} - func (c *Context) upgrade(w http.ResponseWriter, r *http.Request) { client := http.Client{ Timeout: 10 * time.Second,