aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-07-08 01:40:15 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-07-08 01:40:15 +0200
commitc5b684a1b7943d5f5995de1de3c68602a6cd8341 (patch)
tree18edae9f3d86c8cfcbe764b420c1cd3b495cd8c6
parentRepair ics output. (diff)
downloadcalp-c5b684a1b7943d5f5995de1de3c68602a6cd8341.tar.gz
calp-c5b684a1b7943d5f5995de1de3c68602a6cd8341.tar.xz
Add preliminary xcal download endpoint.
-rw-r--r--module/entry-points/server.scm16
1 files changed, 16 insertions, 0 deletions
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))