diff --git a/internal/config/config.go b/internal/config/config.go
index 96b9424..af9cf42 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -56,7 +56,8 @@ type Config struct {
DisablePreParseMultipartForm bool `env:"HTTP_DISABLE_PARSE_MULTIPART_FORM,default=true"`
}
Branding struct {
- ThanksMessage string `env:"BRANDING_THANKS_MESSAGE"`
+ ThanksMessage string `env:"BRANDING_THANKS_MESSAGE"`
+ FooterExtraMessage string `env:"BRANDING_FOOTER_EXTRA"`
}
LogLevel string `env:"LOG_LEVEL,default=info"`
Notion struct {
diff --git a/internal/server/http/routes/calendar.go b/internal/server/http/routes/calendar.go
index 9ea5e3a..b455248 100644
--- a/internal/server/http/routes/calendar.go
+++ b/internal/server/http/routes/calendar.go
@@ -20,7 +20,6 @@ type CalendarRoutes struct {
router *fiber.App
notion *notionClient.NotionClient
publicHostname string
- thanksMessage string
limiterHandler fiber.Handler
cacheHandler fiber.Handler
@@ -91,7 +90,6 @@ func (r *CalendarRoutes) downloadHandler(c *fiber.Ctx) error {
}
return c.Render("download", fiber.Map{
- "thanksMessage": r.thanksMessage,
"calendarSubscriptionUrl": r.publicHostname + "/calendar.ics?" + string(c.Request().Body()),
"calendarICSUrl": r.publicHostname + "/calendar.ics?" + string(c.Request().Body()),
})
@@ -157,7 +155,6 @@ func NewCalendarRoutes(logger *zap.Logger, cfg *config.Config) *CalendarRoutes {
notion: cfg.Notion.Client,
router: fiber.New(),
publicHostname: cfg.Http.PublicHostname,
- thanksMessage: cfg.Branding.ThanksMessage,
limiterHandler: limiter.New(limiter.Config{
Max: cfg.Routes.Calendar.LimiterMaxRequest,
Expiration: cfg.Routes.Calendar.LimiterExpiration,
diff --git a/internal/server/http/server.go b/internal/server/http/server.go
index 9874ac7..37c57d6 100644
--- a/internal/server/http/server.go
+++ b/internal/server/http/server.go
@@ -32,6 +32,12 @@ func (s *HttpServer) Setup(cfg *config.Config) {
Logger: s.logger,
CacheHeader: "X-Cache",
})).
+ Use(func(c *fiber.Ctx) error {
+ c.Locals("branding_thanks_message", cfg.Branding.ThanksMessage)
+ c.Locals("branding_footer_extra", cfg.Branding.FooterExtraMessage)
+ c.Locals("calendar_cache_time", cfg.Routes.Calendar.CacheExpiration.String())
+ return c.Next()
+ }).
Use(recover.New()).
Mount(cfg.Routes.System.Path, routes.NewSystemRoutes(s.logger, cfg).Setup().Router()).
Mount(cfg.Routes.Static.Path, routes.NewStaticRoutes(s.logger, cfg).Setup().Router()).
diff --git a/internal/server/http/views/base.django b/internal/server/http/views/base.django
index 5c00249..bbb058a 100644
--- a/internal/server/http/views/base.django
+++ b/internal/server/http/views/base.django
@@ -21,6 +21,7 @@
Open source |
Service Status |
Contact
+ {% if branding_footer_extra %}| {{ branding_footer_extra }}{% endif %}