A clean, Markdown-based publishing platform made for writers. Write together, and build a community. https://writefreely.org
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

642 linhas
18 KiB

  1. /*
  2. * Copyright © 2018-2021 A Bunch Tell LLC.
  3. *
  4. * This file is part of WriteFreely.
  5. *
  6. * WriteFreely is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License, included
  8. * in the LICENSE file in this source code package.
  9. */
  10. package writefreely
  11. import (
  12. "database/sql"
  13. "fmt"
  14. "net/http"
  15. "runtime"
  16. "strconv"
  17. "strings"
  18. "time"
  19. "github.com/gorilla/mux"
  20. "github.com/writeas/impart"
  21. "github.com/writeas/web-core/auth"
  22. "github.com/writeas/web-core/log"
  23. "github.com/writeas/web-core/passgen"
  24. "github.com/writefreely/writefreely/appstats"
  25. "github.com/writefreely/writefreely/config"
  26. )
  27. var (
  28. appStartTime = time.Now()
  29. sysStatus systemStatus
  30. )
  31. const adminUsersPerPage = 30
  32. type systemStatus struct {
  33. Uptime string
  34. NumGoroutine int
  35. // General statistics.
  36. MemAllocated string // bytes allocated and still in use
  37. MemTotal string // bytes allocated (even if freed)
  38. MemSys string // bytes obtained from system (sum of XxxSys below)
  39. Lookups uint64 // number of pointer lookups
  40. MemMallocs uint64 // number of mallocs
  41. MemFrees uint64 // number of frees
  42. // Main allocation heap statistics.
  43. HeapAlloc string // bytes allocated and still in use
  44. HeapSys string // bytes obtained from system
  45. HeapIdle string // bytes in idle spans
  46. HeapInuse string // bytes in non-idle span
  47. HeapReleased string // bytes released to the OS
  48. HeapObjects uint64 // total number of allocated objects
  49. // Low-level fixed-size structure allocator statistics.
  50. // Inuse is bytes used now.
  51. // Sys is bytes obtained from system.
  52. StackInuse string // bootstrap stacks
  53. StackSys string
  54. MSpanInuse string // mspan structures
  55. MSpanSys string
  56. MCacheInuse string // mcache structures
  57. MCacheSys string
  58. BuckHashSys string // profiling bucket hash table
  59. GCSys string // GC metadata
  60. OtherSys string // other system allocations
  61. // Garbage collector statistics.
  62. NextGC string // next run in HeapAlloc time (bytes)
  63. LastGC string // last run in absolute time (ns)
  64. PauseTotalNs string
  65. PauseNs string // circular buffer of recent GC pause times, most recent at [(NumGC+255)%256]
  66. NumGC uint32
  67. }
  68. type inspectedCollection struct {
  69. CollectionObj
  70. Followers int
  71. LastPost string
  72. }
  73. type instanceContent struct {
  74. ID string
  75. Type string
  76. Title sql.NullString
  77. Content string
  78. Updated time.Time
  79. }
  80. type AdminPage struct {
  81. UpdateAvailable bool
  82. }
  83. func NewAdminPage(app *App) *AdminPage {
  84. ap := &AdminPage{}
  85. if app.updates != nil {
  86. ap.UpdateAvailable = app.updates.AreAvailableNoCheck()
  87. }
  88. return ap
  89. }
  90. func (c instanceContent) UpdatedFriendly() string {
  91. /*
  92. // TODO: accept a locale in this method and use that for the format
  93. var loc monday.Locale = monday.LocaleEnUS
  94. return monday.Format(u.Created, monday.DateTimeFormatsByLocale[loc], loc)
  95. */
  96. return c.Updated.Format("January 2, 2006, 3:04 PM")
  97. }
  98. func handleViewAdminDash(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
  99. p := struct {
  100. *UserPage
  101. *AdminPage
  102. Message string
  103. UsersCount, CollectionsCount, PostsCount int64
  104. }{
  105. UserPage: NewUserPage(app, r, u, "Admin", nil),
  106. AdminPage: NewAdminPage(app),
  107. Message: r.FormValue("m"),
  108. }
  109. // Get user stats
  110. p.UsersCount = app.db.GetAllUsersCount()
  111. var err error
  112. p.CollectionsCount, err = app.db.GetTotalCollections()
  113. if err != nil {
  114. return err
  115. }
  116. p.PostsCount, err = app.db.GetTotalPosts()
  117. if err != nil {
  118. return err
  119. }
  120. showUserPage(w, "admin", p)
  121. return nil
  122. }
  123. func handleViewAdminMonitor(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
  124. updateAppStats()
  125. p := struct {
  126. *UserPage
  127. *AdminPage
  128. SysStatus systemStatus
  129. Config config.AppCfg
  130. Message, ConfigMessage string
  131. }{
  132. UserPage: NewUserPage(app, r, u, "Admin", nil),
  133. AdminPage: NewAdminPage(app),
  134. SysStatus: sysStatus,
  135. Config: app.cfg.App,
  136. Message: r.FormValue("m"),
  137. ConfigMessage: r.FormValue("cm"),
  138. }
  139. showUserPage(w, "monitor", p)
  140. return nil
  141. }
  142. func handleViewAdminSettings(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
  143. p := struct {
  144. *UserPage
  145. *AdminPage
  146. Config config.AppCfg
  147. Message, ConfigMessage string
  148. }{
  149. UserPage: NewUserPage(app, r, u, "Admin", nil),
  150. AdminPage: NewAdminPage(app),
  151. Config: app.cfg.App,
  152. Message: r.FormValue("m"),
  153. ConfigMessage: r.FormValue("cm"),
  154. }
  155. showUserPage(w, "app-settings", p)
  156. return nil
  157. }
  158. func handleViewAdminUsers(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
  159. p := struct {
  160. *UserPage
  161. *AdminPage
  162. Config config.AppCfg
  163. Message string
  164. Users *[]User
  165. CurPage int
  166. TotalUsers int64
  167. TotalPages []int
  168. }{
  169. UserPage: NewUserPage(app, r, u, "Users", nil),
  170. AdminPage: NewAdminPage(app),
  171. Config: app.cfg.App,
  172. Message: r.FormValue("m"),
  173. }
  174. p.TotalUsers = app.db.GetAllUsersCount()
  175. ttlPages := p.TotalUsers / adminUsersPerPage
  176. p.TotalPages = []int{}
  177. for i := 1; i <= int(ttlPages); i++ {
  178. p.TotalPages = append(p.TotalPages, i)
  179. }
  180. var err error
  181. p.CurPage, err = strconv.Atoi(r.FormValue("p"))
  182. if err != nil || p.CurPage < 1 {
  183. p.CurPage = 1
  184. } else if p.CurPage > int(ttlPages) {
  185. p.CurPage = int(ttlPages)
  186. }
  187. p.Users, err = app.db.GetAllUsers(uint(p.CurPage))
  188. if err != nil {
  189. return impart.HTTPError{http.StatusInternalServerError, fmt.Sprintf("Could not get users: %v", err)}
  190. }
  191. showUserPage(w, "users", p)
  192. return nil
  193. }
  194. func handleViewAdminUser(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
  195. vars := mux.Vars(r)
  196. username := vars["username"]
  197. if username == "" {
  198. return impart.HTTPError{http.StatusFound, "/admin/users"}
  199. }
  200. p := struct {
  201. *UserPage
  202. *AdminPage
  203. Config config.AppCfg
  204. Message string
  205. User *User
  206. Colls []inspectedCollection
  207. LastPost string
  208. NewPassword string
  209. TotalPosts int64
  210. ClearEmail string
  211. }{
  212. AdminPage: NewAdminPage(app),
  213. Config: app.cfg.App,
  214. Message: r.FormValue("m"),
  215. Colls: []inspectedCollection{},
  216. }
  217. var err error
  218. p.User, err = app.db.GetUserForAuth(username)
  219. if err != nil {
  220. if err == ErrUserNotFound {
  221. return err
  222. }
  223. log.Error("Could not get user: %v", err)
  224. return impart.HTTPError{http.StatusInternalServerError, err.Error()}
  225. }
  226. flashes, _ := getSessionFlashes(app, w, r, nil)
  227. for _, flash := range flashes {
  228. if strings.HasPrefix(flash, "SUCCESS: ") {
  229. p.NewPassword = strings.TrimPrefix(flash, "SUCCESS: ")
  230. p.ClearEmail = p.User.EmailClear(app.keys)
  231. }
  232. }
  233. p.UserPage = NewUserPage(app, r, u, p.User.Username, nil)
  234. p.TotalPosts = app.db.GetUserPostsCount(p.User.ID)
  235. lp, err := app.db.GetUserLastPostTime(p.User.ID)
  236. if err != nil {
  237. return impart.HTTPError{http.StatusInternalServerError, fmt.Sprintf("Could not get user's last post time: %v", err)}
  238. }
  239. if lp != nil {
  240. p.LastPost = lp.Format("January 2, 2006, 3:04 PM")
  241. }
  242. colls, err := app.db.GetCollections(p.User, app.cfg.App.Host)
  243. if err != nil {
  244. return impart.HTTPError{http.StatusInternalServerError, fmt.Sprintf("Could not get user's collections: %v", err)}
  245. }
  246. for _, c := range *colls {
  247. ic := inspectedCollection{
  248. CollectionObj: CollectionObj{Collection: c},
  249. }
  250. if app.cfg.App.Federation {
  251. folls, err := app.db.GetAPFollowers(&c)
  252. if err == nil {
  253. // TODO: handle error here (at least log it)
  254. ic.Followers = len(*folls)
  255. }
  256. }
  257. app.db.GetPostsCount(&ic.CollectionObj, true)
  258. lp, err := app.db.GetCollectionLastPostTime(c.ID)
  259. if err != nil {
  260. log.Error("Didn't get last post time for collection %d: %v", c.ID, err)
  261. }
  262. if lp != nil {
  263. ic.LastPost = lp.Format("January 2, 2006, 3:04 PM")
  264. }
  265. p.Colls = append(p.Colls, ic)
  266. }
  267. showUserPage(w, "view-user", p)
  268. return nil
  269. }
  270. func handleAdminToggleUserStatus(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
  271. vars := mux.Vars(r)
  272. username := vars["username"]
  273. if username == "" {
  274. return impart.HTTPError{http.StatusFound, "/admin/users"}
  275. }
  276. user, err := app.db.GetUserForAuth(username)
  277. if err != nil {
  278. log.Error("failed to get user: %v", err)
  279. return impart.HTTPError{http.StatusInternalServerError, fmt.Sprintf("Could not get user from username: %v", err)}
  280. }
  281. if user.IsSilenced() {
  282. err = app.db.SetUserStatus(user.ID, UserActive)
  283. } else {
  284. err = app.db.SetUserStatus(user.ID, UserSilenced)
  285. // reset the cache to removed silence user posts
  286. updateTimelineCache(app.timeline, true)
  287. }
  288. if err != nil {
  289. log.Error("toggle user silenced: %v", err)
  290. return impart.HTTPError{http.StatusInternalServerError, fmt.Sprintf("Could not toggle user status: %v", err)}
  291. }
  292. return impart.HTTPError{http.StatusFound, fmt.Sprintf("/admin/user/%s#status", username)}
  293. }
  294. func handleAdminResetUserPass(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
  295. vars := mux.Vars(r)
  296. username := vars["username"]
  297. if username == "" {
  298. return impart.HTTPError{http.StatusFound, "/admin/users"}
  299. }
  300. // Generate new random password since none supplied
  301. pass := passgen.NewWordish()
  302. hashedPass, err := auth.HashPass([]byte(pass))
  303. if err != nil {
  304. return impart.HTTPError{http.StatusInternalServerError, fmt.Sprintf("Could not create password hash: %v", err)}
  305. }
  306. userIDVal := r.FormValue("user")
  307. log.Info("ADMIN: Changing user %s password", userIDVal)
  308. id, err := strconv.Atoi(userIDVal)
  309. if err != nil {
  310. return impart.HTTPError{http.StatusBadRequest, fmt.Sprintf("Invalid user ID: %v", err)}
  311. }
  312. err = app.db.ChangePassphrase(int64(id), true, "", hashedPass)
  313. if err != nil {
  314. return impart.HTTPError{http.StatusInternalServerError, fmt.Sprintf("Could not update passphrase: %v", err)}
  315. }
  316. log.Info("ADMIN: Successfully changed.")
  317. addSessionFlash(app, w, r, fmt.Sprintf("SUCCESS: %s", pass), nil)
  318. return impart.HTTPError{http.StatusFound, fmt.Sprintf("/admin/user/%s", username)}
  319. }
  320. func handleViewAdminPages(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
  321. p := struct {
  322. *UserPage
  323. *AdminPage
  324. Config config.AppCfg
  325. Message string
  326. Pages []*instanceContent
  327. }{
  328. UserPage: NewUserPage(app, r, u, "Pages", nil),
  329. AdminPage: NewAdminPage(app),
  330. Config: app.cfg.App,
  331. Message: r.FormValue("m"),
  332. }
  333. var err error
  334. p.Pages, err = app.db.GetInstancePages()
  335. if err != nil {
  336. return impart.HTTPError{http.StatusInternalServerError, fmt.Sprintf("Could not get pages: %v", err)}
  337. }
  338. // Add in default pages
  339. var hasAbout, hasPrivacy bool
  340. for i, c := range p.Pages {
  341. if hasAbout && hasPrivacy {
  342. break
  343. }
  344. if c.ID == "about" {
  345. hasAbout = true
  346. if !c.Title.Valid {
  347. p.Pages[i].Title = defaultAboutTitle(app.cfg)
  348. }
  349. } else if c.ID == "privacy" {
  350. hasPrivacy = true
  351. if !c.Title.Valid {
  352. p.Pages[i].Title = defaultPrivacyTitle()
  353. }
  354. }
  355. }
  356. if !hasAbout {
  357. p.Pages = append(p.Pages, &instanceContent{
  358. ID: "about",
  359. Title: defaultAboutTitle(app.cfg),
  360. Content: defaultAboutPage(app.cfg),
  361. Updated: defaultPageUpdatedTime,
  362. })
  363. }
  364. if !hasPrivacy {
  365. p.Pages = append(p.Pages, &instanceContent{
  366. ID: "privacy",
  367. Title: defaultPrivacyTitle(),
  368. Content: defaultPrivacyPolicy(app.cfg),
  369. Updated: defaultPageUpdatedTime,
  370. })
  371. }
  372. showUserPage(w, "pages", p)
  373. return nil
  374. }
  375. func handleViewAdminPage(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
  376. vars := mux.Vars(r)
  377. slug := vars["slug"]
  378. if slug == "" {
  379. return impart.HTTPError{http.StatusFound, "/admin/pages"}
  380. }
  381. p := struct {
  382. *UserPage
  383. *AdminPage
  384. Config config.AppCfg
  385. Message string
  386. Banner *instanceContent
  387. Content *instanceContent
  388. }{
  389. AdminPage: NewAdminPage(app),
  390. Config: app.cfg.App,
  391. Message: r.FormValue("m"),
  392. }
  393. var err error
  394. // Get pre-defined pages, or select slug
  395. if slug == "about" {
  396. p.Content, err = getAboutPage(app)
  397. } else if slug == "privacy" {
  398. p.Content, err = getPrivacyPage(app)
  399. } else if slug == "landing" {
  400. p.Banner, err = getLandingBanner(app)
  401. if err != nil {
  402. return impart.HTTPError{http.StatusInternalServerError, fmt.Sprintf("Could not get banner: %v", err)}
  403. }
  404. p.Content, err = getLandingBody(app)
  405. p.Content.ID = "landing"
  406. } else if slug == "reader" {
  407. p.Content, err = getReaderSection(app)
  408. } else {
  409. p.Content, err = app.db.GetDynamicContent(slug)
  410. }
  411. if err != nil {
  412. return impart.HTTPError{http.StatusInternalServerError, fmt.Sprintf("Could not get page: %v", err)}
  413. }
  414. title := "New page"
  415. if p.Content != nil {
  416. title = "Edit " + p.Content.ID
  417. } else {
  418. p.Content = &instanceContent{}
  419. }
  420. p.UserPage = NewUserPage(app, r, u, title, nil)
  421. showUserPage(w, "view-page", p)
  422. return nil
  423. }
  424. func handleAdminUpdateSite(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
  425. vars := mux.Vars(r)
  426. id := vars["page"]
  427. // Validate
  428. if id != "about" && id != "privacy" && id != "landing" && id != "reader" {
  429. return impart.HTTPError{http.StatusNotFound, "No such page."}
  430. }
  431. var err error
  432. m := ""
  433. if id == "landing" {
  434. // Handle special landing page
  435. err = app.db.UpdateDynamicContent("landing-banner", "", r.FormValue("banner"), "section")
  436. if err != nil {
  437. m = "?m=" + err.Error()
  438. return impart.HTTPError{http.StatusFound, "/admin/page/" + id + m}
  439. }
  440. err = app.db.UpdateDynamicContent("landing-body", "", r.FormValue("content"), "section")
  441. } else if id == "reader" {
  442. // Update sections with titles
  443. err = app.db.UpdateDynamicContent(id, r.FormValue("title"), r.FormValue("content"), "section")
  444. } else {
  445. // Update page
  446. err = app.db.UpdateDynamicContent(id, r.FormValue("title"), r.FormValue("content"), "page")
  447. }
  448. if err != nil {
  449. m = "?m=" + err.Error()
  450. }
  451. return impart.HTTPError{http.StatusFound, "/admin/page/" + id + m}
  452. }
  453. func handleAdminUpdateConfig(apper Apper, u *User, w http.ResponseWriter, r *http.Request) error {
  454. apper.App().cfg.App.SiteName = r.FormValue("site_name")
  455. apper.App().cfg.App.SiteDesc = r.FormValue("site_desc")
  456. apper.App().cfg.App.Landing = r.FormValue("landing")
  457. apper.App().cfg.App.OpenRegistration = r.FormValue("open_registration") == "on"
  458. mul, err := strconv.Atoi(r.FormValue("min_username_len"))
  459. if err == nil {
  460. apper.App().cfg.App.MinUsernameLen = mul
  461. }
  462. mb, err := strconv.Atoi(r.FormValue("max_blogs"))
  463. if err == nil {
  464. apper.App().cfg.App.MaxBlogs = mb
  465. }
  466. apper.App().cfg.App.Federation = r.FormValue("federation") == "on"
  467. apper.App().cfg.App.PublicStats = r.FormValue("public_stats") == "on"
  468. apper.App().cfg.App.Monetization = r.FormValue("monetization") == "on"
  469. apper.App().cfg.App.Private = r.FormValue("private") == "on"
  470. apper.App().cfg.App.LocalTimeline = r.FormValue("local_timeline") == "on"
  471. if apper.App().cfg.App.LocalTimeline && apper.App().timeline == nil {
  472. log.Info("Initializing local timeline...")
  473. initLocalTimeline(apper.App())
  474. }
  475. apper.App().cfg.App.UserInvites = r.FormValue("user_invites")
  476. if apper.App().cfg.App.UserInvites == "none" {
  477. apper.App().cfg.App.UserInvites = ""
  478. }
  479. apper.App().cfg.App.DefaultVisibility = r.FormValue("default_visibility")
  480. m := "?cm=Configuration+saved."
  481. err = apper.SaveConfig(apper.App().cfg)
  482. if err != nil {
  483. m = "?cm=" + err.Error()
  484. }
  485. return impart.HTTPError{http.StatusFound, "/admin/settings" + m + "#config"}
  486. }
  487. func updateAppStats() {
  488. sysStatus.Uptime = appstats.TimeSincePro(appStartTime)
  489. m := new(runtime.MemStats)
  490. runtime.ReadMemStats(m)
  491. sysStatus.NumGoroutine = runtime.NumGoroutine()
  492. sysStatus.MemAllocated = appstats.FileSize(int64(m.Alloc))
  493. sysStatus.MemTotal = appstats.FileSize(int64(m.TotalAlloc))
  494. sysStatus.MemSys = appstats.FileSize(int64(m.Sys))
  495. sysStatus.Lookups = m.Lookups
  496. sysStatus.MemMallocs = m.Mallocs
  497. sysStatus.MemFrees = m.Frees
  498. sysStatus.HeapAlloc = appstats.FileSize(int64(m.HeapAlloc))
  499. sysStatus.HeapSys = appstats.FileSize(int64(m.HeapSys))
  500. sysStatus.HeapIdle = appstats.FileSize(int64(m.HeapIdle))
  501. sysStatus.HeapInuse = appstats.FileSize(int64(m.HeapInuse))
  502. sysStatus.HeapReleased = appstats.FileSize(int64(m.HeapReleased))
  503. sysStatus.HeapObjects = m.HeapObjects
  504. sysStatus.StackInuse = appstats.FileSize(int64(m.StackInuse))
  505. sysStatus.StackSys = appstats.FileSize(int64(m.StackSys))
  506. sysStatus.MSpanInuse = appstats.FileSize(int64(m.MSpanInuse))
  507. sysStatus.MSpanSys = appstats.FileSize(int64(m.MSpanSys))
  508. sysStatus.MCacheInuse = appstats.FileSize(int64(m.MCacheInuse))
  509. sysStatus.MCacheSys = appstats.FileSize(int64(m.MCacheSys))
  510. sysStatus.BuckHashSys = appstats.FileSize(int64(m.BuckHashSys))
  511. sysStatus.GCSys = appstats.FileSize(int64(m.GCSys))
  512. sysStatus.OtherSys = appstats.FileSize(int64(m.OtherSys))
  513. sysStatus.NextGC = appstats.FileSize(int64(m.NextGC))
  514. sysStatus.LastGC = fmt.Sprintf("%.1fs", float64(time.Now().UnixNano()-int64(m.LastGC))/1000/1000/1000)
  515. sysStatus.PauseTotalNs = fmt.Sprintf("%.1fs", float64(m.PauseTotalNs)/1000/1000/1000)
  516. sysStatus.PauseNs = fmt.Sprintf("%.3fs", float64(m.PauseNs[(m.NumGC+255)%256])/1000/1000/1000)
  517. sysStatus.NumGC = m.NumGC
  518. }
  519. func adminResetPassword(app *App, u *User, newPass string) error {
  520. hashedPass, err := auth.HashPass([]byte(newPass))
  521. if err != nil {
  522. return impart.HTTPError{http.StatusInternalServerError, fmt.Sprintf("Could not create password hash: %v", err)}
  523. }
  524. err = app.db.ChangePassphrase(u.ID, true, "", hashedPass)
  525. if err != nil {
  526. return impart.HTTPError{http.StatusInternalServerError, fmt.Sprintf("Could not update passphrase: %v", err)}
  527. }
  528. return nil
  529. }
  530. func handleViewAdminUpdates(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
  531. check := r.URL.Query().Get("check")
  532. if check == "now" && app.cfg.App.UpdateChecks {
  533. app.updates.CheckNow()
  534. }
  535. p := struct {
  536. *UserPage
  537. *AdminPage
  538. CurReleaseNotesURL string
  539. LastChecked string
  540. LastChecked8601 string
  541. LatestVersion string
  542. LatestReleaseURL string
  543. LatestReleaseNotesURL string
  544. CheckFailed bool
  545. }{
  546. UserPage: NewUserPage(app, r, u, "Updates", nil),
  547. AdminPage: NewAdminPage(app),
  548. }
  549. p.CurReleaseNotesURL = wfReleaseNotesURL(p.Version)
  550. if app.cfg.App.UpdateChecks {
  551. p.LastChecked = app.updates.lastCheck.Format("January 2, 2006, 3:04 PM")
  552. p.LastChecked8601 = app.updates.lastCheck.Format("2006-01-02T15:04:05Z")
  553. p.LatestVersion = app.updates.LatestVersion()
  554. p.LatestReleaseURL = app.updates.ReleaseURL()
  555. p.LatestReleaseNotesURL = app.updates.ReleaseNotesURL()
  556. p.UpdateAvailable = app.updates.AreAvailable()
  557. p.CheckFailed = app.updates.checkError != nil
  558. }
  559. showUserPage(w, "app-updates", p)
  560. return nil
  561. }