Watch
1
0
Fork
You've already forked pkg-proxy
1
mirror of https://github.com/git-pkgs/proxy.git synced 2026-08-23 20:34:56 -04:00
pkg-proxy/internal/server/layout.go

26 lines
607 B
Go
Raw Permalink Normal View History

package server
import "net/http"
// 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.
type Layout struct {
BuildInfo BuildInfo
UIBaseURL string
CanonicalPath string
}
func (s *Server) layoutFor(r *http.Request) Layout {
return Layout{
BuildInfo: s.buildInfo,
UIBaseURL: s.cfg.UIBaseURL,
CanonicalPath: r.URL.Path,
}
}