Skip to content

v1.0.5

Latest

Choose a tag to compare

@dhannyjsb dhannyjsb released this 10 Dec 03:15
3de40f1

πŸ”’ Advanced Duplicate Prevention System

✨ Fitur Baru

  • Multi-Layer Subdomain Validation
    • Backend Database Check: Prevent subdomain conflicts antar device
    • Cloudflare DNS Check: Detect existing DNS records dengan smart caching
    • Local Duplicate Check: Validate dalam mapping yang sama
    • Pre-validation sebelum kirim ke API (prevent unnecessary API calls)
  • Smart DNS Record Caching System
    • DNS records cache dengan 30 detik TTL
    • Reduced API calls hingga 90%+ (rate limit protection)
    • Automatic cache invalidation setelah create/delete operations
    • Fallback ke stale cache saat API error
    • Optimized untuk Cloudflare API rate limits (1200 req/5min)
  • Transaction Rollback Mechanism
    • Automatic rollback jika DNS record creation gagal
    • State management dengan optimistic updates
    • Error collection untuk multiple mapping failures
    • Clean state restoration pada failure

🎨 UI/UX Improvements

  • Enhanced Error Messages
    • Display full hostname (subdomain + domain) dalam error messages
    • Specific error source indicators:
      • ⚠️ Subdomain "app.domain.com" sudah digunakan oleh device lain!
      • ⚠️ Subdomain "app.domain.com" sudah terdaftar di Cloudflare DNS!
    • Real-time validation feedback dengan loading indicator
    • Clear distinction antara backend dan DNS conflicts
  • Visual Feedback System
    • πŸ” Checking subdomain availability... loading state
    • Error messages dengan emoji indicators untuk quick recognition
    • Color-coded status badges di mapping table
    • Informative error messages dengan actionable suggestions

πŸ”§ Technical Improvements

  • DNS Record Detection Enhancement
    // Get ALL records dengan smart filtering
    - Case-insensitive hostname matching
    - Multiple match strategies (exact, prefix, suffix)
    - Support subdomain-only dan full hostname searches
    - Reduced per_page from 5000 β†’ 100 (optimized)
  • Validation Flow Optimization
    1. Local duplicate check (instant)
    2. Backend database check (JWT authenticated)
    3. Cloudflare DNS check (cached, 30s TTL)
    4. ABORT if ANY check fails
    5. Proceed to API calls only if ALL checks pass
    
  • Error Handling Strategy
    • Changed from optimistic (allow on error) to pessimistic (block on error)
    • DNS record creation MUST succeed for ALL mappings
    • Transaction-like behavior dengan complete rollback
    • Better error propagation ke user interface

πŸ› Bug Fixes

  • Fixed getCredentials is not defined error di TunnelList component
  • Fixed duplicate device object di preload.cjs (method override issue)
  • Fixed ensureValidToken vs ensureAuthenticated method mismatch
  • Fixed DNS records not detected karena filter API parameter
  • Fixed duplicate entries ke database saat DNS creation failed
  • Fixed subdomain check tidak detect existing records

πŸ”’ Security Enhancements

  • Strict Validation Policy
    • Zero tolerance untuk duplicate subdomains
    • Multiple validation layers untuk maximum safety
    • JWT authentication untuk backend checks
    • Prevent race conditions dengan proper state management
  • Safe API Operations
    • All checks MUST pass sebelum API modifications
    • Automatic rollback mechanism untuk data integrity
    • Error boundary implementation untuk graceful failures
    • Cache invalidation untuk fresh data after mutations

πŸ“¦ Performance Optimizations

  • DNS Cache System
    • 30-second cache TTL untuk balance freshness vs performance
    • Reduced Cloudflare API calls dari N requests β†’ 1 request per 30s
    • Smart cache invalidation setelah mutations
    • Memory-efficient Map-based caching
  • API Call Reduction
    Before: 10 subdomain checks = 10 API calls (5000 records each)
    After:  10 subdomain checks = 1 API call (100 records, cached)
    Reduction: 90%+ less API calls
    

🎯 User Experience Flow

  1. Add Mapping Validation:
    User enters subdomain
      ↓
    πŸ” Checking availability...
      ↓
    Check local duplicates β†’ Check backend β†’ Check DNS
      ↓
    βœ… Available β†’ Proceed
    ❌ Taken β†’ Show detailed error with source
    
  2. Error Prevention:
    • No API calls until ALL validations pass
    • Clear error messages dengan full hostname
    • Actionable feedback (pilih subdomain lain)
    • State preserved untuk easy retry
  3. Transaction Safety:
    • DNS creation errors β†’ Rollback state
    • Form data preserved on error
    • Clear indication of what failed
    • No partial updates di database

πŸ’‘ Benefits

βœ… Zero Duplicate Risk: Multi-layer validation prevents all conflicts
βœ… Rate Limit Safe: Smart caching protects against API limits
βœ… Better UX: Clear error messages dengan full context
βœ… Data Integrity: Transaction rollback prevents partial updates
βœ… Performance: 90%+ reduction dalam API calls
βœ… Developer Friendly: Enhanced logging untuk debugging
βœ… Production Ready: Pessimistic error handling untuk stability