Escape and fold the iCal export, serve it as text/calendar, add subscription links

- iCal export: RFC 5545 text escaping for SUMMARY, DESCRIPTION and LOCATION,
  line folding at 75 octets (UTF-8 aware), CRLF line endings, and
  Content-Type text/calendar instead of the inferred text/html. A line break
  in a description used to end the property early; the new calendar
  frontend has a multi-line description field.
- formatDate no longer shifts the event's end date in place.
- GET /calendar/events/subscriptions: the iCal URL of every calendar, with
  its shared password where needed, for the calendar app's "Abonnieren"
  dialog. Editors only (requireAppAccess('calendar')), the shared password
  is not accepted there, never cached; calendars without a configured
  credential are left out.
- Tests for both; documented in docs/calendar-ical.md.

Backwards compatible with the current Angular calendar app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PaddyandClaude Opus 5.5 committed 2026-09-28 22:15:59 +02:00
1 parent d522f35663
commit a574e93359
6 files changed
+355 -8

No files matched your search

@@ -21,7 +21,13 @@ dotenv.config();
* test/calendar/credentials.service.test.ts.
*/
const credentialFor = (calendarName: string): string | undefined => {
/**
* The shared password for a calendar, or undefined for `public` (which needs
* none), an unknown calendar, or one whose credential is not configured.
* Exported for the subscriptions endpoint, which hands signed-in editors the
* ready-made iCal URLs - see GET /calendar/events/subscriptions.
*/
export const credentialFor = (calendarName: string): string | undefined => {
switch (calendarName) {
case 'members':
return process.env.MEMBER_CREDENTIAL;