diff --git a/internal/cmd/version.go b/internal/cmd/version.go index 5de356b..b761238 100644 --- a/internal/cmd/version.go +++ b/internal/cmd/version.go @@ -17,6 +17,6 @@ func newVersionCommand() *cobra.Command { func newVersionCommandHandler() func(cmd *cobra.Command, args []string) { return func(cmd *cobra.Command, args []string) { - cmd.Printf("Shiori version %s (build %s) at %s\n", model.Version, model.Commit, model.Date) + cmd.Printf("Shiori version %s (build %s) at %s\n", model.BuildVersion, model.BuildCommit, model.BuildDate) } } diff --git a/internal/http/routes/frontend.go b/internal/http/routes/frontend.go index c963c6c..d1ad894 100644 --- a/internal/http/routes/frontend.go +++ b/internal/http/routes/frontend.go @@ -10,6 +10,7 @@ import ( "github.com/gin-contrib/static" "github.com/gin-gonic/gin" "github.com/go-shiori/shiori/internal/config" + "github.com/go-shiori/shiori/internal/model" views "github.com/go-shiori/shiori/internal/view" "github.com/sirupsen/logrus" ) @@ -65,11 +66,13 @@ func (r *FrontendRoutes) Setup(e *gin.Engine) { group.GET("/login", func(ctx *gin.Context) { ctx.HTML(http.StatusOK, "login.html", gin.H{ "RootPath": r.cfg.Http.RootPath, + "Version": model.BuildVersion, }) }) group.GET("/", func(ctx *gin.Context) { ctx.HTML(http.StatusOK, "index.html", gin.H{ "RootPath": r.cfg.Http.RootPath, + "Version": model.BuildVersion, }) }) e.StaticFS("/assets", newAssetsFS(r.logger, views.Assets)) diff --git a/internal/http/routes/system.go b/internal/http/routes/system.go index 9a8137e..4f7f377 100644 --- a/internal/http/routes/system.go +++ b/internal/http/routes/system.go @@ -22,9 +22,9 @@ func (r *SystemRoutes) livenessHandler(c *gin.Context) { Commit string `json:"commit"` Date string `json:"date"` }{ - Version: model.Version, - Commit: model.Commit, - Date: model.Date, + Version: model.BuildVersion, + Commit: model.BuildCommit, + Date: model.BuildDate, }) } diff --git a/internal/model/main.go b/internal/model/main.go index fe82013..694292e 100644 --- a/internal/model/main.go +++ b/internal/model/main.go @@ -2,7 +2,7 @@ package model // Variables set my the main package coming from ldflags var ( - Version = "dev" - Commit = "none" - Date = "unknown" + BuildVersion = "dev" + BuildCommit = "none" + BuildDate = "unknown" ) diff --git a/internal/view/login.html b/internal/view/login.html index 21e59d9..6ac4353 100644 --- a/internal/view/login.html +++ b/internal/view/login.html @@ -15,7 +15,7 @@ - w + @@ -50,6 +50,9 @@ +
$$.Version$$
+