this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

minor improvements to speed up page load

and trims timeline to 50 events now

Akshay 06f3bf5c f820912a

+16 -1
+5
appview/db/timeline.go
··· 40 40 }) 41 41 } 42 42 43 + // Limit the slice to 100 events 44 + if len(events) > 50 { 45 + events = events[:50] 46 + } 47 + 43 48 sort.Slice(events, func(i, j int) bool { 44 49 return events[i].EventAt.After(events[j].EventAt) 45 50 })
+11 -1
appview/pages/pages.go
··· 415 415 if err != nil { 416 416 log.Fatalf("no static dir found? that's crazy: %v", err) 417 417 } 418 - return http.StripPrefix("/static/", http.FileServer(http.FS(sub))) 418 + // Custom handler to apply Cache-Control headers for font files 419 + return Cache(http.StripPrefix("/static/", http.FileServer(http.FS(sub)))) 420 + } 421 + 422 + func Cache(h http.Handler) http.Handler { 423 + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 424 + if strings.HasPrefix(r.URL.Path, "/static/fonts") { 425 + w.Header().Set("Cache-Control", "public, max-age=31536000, immutable") 426 + } 427 + h.ServeHTTP(w, r) 428 + }) 419 429 } 420 430 421 431 func (p *Pages) Error500(w io.Writer) error {