(app *App, u *User, w http.ResponseWriter, r *http.Request)
| 657 | } |
| 658 | |
| 659 | func handleViewAdminUpdates(app *App, u *User, w http.ResponseWriter, r *http.Request) error { |
| 660 | check := r.URL.Query().Get("check") |
| 661 | |
| 662 | if check == "now" && app.cfg.App.UpdateChecks { |
| 663 | app.updates.CheckNow() |
| 664 | } |
| 665 | |
| 666 | p := struct { |
| 667 | *UserPage |
| 668 | *AdminPage |
| 669 | CurReleaseNotesURL string |
| 670 | LastChecked string |
| 671 | LastChecked8601 string |
| 672 | LatestVersion string |
| 673 | LatestReleaseURL string |
| 674 | LatestReleaseNotesURL string |
| 675 | CheckFailed bool |
| 676 | }{ |
| 677 | UserPage: NewUserPage(app, r, u, "Updates", nil), |
| 678 | AdminPage: NewAdminPage(app), |
| 679 | } |
| 680 | p.CurReleaseNotesURL = wfReleaseNotesURL(p.Version) |
| 681 | if app.cfg.App.UpdateChecks { |
| 682 | p.LastChecked = app.updates.lastCheck.Format("January 2, 2006, 3:04 PM") |
| 683 | p.LastChecked8601 = app.updates.lastCheck.Format("2006-01-02T15:04:05Z") |
| 684 | p.LatestVersion = app.updates.LatestVersion() |
| 685 | p.LatestReleaseURL = app.updates.ReleaseURL() |
| 686 | p.LatestReleaseNotesURL = app.updates.ReleaseNotesURL() |
| 687 | p.UpdateAvailable = app.updates.AreAvailable() |
| 688 | p.CheckFailed = app.updates.checkError != nil |
| 689 | } |
| 690 | |
| 691 | showUserPage(w, "app-updates", p) |
| 692 | return nil |
| 693 | } |
nothing calls this directly
no test coverage detected