Show if a new version is available in the web interface
This commit is contained in:
@@ -42,6 +42,10 @@
|
||||
<a class="nav-link {{ if eq .Path "config.html"}} active {{ end }}" href="/config.html">Config</a>
|
||||
<a class="nav-link {{ if eq .Path "uploads.html"}} active {{ end }}" href="/uploads.html">Uploads</a>
|
||||
<a class="nav-link {{ if eq .Path "logs.html"}} active {{ end }}" href="/logs.html">Logs</a>
|
||||
{{ if eq .NewVersionAvailable true }}
|
||||
<a class="nav-link" href="{{ .NewVersionInfo.HTMLURL }}">Ver {{ .NewVersionInfo.TagName }} available!</a>
|
||||
{{ end }}
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -74,12 +74,16 @@ func (ws *WebService) getStatic(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
var b struct {
|
||||
Body string
|
||||
Path string
|
||||
Version string
|
||||
Body string
|
||||
Path string
|
||||
Version string
|
||||
NewVersionAvailable bool
|
||||
NewVersionInfo version.GithubRelease
|
||||
}
|
||||
b.Path = path
|
||||
b.Version = version.CurrentVersion
|
||||
b.NewVersionAvailable = version.UpdateAvailable()
|
||||
b.NewVersionInfo = version.LatestVersionInfo
|
||||
|
||||
err = t.ExecuteTemplate(w, "layout", b)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user