|
|
@@ -5,8 +5,11 @@ package api // import "miniflux.app/v2/internal/api"
|
|
|
|
|
|
import (
|
|
|
"net/http"
|
|
|
+ "runtime"
|
|
|
|
|
|
+ "miniflux.app/v2/internal/http/response/json"
|
|
|
"miniflux.app/v2/internal/storage"
|
|
|
+ "miniflux.app/v2/internal/version"
|
|
|
"miniflux.app/v2/internal/worker"
|
|
|
|
|
|
"github.com/gorilla/mux"
|
|
|
@@ -69,4 +72,17 @@ func Serve(router *mux.Router, store *storage.Storage, pool *worker.Pool) {
|
|
|
sr.HandleFunc("/entries/{entryID}/fetch-content", handler.fetchContent).Methods(http.MethodGet)
|
|
|
sr.HandleFunc("/flush-history", handler.flushHistory).Methods(http.MethodPut, http.MethodDelete)
|
|
|
sr.HandleFunc("/icons/{iconID}", handler.getIconByIconID).Methods(http.MethodGet)
|
|
|
+ sr.HandleFunc("/version", handler.versionHandler).Methods(http.MethodGet)
|
|
|
+}
|
|
|
+
|
|
|
+func (h *handler) versionHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
+ json.OK(w, r, &versionResponse{
|
|
|
+ Version: version.Version,
|
|
|
+ Commit: version.Commit,
|
|
|
+ BuildDate: version.BuildDate,
|
|
|
+ GoVersion: runtime.Version(),
|
|
|
+ Compiler: runtime.Compiler,
|
|
|
+ Arch: runtime.GOARCH,
|
|
|
+ OS: runtime.GOOS,
|
|
|
+ })
|
|
|
}
|