From 4feb95160742fd40142b97d779cb4ad113c09c1b Mon Sep 17 00:00:00 2001 From: Toaster Date: Wed, 7 Oct 2026 20:10:43 +0200 Subject: [PATCH 1/3] Hackily override error message for login and register if response is 429 --- src/app/api/auth.service.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/api/auth.service.ts b/src/app/api/auth.service.ts index 63f29f7..f82ad98 100644 --- a/src/app/api/auth.service.ts +++ b/src/app/api/auth.service.ts @@ -110,6 +110,8 @@ export class AuthService { return; } + // TODO hacky, find better solution + if (err.statusCode === 429) err.message = "You have been rate-limited. Please try again later, and please stop spamming this button."; this.bannerService.pushError('Failed to sign in', err.message ?? "No error was provided by the server. Check the console for more details.") console.error(err); } @@ -152,6 +154,8 @@ export class AuthService { return; } + // TODO hacky, find better solution + if (err.statusCode === 429) err.message = "You have been rate-limited. Please try again later, and please stop spamming this button."; this.bannerService.pushError('Failed to register', err.message ?? "No error was provided by the server. Check the console for more details.") console.error(err); } From 6fa0d9f3202610116377d9a9e5fe20d47b3005f3 Mon Sep 17 00:00:00 2001 From: Toaster Date: Thu, 8 Oct 2026 10:30:55 +0200 Subject: [PATCH 2/3] Special-case 429 in handleRequestError() incase that does something --- src/app/api/api-request.creator.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/api/api-request.creator.ts b/src/app/api/api-request.creator.ts index e5a1f1f..3faa833 100644 --- a/src/app/api/api-request.creator.ts +++ b/src/app/api/api-request.creator.ts @@ -46,6 +46,11 @@ export class ApiRequestCreator { return of(undefined); } + if (data?.error === undefined && err.status == 429) { + this.bannerService.pushError("Rate Limited", "You have been rate-limited. Please try again later, and please try not to spam stuff again.") + return of(undefined); + } + this.bannerService.pushError(`API Error: ${data?.error?.name} (${err.status})`, data?.error?.message ?? "Unknown error") return of(undefined); } From 85d7e469efde0f2c24a75f5ff56391dbc6c21018 Mon Sep 17 00:00:00 2001 From: Toaster Date: Thu, 8 Oct 2026 10:31:48 +0200 Subject: [PATCH 3/3] Improve register/login rate-limit messages --- src/app/api/auth.service.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/api/auth.service.ts b/src/app/api/auth.service.ts index f82ad98..84068d7 100644 --- a/src/app/api/auth.service.ts +++ b/src/app/api/auth.service.ts @@ -110,8 +110,8 @@ export class AuthService { return; } - // TODO hacky, find better solution - if (err.statusCode === 429) err.message = "You have been rate-limited. Please try again later, and please stop spamming this button."; + // TODO hacky, find better solution. Should also reflect the time given in the response header, but Refresh currently only returns that on the first block... + if (err.statusCode === 429) err.message = "You have been rate-limited. Please try again in a few minutes, and please stop spamming this button."; this.bannerService.pushError('Failed to sign in', err.message ?? "No error was provided by the server. Check the console for more details.") console.error(err); } @@ -154,8 +154,8 @@ export class AuthService { return; } - // TODO hacky, find better solution - if (err.statusCode === 429) err.message = "You have been rate-limited. Please try again later, and please stop spamming this button."; + // TODO hacky, find better solution. Should also reflect the time given in the response header, but Refresh currently only returns that on the first block... + if (err.statusCode === 429) err.message = "You have been rate-limited. Please try again in an hour or less, and please stop spamming this button."; this.bannerService.pushError('Failed to register', err.message ?? "No error was provided by the server. Check the console for more details.") console.error(err); }