diff --git a/admin.go b/admin.go index 89621ae..55cfb17 100644 --- a/admin.go +++ b/admin.go @@ -583,6 +583,7 @@ func handleViewAdminUpdates(app *App, u *User, w http.ResponseWriter, r *http.Re p := struct { *UserPage + CurReleaseNotesURL string LastChecked string LastChecked8601 string LatestVersion string @@ -592,6 +593,7 @@ func handleViewAdminUpdates(app *App, u *User, w http.ResponseWriter, r *http.Re }{ UserPage: NewUserPage(app, r, u, "Updates", nil), } + p.CurReleaseNotesURL = wfReleaseNotesURL(p.Version) if app.cfg.App.UpdateChecks { p.LastChecked = app.updates.lastCheck.Format("January 2, 2006, 3:04 PM") p.LastChecked8601 = app.updates.lastCheck.Format("2006-01-02T15:04:05Z") diff --git a/templates/user/admin/app-updates.tmpl b/templates/user/admin/app-updates.tmpl index c7d9913..36e7f23 100644 --- a/templates/user/admin/app-updates.tmpl +++ b/templates/user/admin/app-updates.tmpl @@ -5,11 +5,16 @@ p.intro { text-align: left; } + p.disabled { + font-style: italic; + color: #999; + }
{{template "admin-header" .}} +{{ if .UpdateChecks }} {{if not .UpdateAvailable}}

WriteFreely is up to date.

Installed version: {{.Version}} (release notes).

@@ -27,6 +32,11 @@ var d = new Date(displayEl.getAttribute("datetime")); displayEl.textContent = d.toLocaleDateString(navigator.language || "en-US", { dateStyle: 'long', timeStyle: 'short' }); +{{ else }} +

Automated update checks are disabled.

+

Installed version: {{.Version}} (release notes).

+

Learn about latest releases on the WriteFreely blog or forum.

+{{ end }} {{template "footer" .}} diff --git a/updates.go b/updates.go index eba4810..e8f0d21 100644 --- a/updates.go +++ b/updates.go @@ -70,7 +70,11 @@ func (uc updatesCache) ReleaseURL() string { // ReleaseNotesURL returns the full URL to the blog.writefreely.org release notes // for the latest version as stored in the cache. func (uc updatesCache) ReleaseNotesURL() string { - ver := strings.TrimPrefix(uc.latestVersion, "v") + return wfReleaseNotesURL(uc.latestVersion) +} + +func wfReleaseNotesURL(v string) string { + ver := strings.TrimPrefix(v, "v") ver = strings.TrimSuffix(ver, ".0") // hack until go 1.12 in build/travis seg := strings.Split(ver, ".")