|
|
|
@ -91,8 +91,8 @@ public class ApiEndpoint extends PathHandler {
@@ -91,8 +91,8 @@ public class ApiEndpoint extends PathHandler {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean doGet(String path, HttpExchange ex) throws IOException { |
|
|
|
|
String hostname = "TODO"; // TODO
|
|
|
|
|
String prodId = "TODO"; |
|
|
|
|
String hostname = hostname(ex).split("://",2)[1]; |
|
|
|
|
String prodId = "OpenCloudCal@"+hostname; |
|
|
|
|
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)).map(ical -> Util.wrapIcal(ical,prodId)).map(ApiEndpoint::httpError)); |
|
|
|
|