Show if a new version is available in the menu bar
This commit is contained in:
parent
dab54bdeaa
commit
8c8a57433e
@ -8,7 +8,7 @@ import (
|
||||
"golang.org/x/mod/semver"
|
||||
)
|
||||
|
||||
const Tag = "v0.0.17"
|
||||
const Tag = "v0.0.18"
|
||||
|
||||
var versionInfo struct {
|
||||
Local struct {
|
||||
@ -40,7 +40,14 @@ func UpgradeAvailable() (bool, string) {
|
||||
return true, versionInfo.Remote.Tag
|
||||
}
|
||||
return false, ""
|
||||
}
|
||||
|
||||
func UpgradeAvailableString() string {
|
||||
upgrade, ver := UpgradeAvailable()
|
||||
if upgrade {
|
||||
return ver
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func UpdateVersionInfo() {
|
||||
|
@ -34,10 +34,17 @@
|
||||
</div>
|
||||
<div class="top-bar-right">
|
||||
<ul class="menu">
|
||||
{{ if newVersion }}
|
||||
<li>
|
||||
<div><a href="https://github.com/tardisx/linkwallet/releases/tag/{{ newVersion }}">{{ newVersion }} available</a></div>
|
||||
</li>
|
||||
{{ end }}
|
||||
<li class="menu-text">
|
||||
{{ version }}
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://github.com/tardisx/linkwallet">
|
||||
{{ version }}
|
||||
<img src="/assets/image/GitHub-Mark-32px.png" />
|
||||
<img src="/assets/image/GitHub-Mark-32px.png" width="16px" height="16px"/>
|
||||
</a>
|
||||
</li>
|
||||
<!-- <li><input type="search" placeholder="Search"></li>
|
||||
|
@ -51,7 +51,7 @@ 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}).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"))
|
||||
|
||||
config, err := cmm.LoadConfig()
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user