feat: add Retry-After header and countdown timer for rate limits

- Rate limiter returns retryAfterSec in response body + Retry-After header
- Registration rate limits: 10 per 10min (was 15/hour)
- Frontend surfaces retry timer in error messages

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-09 09:15:30 +00:00
co-authored by Claude Opus 4.6
parent 592841d7b1
commit 3c32f01aa7
3 changed files with 13 additions and 6 deletions
+8 -3
View File
@@ -260,8 +260,9 @@ export function useNostr() {
const data = await res.json()
if (!res.ok) {
// Surface detailed error info from webhook verification failures
const msg = data.details ? `${data.error} ${data.details}` : (data.error || 'Registration failed')
// Include retry timer info for rate limits
let msg = data.details ? `${data.error} ${data.details}` : (data.error || 'Registration failed')
if (res.status === 429 && data.retryAfterSec) msg += ` (${data.retryAfterSec}s)`
throw new Error(msg)
}
@@ -344,7 +345,11 @@ export function useNostr() {
})
const data = await res.json()
if (!res.ok) throw new Error(data.error || 'Registration failed')
if (!res.ok) {
let msg = data.error || 'Registration failed'
if (res.status === 429 && data.retryAfterSec) msg += ` (${data.retryAfterSec}s)`
throw new Error(msg)
}
bot.value = {
id: data.id,