From d2480ee242ae1d4caf95b4202abc7a10c48cceba Mon Sep 17 00:00:00 2001 From: Michael Bartel Date: Sat, 18 Apr 2026 17:02:48 +0200 Subject: [PATCH] Support for username property for ical --- .../calendar/parent/ext-calendar-calendars.js | 11 +++++++++-- .../calendar/schema/calendar-calendars.json | 13 +++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/calendar/experiments/calendar/parent/ext-calendar-calendars.js b/calendar/experiments/calendar/parent/ext-calendar-calendars.js index d47a3a4..7dc850d 100644 --- a/calendar/experiments/calendar/parent/ext-calendar-calendars.js +++ b/calendar/experiments/calendar/parent/ext-calendar-calendars.js @@ -24,7 +24,7 @@ this.calendar_calendars = class extends ExtensionAPI { return { calendar: { calendars: { - async query({ type, url, name, color, readOnly, enabled, visible }) { + async query({ type, url, name, color, readOnly, enabled, visible, username }) { const calendars = cal.manager.getCalendars(); let pattern = null; @@ -69,6 +69,10 @@ this.calendar_calendars = class extends ExtensionAPI { matches = false; } + if (username && username != calendar.getProperty("username")) { + matches = false; + } + return matches; }) .map(calendar => convertCalendar(context.extension, calendar)); @@ -108,6 +112,9 @@ this.calendar_calendars = class extends ExtensionAPI { if (createProperties.showReminders != null) { calendar.setProperty("suppressAlarms", !createProperties.showReminders); } + if (createProperties.username != null) { + calendar.setProperty("username", createProperties.username); + } if (createProperties.capabilities != null) { if (!isOwnCalendar(calendar, context.extension)) { throw new ExtensionError("Cannot set capabilities on foreign calendar types"); @@ -150,7 +157,7 @@ this.calendar_calendars = class extends ExtensionAPI { calendar.setProperty("suppressAlarms", !updateProperties.showReminders); } - for (const prop of ["readOnly", "name", "color"]) { + for (const prop of ["readOnly", "name", "color", "username"]) { if (updateProperties[prop] != null) { calendar.setProperty(prop, updateProperties[prop]); } diff --git a/calendar/experiments/calendar/schema/calendar-calendars.json b/calendar/experiments/calendar/schema/calendar-calendars.json index abc4a6c..dc05ddf 100644 --- a/calendar/experiments/calendar/schema/calendar-calendars.json +++ b/calendar/experiments/calendar/schema/calendar-calendars.json @@ -16,7 +16,8 @@ "visible": { "type": "boolean" }, "showReminders": { "type": "boolean" }, "color": { "type": "string", "optional": true }, - "capabilities": { "$ref": "CalendarCapabilities", "optional": true } + "capabilities": { "$ref": "CalendarCapabilities", "optional": true }, + "username": { "type": "string", "optional": true } } }, { @@ -29,7 +30,8 @@ "enabled": { "type": "boolean" }, "visible": { "type": "boolean" }, "showReminders": { "type": "boolean" }, - "color": { "type": "string", "optional": true } + "color": { "type": "string", "optional": true }, + "username": { "type": "string", "optional": true } } }, { @@ -115,7 +117,8 @@ "color": { "type": "string", "optional": true }, "readOnly": { "type": "boolean", "optional": true }, "visible": { "type": "boolean", "optional": true }, - "enabled": { "type": "boolean", "optional": true } + "enabled": { "type": "boolean", "optional": true }, + "username": { "type": "string", "optional": true } } } ] @@ -150,7 +153,8 @@ "optional": true, "additionalProperties": true, "description": "This is normally CalendarCapabilities, but we don't want to inherit default values here" - } + }, + "username": { "type": "string", "optional": true } } } ] @@ -171,6 +175,7 @@ "enabled": { "type": "boolean", "optional": true }, "color": { "type": "string", "optional": true }, "lastError": { "type": "string", "optional": true }, + "username": { "type": "string", "optional": true }, "capabilities": { "type": "object", "optional": true,