Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software:2222/vole.git

A free and open-source forge that lives in your Git repo.

Expand the admin status page into an operational dashboard

4506a4d3d279556435fdd414265e7499c3dada16 · Keenan Nemetz · 14d ago · parent 2e024cc9

server/web/home.go +3−23

@@ -41,8 +41,6 @@ type instanceInfo struct {
41 41 // from what the viewer can read: a private repository's activity is not counted.
42 42 type homeVitals struct {
43 43 Repos int
44 Runners int
45 ShowRunners bool
46 44 LastActivity time.Time
47 45 }
48 46
@@ -301,31 +299,13 @@ func sortCards(cards []repoCard) {
301 299 })
302 300 }
303 301
304 // homeVitals counts the connected runners the viewer is allowed to see. A
305 // session building a private repository is not counted, matching the runners
306 // page: naming it would confirm that the repository exists.
302 // homeVitals is the public front-door summary. Runner presence is deliberately
303 // absent: the status page is the instance-admin surface for that.
307 304 func (w *Web) homeVitals(r *http.Request, entries []index.Entry, events []activityEvent) homeVitals {
308 v := homeVitals{Repos: len(entries), ShowRunners: w.Runs != nil}
305 v := homeVitals{Repos: len(entries)}
309 306 if len(events) > 0 {
310 307 v.LastActivity = events[0].Time
311 308 }
312 if w.Runs == nil {
313 return v
314 }
315 sessions, err := w.Runs.Sessions(time.Now().UTC().Add(-presenceWindow))
316 if err != nil {
317 return v
318 }
319 for _, s := range sessions {
320 if s.Repo == "" {
321 v.Runners++
322 continue
323 }
324 m, err := w.Repos.Open(s.Repo)
325 if err == nil && w.canRead(r, m) {
326 v.Runners++
327 }
328 }
329 309 return v
330 310 }
331 311