|
|
|
@ -94,6 +94,7 @@ public class ApiEndpoint extends PathHandler {
@@ -94,6 +94,7 @@ public class ApiEndpoint extends PathHandler {
|
|
|
|
|
String hostname = hostname(ex); |
|
|
|
|
String urlTemplate = hostname+"/static/event?id={}"; |
|
|
|
|
String prodId = "OpenCloudCal@"+hostname.split("://",2)[1]; |
|
|
|
|
ex.getResponseHeaders().add("Access-Control-Allow-Origin","*"); |
|
|
|
|
return switch (path) { |
|
|
|
|
case "/event" -> sendContent(ex,getEvent(ex).map(ApiEndpoint::toJson).map(ApiEndpoint::httpError)); |
|
|
|
|
case "/event/ical"-> sendContent(ex,getEvent(ex).map(event -> toIcal(event, hostname, urlTemplate)).map(ical -> Util.wrapIcal(ical,prodId)).map(ApiEndpoint::httpError)); |
|
|
|
|