From c005ea50b2914e05d836e6876ca189939ba92b2b Mon Sep 17 00:00:00 2001 From: kisfenyo Date: Fri, 23 Jan 2026 13:12:44 +0100 Subject: [PATCH] added calendars for kisfenyo --- glance-system/glance-helper.yaml | 17 +++-- glance-system/glance-kisfenyo.yaml | 104 +++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 4 deletions(-) diff --git a/glance-system/glance-helper.yaml b/glance-system/glance-helper.yaml index 770254b..cd7af8a 100644 --- a/glance-system/glance-helper.yaml +++ b/glance-system/glance-helper.yaml @@ -1100,15 +1100,17 @@ data: @APP.get("/calendar/events") def calendar_events_api( count: int = Query(default=5, ge=1, le=50, description="Number of events to return"), - days: int = Query(default=30, ge=1, le=365, description="Days to look ahead") + days: int = Query(default=30, ge=1, le=365, description="Days to look ahead"), + calendars: str = Query(default="", description="Comma-separated list of calendar names to include (empty = all)") ): """ Returns upcoming calendar events from configured iCal feeds. Merges multiple calendars and sorts by start time. + Use 'calendars' parameter to filter specific calendars (e.g., calendars=Családi,Órák) """ - calendars = _parse_ical_urls() + all_calendars = _parse_ical_urls() - if not calendars: + if not all_calendars: return Response( content=json.dumps({ "error": "No calendars configured", @@ -1119,10 +1121,17 @@ data: media_type="application/json; charset=utf-8" ) + # Filter calendars if specified + if calendars.strip(): + requested = [c.strip() for c in calendars.split(",") if c.strip()] + filtered_calendars = {k: v for k, v in all_calendars.items() if k in requested} + else: + filtered_calendars = all_calendars + all_events = [] calendar_status = {} - for name, url in calendars.items(): + for name, url in filtered_calendars.items(): ical_text = _fetch_ical(url) if ical_text: events = _parse_ical_events(ical_text, name, days) diff --git a/glance-system/glance-kisfenyo.yaml b/glance-system/glance-kisfenyo.yaml index f91caa7..18e65e6 100644 --- a/glance-system/glance-kisfenyo.yaml +++ b/glance-system/glance-kisfenyo.yaml @@ -850,6 +850,110 @@ data: {{ end }} + # Calendar Events Widget (Családi only) + - type: custom-api + title: Family Calendar + cache: 5m + url: http://glance-helper.glance-system.svc.cluster.local:8000/calendar/events + parameters: + count: 10 + days: 14 + calendars: Családi + template: | + {{ $events := .JSON.Array "events" }} + {{ $count := len $events }} + {{ $showCount := 5 }} + {{ $hasMore := gt $count $showCount }} + + + +
+ {{ if lt $count 1 }} +
No events in near future
+ {{ else }} + {{ if $hasMore }}{{ end }} +
+ {{ range $i, $e := $events }} + {{ $isExtra := ge $i $showCount }} + {{ $isAllDay := $e.Bool "is_all_day" }} + {{ $title := $e.String "title" }} + {{ $startDate := $e.String "start_date" }} + {{ $startTime := $e.String "start_time" }} + +
+
+
{{ $title }}
+
+
+
{{ $startDate }}
+ {{ if $isAllDay }} +
Whole day
+ {{ else }} +
{{ $startTime }}
+ {{ end }} +
+
+ {{ end }} +
+ {{ if $hasMore }} + + + {{ end }} + {{ end }} +
+ - type: bookmarks title: Productivity Self-Hosted groups: