Update to new goprogram version

This commit is contained in:
Tom Wiesing 2023-11-01 22:01:24 +01:00
parent 7bd9570bc0
commit 873fdcd5c2
No known key found for this signature in database
106 changed files with 478 additions and 825 deletions

View file

@ -12,7 +12,7 @@ import (
type Home struct {
component.Base
Dependencies struct {
dependencies struct {
ListInstances *list.ListInstances
Templating *templating.Templating
}
@ -55,7 +55,7 @@ func (home *Home) HandleRoute(ctx context.Context, route string) (http.Handler,
}
func (home *Home) serveWissKI(w http.ResponseWriter, slug string, r *http.Request) {
if _, ok := home.Dependencies.ListInstances.Names()[slug]; !ok {
if _, ok := home.dependencies.ListInstances.Names()[slug]; !ok {
// Get(nil) guaranteed to work by precondition
w.WriteHeader(http.StatusNotFound)
fmt.Fprintf(w, "WissKI %q not found\n", slug)

View file

@ -51,7 +51,7 @@ func (home *Home) publicHandler(ctx context.Context) http.Handler {
title := home.Config.Home.Title
tpl := publicTemplate.Prepare(
home.Dependencies.Templating,
home.dependencies.Templating,
// set title and menu item
templating.Title(title),
templating.Crumbs(
@ -59,7 +59,7 @@ func (home *Home) publicHandler(ctx context.Context) http.Handler {
),
)
about := home.Dependencies.Templating.GetCustomizable(aboutTemplate)
about := home.dependencies.Templating.GetCustomizable(aboutTemplate)
return tpl.HTMLHandler(func(r *http.Request) (pc publicContext, err error) {
// only act on the root path!
@ -72,7 +72,7 @@ func (home *Home) publicHandler(ctx context.Context) http.Handler {
// prepare about
pc.aboutContext.Logo = logoHTML
pc.aboutContext.Instances = home.Dependencies.ListInstances.Infos()
pc.aboutContext.Instances = home.dependencies.ListInstances.Infos()
pc.aboutContext.SelfRedirect = home.Config.Home.SelfRedirect.String()
// render the about template
@ -85,7 +85,7 @@ func (home *Home) publicHandler(ctx context.Context) http.Handler {
pc.About = template.HTML(builder.String())
// check if we should show the list of WissKIs
pc.ListEnabled = home.Dependencies.ListInstances.ShouldShowList(r)
pc.ListEnabled = home.dependencies.ListInstances.ShouldShowList(r)
// title of the list
pc.ListTitle = home.Config.Home.List.Title