From 4e6aedf5f06a6a762c23921f74fa70fba01d8985 Mon Sep 17 00:00:00 2001 From: Paul Hitt Date: Fri, 28 Aug 2026 17:37:32 -0400 Subject: [PATCH] 429 copy uses the relay's Retry-After RelayException.RateLimited has parsed the header all along; the relay never sent it until today. The message now says "Try again in about N minutes" when the clock is known, with the old copy as fallback. Co-Authored-By: Claude Fable 5 --- .../io/flamenet/messenger/app/MessengerViewModel.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/io/flamenet/messenger/app/MessengerViewModel.kt b/app/src/main/kotlin/io/flamenet/messenger/app/MessengerViewModel.kt index c29d822..a4ad711 100644 --- a/app/src/main/kotlin/io/flamenet/messenger/app/MessengerViewModel.kt +++ b/app/src/main/kotlin/io/flamenet/messenger/app/MessengerViewModel.kt @@ -1736,7 +1736,13 @@ class MessengerViewModel(app: Application) : AndroidViewModel(app) { is RelayException.Unauthorized -> "Your session expired. Sign out and back in to keep going." is RelayException.NotFound -> "This server doesn't look like a Flamenet relay." - is RelayException.RateLimited -> "Too many attempts. Wait a few minutes." + // The relay now says WHEN (Retry-After); a refusal with a clock is + // the difference between a person who waits and one who hammers. + is RelayException.RateLimited -> failure.retryAfterSeconds?.let { s -> + val mins = ((s + 59) / 60).coerceAtLeast(1) + "Too many attempts. Try again in about $mins minute" + + if (mins == 1) "." else "s." + } ?: "Too many attempts. Wait a few minutes." is Vault.Corrupt -> "This phone's stored keys could not be read." else -> failure.message ?: "Something went wrong reaching that server." }