1
0
Fork 1
Spiegel von https://github.com/dani-garcia/vaultwarden.git synchronisiert 2024-11-22 05:10:29 +01:00

Fix push not working (#5214)

The new native mobile clients seem to use PascalCase for the push payload.
Also the date/time could cause issues.

This PR fixes this by formatting the date/time correctly and use PascalCase for the payload key's
I now receive cipher updates and login-with-device requests again.

Fixes #5182

Signed-off-by: BlackDex <black.dex@gmail.com>
Dieser Commit ist enthalten in:
Mathijs van Veluw 2024-11-20 17:32:44 +01:00 committet von GitHub
Ursprung cdfdc6ff4f
Commit b0b953f348
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194

Datei anzeigen

@ -9,6 +9,7 @@ use crate::{
api::{ApiResult, EmptyResult, UpdateType}, api::{ApiResult, EmptyResult, UpdateType},
db::models::{Cipher, Device, Folder, Send, User}, db::models::{Cipher, Device, Folder, Send, User},
http_client::make_http_request, http_client::make_http_request,
util::format_date,
CONFIG, CONFIG,
}; };
@ -170,10 +171,10 @@ pub async fn push_cipher_update(
"identifier": acting_device_uuid, "identifier": acting_device_uuid,
"type": ut as i32, "type": ut as i32,
"payload": { "payload": {
"id": cipher.uuid, "Id": cipher.uuid,
"userId": cipher.user_uuid, "UserId": cipher.user_uuid,
"organizationId": (), "OrganizationId": (),
"revisionDate": cipher.updated_at "RevisionDate": format_date(&cipher.updated_at)
} }
})) }))
.await; .await;
@ -190,8 +191,8 @@ pub fn push_logout(user: &User, acting_device_uuid: Option<String>) {
"identifier": acting_device_uuid, "identifier": acting_device_uuid,
"type": UpdateType::LogOut as i32, "type": UpdateType::LogOut as i32,
"payload": { "payload": {
"userId": user.uuid, "UserId": user.uuid,
"date": user.updated_at "Date": format_date(&user.updated_at)
} }
}))); })));
} }
@ -204,8 +205,8 @@ pub fn push_user_update(ut: UpdateType, user: &User) {
"identifier": (), "identifier": (),
"type": ut as i32, "type": ut as i32,
"payload": { "payload": {
"userId": user.uuid, "UserId": user.uuid,
"date": user.updated_at "Date": format_date(&user.updated_at)
} }
}))); })));
} }
@ -224,9 +225,9 @@ pub async fn push_folder_update(
"identifier": acting_device_uuid, "identifier": acting_device_uuid,
"type": ut as i32, "type": ut as i32,
"payload": { "payload": {
"id": folder.uuid, "Id": folder.uuid,
"userId": folder.user_uuid, "UserId": folder.user_uuid,
"revisionDate": folder.updated_at "RevisionDate": format_date(&folder.updated_at)
} }
}))); })));
} }
@ -242,9 +243,9 @@ pub async fn push_send_update(ut: UpdateType, send: &Send, acting_device_uuid: &
"identifier": acting_device_uuid, "identifier": acting_device_uuid,
"type": ut as i32, "type": ut as i32,
"payload": { "payload": {
"id": send.uuid, "Id": send.uuid,
"userId": send.user_uuid, "UserId": send.user_uuid,
"revisionDate": send.revision_date "RevisionDate": format_date(&send.revision_date)
} }
}))); })));
} }
@ -295,8 +296,8 @@ pub async fn push_auth_request(user_uuid: String, auth_request_uuid: String, con
"identifier": null, "identifier": null,
"type": UpdateType::AuthRequest as i32, "type": UpdateType::AuthRequest as i32,
"payload": { "payload": {
"id": auth_request_uuid, "Id": auth_request_uuid,
"userId": user_uuid, "UserId": user_uuid,
} }
}))); })));
} }
@ -316,8 +317,8 @@ pub async fn push_auth_response(
"identifier": approving_device_uuid, "identifier": approving_device_uuid,
"type": UpdateType::AuthRequestResponse as i32, "type": UpdateType::AuthRequestResponse as i32,
"payload": { "payload": {
"id": auth_request_uuid, "Id": auth_request_uuid,
"userId": user_uuid, "UserId": user_uuid,
} }
}))); })));
} }