Allow POST requests for unauthenticated subscriptions

This commit is contained in:
Bnyro 2023-01-29 20:07:06 +01:00
parent 9f06b7eec2
commit 448659ea8a

View file

@ -329,6 +329,14 @@ public class ServerLauncher extends MultithreadedHttpServerLauncher {
} catch (Exception e) { } catch (Exception e) {
return getErrorResponse(e, request.getPath()); return getErrorResponse(e, request.getPath());
} }
})).map(POST, "/feed/unauthenticated", AsyncServlet.ofBlocking(executor, request -> {
try {
String[] subscriptions = Constants.mapper.readValue(request.loadBody().getResult().asArray(),
String[].class);
return getJsonResponse(FeedHandlers.unauthenticatedFeedResponse(subscriptions), "public, s-maxage=120");
} catch (Exception e) {
return getErrorResponse(e, request.getPath());
}
})).map(GET, "/feed/unauthenticated/rss", AsyncServlet.ofBlocking(executor, request -> { })).map(GET, "/feed/unauthenticated/rss", AsyncServlet.ofBlocking(executor, request -> {
try { try {
return getRawResponse(FeedHandlers.unauthenticatedFeedResponseRSS( return getRawResponse(FeedHandlers.unauthenticatedFeedResponseRSS(
@ -369,6 +377,14 @@ public class ServerLauncher extends MultithreadedHttpServerLauncher {
} catch (Exception e) { } catch (Exception e) {
return getErrorResponse(e, request.getPath()); return getErrorResponse(e, request.getPath());
} }
})).map(POST, "/subscriptions/unauthenticated", AsyncServlet.ofBlocking(executor, request -> {
try {
String[] subscriptions = Constants.mapper.readValue(request.loadBody().getResult().asArray(),
String[].class);
return getJsonResponse(FeedHandlers.unauthenticatedSubscriptionsResponse(subscriptions), "public, s-maxage=120");
} catch (Exception e) {
return getErrorResponse(e, request.getPath());
}
})).map(POST, "/user/playlists/create", AsyncServlet.ofBlocking(executor, request -> { })).map(POST, "/user/playlists/create", AsyncServlet.ofBlocking(executor, request -> {
try { try {
var name = Constants.mapper.readTree(request.loadBody().getResult().asArray()).get("name").textValue(); var name = Constants.mapper.readTree(request.loadBody().getResult().asArray()).get("name").textValue();