mirror of
https://github.com/narrrl/proton-drive-linux.git
synced 2026-11-03 16:41:26 +01:00
fix(core,gui,cli): a blocked sign-in no longer asks to update the app (B209)
Proton answers a sign-in it blocks for abuse or rate limits with code 2028 and the text "This version of the app is no longer supported". The SDK read 2028 as Unknown, so the app passed that text through and told users to update a current release (issues #28, #39). - deps: proton-sdk and proton-drive-rs 0.8.3, which name 2028 Blocked - core: error::sign_in_blocked detects it - gui: the login page says Proton is refusing sign-in for now and that waiting helps, translated in every catalog - cli: pdfs login adds the same hint to the error - cli: pdfs diagnose warns instead of failing when cache.db does not exist yet; the daemon creates it after the first sign-in - docs: BUGS.md B209, changelog, troubleshooting entry
This commit is contained in:
1 parent
2633b4ed72
commit
478a0e6cdd
17 files changed
+481
-310
No files matched your search
@@ -227,6 +227,11 @@ pub(crate) fn login_error_message(error: &pdfs_core::Error) -> String {
|
||||
pdfs_core::Error::Proton(ProtonError::Api(api)) if api.http_status == 429 => {
|
||||
gettext("Too many sign-in attempts. Wait a few minutes and try again.")
|
||||
}
|
||||
// Proton's text for this one asks the user to update an app that is
|
||||
// already current.
|
||||
pdfs_core::Error::Proton(e) if pdfs_core::error::sign_in_blocked(e) => gettext(
|
||||
"Proton is temporarily refusing sign-in from this device. Your app version is not the problem. Wait several hours, up to a day, without trying again, then sign in.",
|
||||
),
|
||||
pdfs_core::Error::Proton(ProtonError::Api(api)) if !api.message.is_empty() => {
|
||||
api.message.clone()
|
||||
}
|
||||
@@ -628,6 +633,21 @@ mod tests {
|
||||
assert!(login_error_message(&error).contains("no mailbox password"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_blocked_sign_in_does_not_ask_for_an_update() {
|
||||
use pdfs_core::proton_sdk::api::ResponseCode;
|
||||
use pdfs_core::proton_sdk::{ProtonApiError, ProtonError};
|
||||
let error = pdfs_core::Error::Proton(ProtonError::Api(ProtonApiError {
|
||||
code: ResponseCode::Blocked,
|
||||
http_status: 422,
|
||||
message: "This version of the app is no longer supported, please update to continue using the app".into(),
|
||||
details: None,
|
||||
}));
|
||||
let message = login_error_message(&error);
|
||||
assert!(message.contains("temporarily refusing"), "{message}");
|
||||
assert!(!message.contains("update"), "{message}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_unmapped_error_keeps_its_text() {
|
||||
let error = pdfs_core::Error::Other("something odd".into());
|
||||
|
||||
Reference in new issue
Block a user