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