feat(web): show ICS subscription events in detail view

This commit is contained in:
2026-09-02 20:02:48 +02:00
parent e18c83b618
commit f34041d889
11 changed files with 908 additions and 80 deletions
+12 -6
View File
@@ -41,10 +41,16 @@ type Backend struct {
icsCache *icssub.Cache
}
// NewBackend creates a CalDAV backend. dbase may be nil, in which case
// calendar sharing is disabled (only a user's own calendars are visible).
func NewBackend(cfg *config.Config, st *store.Store, dbase *db.DB, logger *slog.Logger) *Backend {
return &Backend{cfg: cfg, store: st, dbase: dbase, logger: logger, icsCache: icssub.NewCache(icssub.DefaultTTL)}
// NewBackend creates a CalDAV backend over an existing ICS cache.
// dbase may be nil, in which case calendar sharing is disabled (only a
// user's own calendars are visible). The icsCache is shared with any
// other consumers (notably the web UI) so CalDAV and the web calendar
// page see identical, cache-consistent events for ICS subscriptions.
func NewBackend(cfg *config.Config, st *store.Store, dbase *db.DB, logger *slog.Logger, icsCache *icssub.Cache) *Backend {
if icsCache == nil {
icsCache = icssub.NewCache(icssub.DefaultTTL)
}
return &Backend{cfg: cfg, store: st, dbase: dbase, logger: logger, icsCache: icsCache}
}
// NewHandler returns an http.Handler for the /cal/ prefix.
@@ -54,8 +60,8 @@ func NewBackend(cfg *config.Config, st *store.Store, dbase *db.DB, logger *slog.
// property into PROPFIND responses for calendar collections, since
// go-webdav's caldav.Backend interface has no extension point for
// vendor-specific WebDAV properties.
func NewHandler(cfg *config.Config, st *store.Store, dbase *db.DB, logger *slog.Logger) http.Handler {
b := NewBackend(cfg, st, dbase, logger)
func NewHandler(cfg *config.Config, st *store.Store, dbase *db.DB, logger *slog.Logger, icsCache *icssub.Cache) http.Handler {
b := NewBackend(cfg, st, dbase, logger, icsCache)
return &colorInjectingHandler{backend: b, next: &caldav.Handler{Backend: b}}
}