Improve notification for a new version, show release notes
This commit is contained in:
17
web/web.go
17
web/web.go
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/tardisx/linkwallet/entity"
|
||||
"github.com/tardisx/linkwallet/version"
|
||||
|
||||
"github.com/gomarkdown/markdown"
|
||||
"github.com/hako/durafmt"
|
||||
|
||||
"github.com/gin-contrib/gzip"
|
||||
@@ -75,7 +76,14 @@ func Create(bmm *db.BookmarkManager, cmm *db.ConfigManager) *Server {
|
||||
}
|
||||
|
||||
// templ := template.Must(template.New("").Funcs(template.FuncMap{"dict": dictHelper}).ParseFS(templateFiles, "templates/*.html"))
|
||||
templ := template.Must(template.New("").Funcs(template.FuncMap{"nicetime": niceTime, "niceURL": niceURL, "join": strings.Join, "version": version.Is, "newVersion": version.UpgradeAvailableString}).ParseFS(templateFiles, "templates/*.html"))
|
||||
templ := template.Must(template.New("").Funcs(
|
||||
template.FuncMap{
|
||||
"nicetime": niceTime,
|
||||
"niceURL": niceURL,
|
||||
"join": strings.Join,
|
||||
"version": func() *version.Info { return &version.VersionInfo },
|
||||
"markdown": func(s string) template.HTML { return template.HTML(string(markdown.ToHTML([]byte(s), nil, nil))) },
|
||||
}).ParseFS(templateFiles, "templates/*.html"))
|
||||
|
||||
config, err := cmm.LoadConfig()
|
||||
if err != nil {
|
||||
@@ -386,6 +394,13 @@ func Create(bmm *db.BookmarkManager, cmm *db.ConfigManager) *Server {
|
||||
)
|
||||
})
|
||||
|
||||
r.GET("/releaseinfo", func(c *gin.Context) {
|
||||
meta := gin.H{"page": "releaseinfo", "config": config}
|
||||
c.HTML(http.StatusOK,
|
||||
"_layout.html", meta,
|
||||
)
|
||||
})
|
||||
|
||||
return server
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user