33 lines
594 B
Go
33 lines
594 B
Go
package router
|
|
|
|
import (
|
|
"io"
|
|
"net/http"
|
|
|
|
"go.jolheiser.com/gistea/router/session"
|
|
"go.jolheiser.com/gistea/static"
|
|
)
|
|
|
|
type App struct {
|
|
Domain string
|
|
SessionSecret string
|
|
|
|
GiteaURL string
|
|
GiteaClientKey string
|
|
GiteaClientSecret string
|
|
|
|
store *session.Store
|
|
}
|
|
|
|
func (a *App) Tmpl(w io.Writer, r *http.Request, page static.Page, data map[string]any) error {
|
|
info, _ := a.store.Info(r)
|
|
ctx := static.Context{
|
|
"Domain": a.Domain,
|
|
"GiteaURL": a.GiteaURL,
|
|
"Page": page,
|
|
"Session": info,
|
|
"Data": data,
|
|
}
|
|
return static.Tmpl(w, static.Base, ctx)
|
|
}
|