Skip to content

feat: Redis rate limits + streaming paste upload - #64

Merged
ArianAr merged 1 commit into
mainfrom
feat/32-33-redis-streaming
Jul 15, 2026
Merged

feat: Redis rate limits + streaming paste upload#64
ArianAr merged 1 commit into
mainfrom
feat/32-33-redis-streaming

Conversation

@ArianAr

@ArianAr ArianAr commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Summary

Implements v1.3.1 / #32 and v1.3.3 / #33.

Redis rate limits

  • REDIS_URL → shared fixed-window counters (papercut:rl:*)
  • Falls back to in-memory sliding window if unset or Redis errors
  • checkRateLimit(scope, key) used by create + unlock

Streaming upload

  • POST /api/pastes with text/plain or application/octet-stream
  • Optional headers: X-PaperCut-Expire, X-PaperCut-Password
  • Size-capped streaming read (MAX_PASTE_SIZE)
  • CLI streams stdin (no JSON stringify of entire log)

Test plan

  • Server unit + integration (incl. text/plain create, rate limit mock)
  • CLI upload tests (JSON + stream headers)
  • typecheck + lint

Closes #32
Closes #33

Optional REDIS_URL for multi-node fixed-window rate limits (memory
fallback). API accepts text/plain bodies with size-capped stream read;
CLI streams stdin with X-PaperCut-* headers.

Closes #32
Closes #33
@ArianAr ArianAr added enhancement New feature or request area:cli CLI client (/cli) area:server Next.js server / API labels Jul 15, 2026

@ArianAr ArianAr left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

Summary: Practical multi-node RL via optional Redis with safe fallback. Streaming path avoids huge JSON bodies; size limit enforced while reading. CLI duplex stream usage matches Node undici requirements. Password header only for CLI private path (already env-based).

Verdict: LGTM once CI green.

@ArianAr
ArianAr merged commit 3b75bef into main Jul 15, 2026
9 of 10 checks passed
@ArianAr
ArianAr deleted the feat/32-33-redis-streaming branch July 15, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:cli CLI client (/cli) area:server Next.js server / API enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streaming / chunked upload for large stdin Optional Redis-backed rate limiting for multi-node

1 participant