Refactor auth router and add performance optimizations #15

Merged
jimmy merged 2 commits from dev into main 2026-03-01 22:25:15 +08:00
Owner

Changes

Refactoring

  • Split 429-line auth.py into 3 focused modules
  • All 21 endpoints maintain backward compatibility

Performance Improvements

  • Add GZip compression middleware (70% bandwidth reduction)
  • Cache static assets with immutable headers
  • Remove 500ms blocking CPU interval

Impact

  • Better code organization
  • Significantly faster dashboard load over public network
  • No breaking changes
## Changes ### Refactoring - Split 429-line auth.py into 3 focused modules - All 21 endpoints maintain backward compatibility ### Performance Improvements - Add GZip compression middleware (70% bandwidth reduction) - Cache static assets with immutable headers - Remove 500ms blocking CPU interval ## Impact - Better code organization - Significantly faster dashboard load over public network - No breaking changes
jimmy added 2 commits 2026-03-01 22:24:52 +08:00
refactor: split auth router into focused modules
Deploy Dashboard (Dev) / deploy-dev (push) Has been cancelled
ae437db92e
Split the 429-line auth.py into three modules for better maintainability:
- auth.py (264 lines): core auth, login, token refresh, RBAC, preferences
- passkey.py (187 lines): WebAuthn passkey registration and authentication
- totp.py (41 lines): TOTP 2FA setup and verification

All 21 endpoints maintain backward compatibility under /api/auth prefix.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
perf: add compression and caching for faster public access
Deploy Dashboard (Dev) / deploy-dev (push) Successful in 2m20s
50e1d779de
Optimizations to reduce latency over Tailscale tunnel:
- Add GZip middleware for 70% bandwidth reduction (480KB → ~150KB)
- Cache static assets with immutable headers (1 year)
- Remove 500ms blocking CPU interval in system stats

These changes significantly improve dashboard load time over public network.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jimmy merged commit b0b54b2ebb into main 2026-03-01 22:25:15 +08:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jimmy/nas-tools#15