mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-02 13:26:53 +00:00
Add header to disable messages on authenticated websocket
This commit is contained in:
1 parent
8deb5a803a
commit
ac720595e6
10 files changed
+406
-55
No files matched your search
@@ -97,7 +97,12 @@ public class WebSocketClient {
|
||||
|
||||
public boolean shouldDeliverStories() {
|
||||
String value = session.getUpgradeRequest().getHeader(WebsocketHeaders.X_SIGNAL_RECEIVE_STORIES);
|
||||
return WebsocketHeaders.parseReceiveStoriesHeader(value);
|
||||
return WebsocketHeaders.parseBooleanHeader(value);
|
||||
}
|
||||
|
||||
public boolean shouldDisableMessages() {
|
||||
final String value = session.getUpgradeRequest().getHeader(WebsocketHeaders.X_SIGNAL_DISABLE_MESSAGES);
|
||||
return WebsocketHeaders.parseBooleanHeader(value);
|
||||
}
|
||||
|
||||
private long generateRequestId() {
|
||||
|
||||
+7
-1
@@ -6,7 +6,13 @@ package org.whispersystems.websocket;
|
||||
public class WebsocketHeaders {
|
||||
public final static String X_SIGNAL_RECEIVE_STORIES = "X-Signal-Receive-Stories";
|
||||
|
||||
public static boolean parseReceiveStoriesHeader(String s) {
|
||||
public final static String X_SIGNAL_DISABLE_MESSAGES = "X-Signal-Disable-Messages";
|
||||
|
||||
/// Parse a boolean header value
|
||||
///
|
||||
/// @param s the value of an HTTP header
|
||||
/// @return true if the header is "true", otherwise false
|
||||
public static boolean parseBooleanHeader(String s) {
|
||||
return "true".equals(s);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user