2026-06-07 16:12:43 +01:00
|
|
|
package server
|
|
|
|
|
|
|
|
|
|
import "net/http"
|
|
|
|
|
|
2026-08-21 04:25:02 -04:00
|
|
|
// BuildInfo identifies the running proxy binary.
|
|
|
|
|
type BuildInfo struct {
|
|
|
|
|
Version string
|
|
|
|
|
Commit string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Layout carries shared fields consumed by the base template. It is embedded
|
|
|
|
|
// in every page data struct so templates can access canonical URL and build
|
|
|
|
|
// information alongside the page's own fields.
|
2026-06-07 16:12:43 +01:00
|
|
|
type Layout struct {
|
2026-08-21 04:25:02 -04:00
|
|
|
BuildInfo BuildInfo
|
2026-06-07 16:12:43 +01:00
|
|
|
UIBaseURL string
|
|
|
|
|
CanonicalPath string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *Server) layoutFor(r *http.Request) Layout {
|
|
|
|
|
return Layout{
|
2026-08-21 04:25:02 -04:00
|
|
|
BuildInfo: s.buildInfo,
|
2026-06-07 16:12:43 +01:00
|
|
|
UIBaseURL: s.cfg.UIBaseURL,
|
|
|
|
|
CanonicalPath: r.URL.Path,
|
|
|
|
|
}
|
|
|
|
|
}
|