From c5b684a1b7943d5f5995de1de3c68602a6cd8341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 8 Jul 2020 01:40:15 +0200 Subject: Add preliminary xcal download endpoint. --- module/entry-points/server.scm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'module/entry-points/server.scm') diff --git a/module/entry-points/server.scm b/module/entry-points/server.scm index bd30033b..a0afa0f8 100644 --- a/module/entry-points/server.scm +++ b/module/entry-points/server.scm @@ -180,6 +180,22 @@ (aif end (parse-iso-date it) (current-date))) (print-all-events)))))) + (GET "/calendar/:uid{.*}.xcs" (uid) + (aif (get-event-by-uid uid) + (return '((content-type application/calendar+xml)) + ;; TODO sxml->xml takes a port, would be better + ;; to give it the return port imidiately. + (with-output-to-string + ;; TODO this is just the vevent part. + ;; A surounding vcalendar is required, as well as + ;; a doctype. + ;; Look into changing how events carry around their + ;; parent information, possibly splitting "source parent" + ;; and "program parent" into different fields. + (lambda () (sxml->xml ((@ (output xcal) vcomponent->sxcal) it))))) + (return (build-response code: 404) + (format #f "No component with UID=~a found." uid)))) + (GET "/calendar/:uid{.*}.ics" (uid) (aif (get-event-by-uid uid) (return '((content-type text/calendar)) -- cgit v1.2.3