Page MenuHomePhabricator

D12895.id42850.diff
No OneTemporary

D12895.id42850.diff

diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5822,6 +5822,7 @@
dependencies = [
"serde",
"serde_json",
+ "util_macros",
"websocket_messages",
]
diff --git a/lib/types/tunnelbroker/notif-types.js b/lib/types/tunnelbroker/notif-types.js
--- a/lib/types/tunnelbroker/notif-types.js
+++ b/lib/types/tunnelbroker/notif-types.js
@@ -15,3 +15,15 @@
+data: string,
+priority: 'NORMAL' | 'HIGH',
};
+
+export type TunnelbrokerWebPushNotif = {
+ +type: 'WebPushNotif',
+ +clientMessageID: string,
+ +deviceID: string,
+ +payload: string,
+};
+
+export type TunnelbrokerNotif =
+ | TunnelbrokerAPNsNotif
+ | TunnelbrokerFCMNotif
+ | TunnelbrokerWebPushNotif;
diff --git a/shared/tunnelbroker_messages/Cargo.toml b/shared/tunnelbroker_messages/Cargo.toml
--- a/shared/tunnelbroker_messages/Cargo.toml
+++ b/shared/tunnelbroker_messages/Cargo.toml
@@ -11,3 +11,4 @@
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
websocket_messages = { path = "../websocket_messages" }
+util_macros = { path = "../util_macros" }
diff --git a/shared/tunnelbroker_messages/src/messages/mod.rs b/shared/tunnelbroker_messages/src/messages/mod.rs
--- a/shared/tunnelbroker_messages/src/messages/mod.rs
+++ b/shared/tunnelbroker_messages/src/messages/mod.rs
@@ -43,6 +43,7 @@
AnonymousInitializationMessage(AnonymousInitializationMessage),
APNsNotif(APNsNotif),
FCMNotif(FCMNotif),
+ WebPushNotif(WebPushNotif),
MessageToDeviceRequest(MessageToDeviceRequest),
MessageReceiveConfirmation(MessageReceiveConfirmation),
MessageToTunnelbrokerRequest(MessageToTunnelbrokerRequest),
diff --git a/shared/tunnelbroker_messages/src/messages/notif.rs b/shared/tunnelbroker_messages/src/messages/notif.rs
--- a/shared/tunnelbroker_messages/src/messages/notif.rs
+++ b/shared/tunnelbroker_messages/src/messages/notif.rs
@@ -1,4 +1,5 @@
use serde::{Deserialize, Serialize};
+use util_macros::TagAwareDeserialize;
/// APNs notif built on client.
#[derive(Serialize, Deserialize, PartialEq, Debug)]
@@ -23,3 +24,14 @@
pub data: String,
pub priority: String,
}
+
+/// WebPush notif built on client.
+#[derive(Serialize, Deserialize, TagAwareDeserialize, PartialEq, Debug)]
+#[serde(tag = "type", remote = "Self", rename_all = "camelCase")]
+pub struct WebPushNotif {
+ #[serde(rename = "clientMessageID")]
+ pub client_message_id: String,
+ #[serde(rename = "deviceID")]
+ pub device_id: String,
+ pub payload: String,
+}

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 22, 1:50 AM (4 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2559333
Default Alt Text
D12895.id42850.diff (2 KB)

Event Timeline