Adjust routing for stories.
This commit is contained in:
parent
966c3a8f47
commit
544e4fb89a
|
@ -165,11 +165,10 @@ public class MessageController {
|
||||||
@HeaderParam("User-Agent") String userAgent,
|
@HeaderParam("User-Agent") String userAgent,
|
||||||
@HeaderParam("X-Forwarded-For") String forwardedFor,
|
@HeaderParam("X-Forwarded-For") String forwardedFor,
|
||||||
@PathParam("destination") UUID destinationUuid,
|
@PathParam("destination") UUID destinationUuid,
|
||||||
|
@QueryParam("story") boolean isStory,
|
||||||
@NotNull @Valid IncomingMessageList messages)
|
@NotNull @Valid IncomingMessageList messages)
|
||||||
throws RateLimitExceededException {
|
throws RateLimitExceededException {
|
||||||
|
|
||||||
boolean isStory = messages.story();
|
|
||||||
|
|
||||||
if (source.isEmpty() && accessKey.isEmpty() && !isStory) {
|
if (source.isEmpty() && accessKey.isEmpty() && !isStory) {
|
||||||
throw new WebApplicationException(Response.Status.UNAUTHORIZED);
|
throw new WebApplicationException(Response.Status.UNAUTHORIZED);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,15 +11,14 @@ import javax.validation.Valid;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
public record IncomingMessageList(@NotNull @Valid List<@NotNull IncomingMessage> messages,
|
public record IncomingMessageList(@NotNull @Valid List<@NotNull IncomingMessage> messages,
|
||||||
boolean online, boolean urgent, boolean story, long timestamp) {
|
boolean online, boolean urgent, long timestamp) {
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public IncomingMessageList(@JsonProperty("messages") @NotNull @Valid List<@NotNull IncomingMessage> messages,
|
public IncomingMessageList(@JsonProperty("messages") @NotNull @Valid List<@NotNull IncomingMessage> messages,
|
||||||
@JsonProperty("online") boolean online,
|
@JsonProperty("online") boolean online,
|
||||||
@JsonProperty("urgent") Boolean urgent,
|
@JsonProperty("urgent") Boolean urgent,
|
||||||
@JsonProperty("story") Boolean story,
|
|
||||||
@JsonProperty("timestamp") long timestamp) {
|
@JsonProperty("timestamp") long timestamp) {
|
||||||
|
|
||||||
this(messages, online, urgent == null || urgent, story != null && story, timestamp);
|
this(messages, online, urgent == null || urgent, timestamp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -676,7 +676,7 @@ class MessageControllerTest {
|
||||||
.request()
|
.request()
|
||||||
.header(OptionalAccess.UNIDENTIFIED, Base64.getEncoder().encodeToString(UNIDENTIFIED_ACCESS_BYTES))
|
.header(OptionalAccess.UNIDENTIFIED, Base64.getEncoder().encodeToString(UNIDENTIFIED_ACCESS_BYTES))
|
||||||
.put(Entity.entity(new IncomingMessageList(
|
.put(Entity.entity(new IncomingMessageList(
|
||||||
List.of(new IncomingMessage(1, 1L, 1, new String(contentBytes))), false, true, false,
|
List.of(new IncomingMessage(1, 1L, 1, new String(contentBytes))), false, true,
|
||||||
System.currentTimeMillis()),
|
System.currentTimeMillis()),
|
||||||
MediaType.APPLICATION_JSON_TYPE));
|
MediaType.APPLICATION_JSON_TYPE));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue