Skip to content

Commit

Permalink
Add web push headers
Browse files Browse the repository at this point in the history
  • Loading branch information
p1gp1g committed Sep 13, 2024
1 parent 3775b18 commit 6d5ea7f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/utils/post_allowed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,15 @@ pub async fn post_allowed<T: Serialize + ?Sized>(url: Url, body: &T) -> Result<r
.build()
.unwrap();

Ok(client.post(url).json(&body).send().await?)
Ok(client
.post(url)
.header("TTL", "2592000") // 30 days
.header("Content-Encoding", "aes128gcm") // Fake this encoding to be web push compliant
.header("Urgency", "high")
.header("Topic", "mollysocket") // Should override previous push messages
.json(&body)
.send()
.await?)
}

#[async_trait]
Expand Down

0 comments on commit 6d5ea7f

Please sign in to comment.