Skip to content

Commit

Permalink
chore: bump a2 (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris13524 authored May 6, 2024
1 parent 09512dd commit 4701eb7
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
6 changes: 4 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ tracing-opentelemetry = "0.18"
atty = "0.2"

# Push
a2 = { version = "0.9.0", features = ["tracing", "openssl"] }
a2 = { version = "0.10.0", features = ["tracing", "openssl"] }
fcm = "0.9"

# Signature validation
Expand Down
6 changes: 3 additions & 3 deletions src/handlers/register_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ pub async fn handler(
return Err(EmptyField("token".to_string()));
}

let mut client_id = body.client_id.to_string();

client_id = client_id
let client_id = body
.client_id
.as_ref()
.trim_start_matches(DECENTRALIZED_IDENTIFIER_PREFIX)
.to_owned();

Expand Down
5 changes: 3 additions & 2 deletions src/handlers/update_apns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use {
state::AppState,
stores::tenant::{TenantApnsUpdateAuth, TenantApnsUpdateParams},
},
a2::ClientConfig,
axum::{
extract::{Multipart, Path, State},
http::HeaderMap,
Expand Down Expand Up @@ -220,7 +221,7 @@ pub async fn handler(
match a2::Client::certificate(
&mut std::io::Cursor::new(decoded),
&apns_certificate_password,
a2::Endpoint::Sandbox,
ClientConfig::new(a2::Endpoint::Sandbox),
) {
Ok(_) => Ok(()),
Err(e) => {
Expand All @@ -240,7 +241,7 @@ pub async fn handler(
&mut std::io::Cursor::new(decoded),
apns_key_id,
apns_team_id,
a2::Endpoint::Sandbox,
ClientConfig::new(a2::Endpoint::Sandbox),
) {
Ok(_) => Ok(()),
Err(e) => {
Expand Down
6 changes: 3 additions & 3 deletions src/providers/apns.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use {
super::{LegacyPushMessage, PushMessage, RawPushMessage},
crate::{blob::DecryptedPayloadBlob, error::Error, providers::PushProvider},
a2::{ErrorReason, NotificationBuilder, NotificationOptions},
a2::{ClientConfig, ErrorReason, NotificationBuilder, NotificationOptions},
async_trait::async_trait,
std::io::Read,
tracing::{debug, info, instrument, warn},
Expand All @@ -24,7 +24,7 @@ impl ApnsProvider {
R: Read,
{
Ok(ApnsProvider {
client: a2::Client::certificate(cert, password.as_str(), endpoint)?,
client: a2::Client::certificate(cert, password.as_str(), ClientConfig::new(endpoint))?,
topic,
})
}
Expand All @@ -40,7 +40,7 @@ impl ApnsProvider {
R: Read,
{
Ok(ApnsProvider {
client: a2::Client::token(pkcs8_pem, key_id, team_id, endpoint)?,
client: a2::Client::token(pkcs8_pem, key_id, team_id, ClientConfig::new(endpoint))?,
topic,
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/providers/fcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl Clone for FcmProvider {
}

fn clone_from(&mut self, source: &Self) {
self.api_key = source.api_key.clone();
self.api_key.clone_from(&source.api_key);
self.client = fcm::Client::new();
}
}
Expand Down

0 comments on commit 4701eb7

Please sign in to comment.