Require access to Still via method

This commit adds a safeguard to accessing the still from a specific
component by requiring access via the component.GetStill method.
This commit is contained in:
Tom Wiesing 2024-04-08 22:39:32 +02:00
parent 81fa84c244
commit 8235ea9105
No known key found for this signature in database
63 changed files with 288 additions and 197 deletions

View file

@ -30,7 +30,7 @@ func (home *Home) Routes() component.Routes {
MatchAllDomains: true,
CSRF: false,
MenuTitle: home.Config.Home.Title,
MenuTitle: component.GetStill(home).Config.Home.Title,
MenuSticky: true,
MenuPriority: component.MenuHome,
}
@ -45,7 +45,7 @@ func (home *Home) HandleRoute(ctx context.Context, route string) (http.Handler,
dflt.Fallback = home.publicHandler(ctx)
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
slug, ok := home.Config.HTTP.NormSlugFromHost(r.Host)
slug, ok := component.GetStill(home).Config.HTTP.NormSlugFromHost(r.Host)
switch {
case !ok:
http.NotFound(w, r)