feat: added support for ICS calendars - #3637
Conversation
[P1] Normalize webcal:// URLs before passing them to libcurlfetchIcs() forwards the configured URL unchanged /src/calendar/calendar_service.cpp#L543-L558. Result: common calendar subscription links fail with CURLE_UNSUPPORTED_PROTOCOL, so a core requested input cannot load. Normalize webcal://… to https://… before constructing the request. Alternatively, reject it in settings with an actionable error, but that would not satisfy issue #3294. [P2] Reject successful HTTP responses that are not valid calendarsAfter any HTTP 200, fetchIcs() treats the parser output as authoritative /src/calendar/calendar_service.cpp#L560-L577. parseICalEvents() does not validate the VCALENDAR envelope; HTML login pages, expired-share pages, proxy errors, and malformed ICS therefore parse as an empty event list. accountDone(..., true, {}) then replaces previously cached events and persists the empty result. Validate that the response is an actual calendar before calling accountDone(..., true, ...). Invalid content should use the failure path so stale events remain available. A structured parser result distinguishing “valid empty calendar” from “invalid input” would be safest. |
Summary
I added a new type of calendar (ICS) to the settings page which can take a URL to an *.ics file, and use that for the calendar.
In terms of code changes, it's mostly the same stuff that was in #2928 before it got closed. However it does fix the 2 main pain points that were mentioned because it turns out that the
parseICalEventsfunction was edited to support both of those pain points, so there weren't a lot of changes needed to make it work.Motivation
Many apps expose their calendars in this format, so it is important to support it.
Type of Change
Related Issue
This closes #3294
Also this goes hand in hand with PR #3636, we coincidentally happened to be working on this at the same time!
Testing
Ran
just test, all tests passed.I put this content in a file
testing.ics:And then ran
python -m http.serverin that directory, this creates a static http server at port 8000 to that directory. Then I addedhttp://localhost:8000/testing.icsusing the Noctalia settings UI as an ICS calendar, and the event "Sample Team Meeting (ICS)" showed up as happening today (see screenshot below)Manual Coverage
Screenshots / Videos
Checklist
CONTRIBUTING.md.just formatwith clang-format v22+ installed, or this PR has no code changes.assets/translations/en.json, or this PR adds no new user-facing strings.Additional Notes
N/A