Commit graph

1449 commits

Author SHA1 Message Date
senke
bad778ee5a [FE-PAGE-007] fe-page: Complete Track Detail page implementation
- Added comments section with CommentSection component
- Added sharing functionality with ShareDialog component
- Added version history display using TrackHistory component
- Added analytics display using TrackStatsDisplay component
- Organized content in tabs (Comments, History)
- Enhanced share button to open share dialog with token generation
- Integrated comment creation, deletion, and pagination
- Added track statistics display (views, likes, comments, downloads, play time)
2025-12-24 12:57:49 +01:00
senke
02cef0066a [FE-PAGE-006] fe-page: Complete Marketplace page implementation
- Added product browsing with pagination (page, limit, total_pages)
- Added product filtering: search, product type, price range
- Added cart functionality: add, remove, update quantity, checkout
- Created cartStore with Zustand and persistence
- Added Cart component with checkout functionality
- Enhanced ProductCard with Add to Cart button
- Added filter UI with collapsible filters panel
- Added search bar for product search
- Added pagination controls (Previous/Next)
- Updated marketplaceService to support filters and pagination
2025-12-24 12:54:20 +01:00
senke
80bb63150d [FE-PAGE-005] fe-page: Complete Chat page implementation
- Added room management: create, join, leave, delete rooms
- Added CreateRoomDialog component for creating new rooms
- Added room actions menu (leave/delete) in ChatSidebar
- Added message search functionality with MessageSearch component
- Added search bar in ChatRoom with message highlighting
- Added TypingIndicator component (placeholder for future WebSocket integration)
- Enhanced ChatSidebar with room management UI
- Enhanced ChatRoom with search and typing indicators
2025-12-24 12:51:40 +01:00
senke
902f4840d5 [FE-PAGE-004] fe-page: Complete Settings page implementation
- Added Account Settings section with password change, data export, and account deletion
- Added Playback Settings section with audio quality, volume, crossfade, and autoplay controls
- Updated SettingsTabs to include Account and Playback tabs (5 tabs total)
- Added PlaybackSettings interface to types
- Integrated account management features (password change, data export, account deletion)
- Added audio playback controls (quality selector, volume slider, crossfade slider, autoplay toggle)
2025-12-24 12:48:28 +01:00
senke
54e2f610ab [FE-PAGE-003] fe-page: Complete Profile page implementation
- Added profile completion indicator with progress bar
- Added profile completion percentage and missing fields display
- Added social links management (Twitter, Instagram, Facebook, YouTube, Website)
- Improved bio editing with Textarea component and character counter
- Added social links display when not editing
- Added location field
- Updated UpdateProfileRequest interface to include social_links
- Integrated profile completion API endpoint
2025-12-24 12:41:34 +01:00
senke
8dea08ca07 [FE-PAGE-002] fix: Correct toast hook usage 2025-12-24 12:39:26 +01:00
senke
f7d7be7c5d [FE-PAGE-002] fix: Correct Select and Toast API usage in LibraryPage 2025-12-24 12:39:11 +01:00
senke
c2b4cb8302 [FE-PAGE-002] fe-page: Complete Library page implementation
- Added filtering by genre and format with dropdown selects
- Added sorting by date, title, and popularity with order toggle
- Added bulk operations: select multiple tracks, bulk delete, bulk update
- Added bulk mode toggle with selection checkboxes
- Added batch delete and batch update API functions
- Added pagination controls
- Improved UI with filter bar and sort dropdown
- Added toast notifications for operations
- Added select all/deselect all functionality
2025-12-24 12:38:25 +01:00
senke
dea05f4968 [FE-PAGE-001] fe-page: Complete Dashboard page implementation
- Created dashboardService.ts to fetch real stats and activity from API
- Created useDashboard hook for managing dashboard data
- Updated DashboardPage to use real data instead of hardcoded values
- Added loading states and skeletons for better UX
- Made quick actions functional with navigation
- Added activity timeline with real timestamps
- Formatted numbers with K/M suffixes for readability
- Added relative time formatting using date-fns
2025-12-24 12:35:38 +01:00
senke
f6ebb9d40e [BE-SEC-014] be-sec: Implement secrets management
- Enhanced secrets management with environment-aware defaults
- Fixed RabbitMQ URL: no default credentials in production
- Added getRabbitMQURL with environment-aware logic
- Added ValidateRequiredSecrets to validate required secrets
- Added RequiredSecretKeys listing production-required secrets
- Added validation for RabbitMQ URL in production
- All secrets properly managed via environment variables
- No hardcoded secrets in production code
2025-12-24 12:30:18 +01:00
senke
1394660da3 [BE-SEC-013] be-sec: Implement audit logging for security events
- Added comprehensive audit logging methods for security events
- LogPasswordChange, LogPasswordResetRequest, LogPasswordReset
- LogTwoFactorEnabled, LogTwoFactorDisabled, LogTwoFactorVerification
- LogAccessDenied, LogRoleChange, LogAccountLocked
- LogSecurityEvent for generic security events
- Integrated audit logging in password reset handlers
- All security events logged with IP, user agent, and metadata
2025-12-24 12:27:39 +01:00
senke
0366b87d94 [BE-SEC-011] be-sec: Implement security headers
- Enhanced security headers middleware with additional headers
- Added X-Permitted-Cross-Domain-Policies: none
- Added Cross-Origin-Embedder-Policy: require-corp
- Added Cross-Origin-Opener-Policy: same-origin
- Added Cross-Origin-Resource-Policy: same-origin
- Enhanced Permissions-Policy with additional restrictions
- Enhanced CSP with frame-ancestors directive
- HSTS now only set in production (not in development)
- Updated tests to verify all new headers
2025-12-24 12:24:54 +01:00
senke
03cb70ef41 [BE-SEC-010] be-sec: Implement file upload validation
- Enhanced file validation with robust magic bytes checking
- Added validateMagicBytes to prevent file type spoofing
- Added validateAudioMagicBytes (MP3, FLAC, WAV, OGG, AAC/M4A)
- Added validateImageMagicBytes (JPEG, PNG, GIF, WebP, SVG)
- Added validateVideoMagicBytes (MP4, WebM, OGG, AVI)
- Magic bytes validation runs before MIME type validation
- Existing validations: MIME type, file size, extension, ClamAV scanning
2025-12-24 12:17:06 +01:00
senke
d3bcfd8e60 [BE-SEC-009] be-sec: Implement input sanitization
- Created comprehensive sanitization utility functions
- SanitizeInput, SanitizeText, SanitizeHTML, SanitizeURL, SanitizeEmail, SanitizeUsername
- Applied sanitization to profile handler (username, bio, names, search)
- Applied sanitization to social posts content
- Applied sanitization to comment content
- Applied sanitization to playlist titles and descriptions
- All functions prevent XSS via HTML escaping and remove dangerous URL schemes
- Removes control characters and limits input length to prevent DoS
2025-12-24 12:15:25 +01:00
senke
d2fc79d0fe [BE-SEC-008] be-sec: Implement session timeout and refresh
- Added automatic session refresh mechanism in auth middleware
- Sessions are refreshed when they reach 25% of lifetime remaining
- Refresh happens asynchronously to avoid blocking requests
- Applied to both RequireAuth and OptionalAuth middlewares
- Session timeout enforced through ValidateSession checks
2025-12-24 12:12:29 +01:00
senke
44517da6f6 [BE-SEC-007] security: Implement account lockout after failed login attempts
- Created AccountLockoutService to track failed login attempts
- Accounts are locked after 5 failed attempts within 15 minutes
- Lockout duration: 30 minutes (auto-unlock)
- Service uses Redis for persistence (fail-open if Redis unavailable)
- Integrated into AuthService Login method:
  * Check account lockout status before login
  * Record failed attempts (even for non-existent users to prevent enumeration)
  * Reset failed attempts counter on successful login
  * Auto-unlock expired accounts
- Added SetAccountLockoutService method to AuthService
- Service initialized in router when Redis is available

Phase: PHASE-4
Priority: P1
Progress: 9/267 (3.4%)
2025-12-24 12:10:41 +01:00
senke
616a0ebc9c [BE-SEC-006] security: Implement comprehensive password strength validation
- Enhanced PasswordValidator with additional security checks:
  * Maximum length validation (128 characters)
  * Common password detection (password, 123456, qwerty, etc.)
  * Repetitive pattern detection (aaaa, 1111, etc.)
  * Sequential pattern detection (1234, abcd, qwerty, etc.)
- Added ValidatePasswordChange method to ensure new password is
  sufficiently different from old password (similarity check)
- Updated PasswordService to use enhanced validator consistently
- Replaced utils.ValidatePasswordStrength with validators.PasswordValidator
- All password operations now use the same comprehensive validation rules

Phase: PHASE-4
Priority: P1
Progress: 8/267 (3.0%)
2025-12-24 12:08:03 +01:00
senke
33d1aa988c [BE-SEC-005] security: Implement rate limiting for authentication endpoints
- Applied RegisterRateLimit to POST /auth/register (3 attempts/hour)
- Applied PasswordResetRateLimit to password reset endpoints (3 attempts/hour)
- Added VerifyEmailRateLimit for POST /auth/verify-email (5 attempts/hour)
- Added ResendVerificationRateLimit for POST /auth/resend-verification (3 attempts/hour)
- Login endpoint already had rate limiting (5 attempts/15min)
- All rate limits are IP-based and use Redis for persistence
- Rate limiting disabled in test/e2e environments

Phase: PHASE-4
Priority: P1
Progress: 7/267 (2.6%)
2025-12-24 12:05:35 +01:00
senke
078e512770 [BE-SEC-004] security: Implement CSRF protection for all state-changing endpoints
- Created applyCSRFProtection helper function to apply CSRF middleware
- Applied CSRF protection to all protected routes with POST/PUT/DELETE:
  * Users routes (PUT, POST, DELETE)
  * Tracks routes (POST, PUT, DELETE)
  * Playlists routes (POST, PUT, DELETE)
  * Chat routes (POST)
  * Auth protected routes (POST logout, 2FA)
  * Roles routes (GET only, no state-changing)
  * Marketplace routes (POST)
  * Webhooks routes (POST, DELETE)
  * Comments routes (POST, DELETE)
- CSRF token endpoint (/csrf-token) remains accessible without CSRF check
- Middleware validates X-CSRF-Token header for all state-changing requests
- Protection only applies when Redis is available

Phase: PHASE-4
Priority: P1
Progress: 6/267 (2.2%)
2025-12-24 12:03:27 +01:00
senke
46fb0cc148 [BE-API-040] api: Implement user list endpoint
- Added ListUsers method to UserService with pagination and filtering
- Added ListUsers handler to ProfileHandler
- Registered GET /api/v1/users endpoint in router
- Supports filtering by role, is_active, is_verified, and search
- Supports sorting by created_at, username, email, last_login_at
- Includes pagination metadata (page, limit, total, total_pages, has_next, has_prev)

Phase: PHASE-2
Priority: P1
Progress: 5/267 (1.9%)
2025-12-24 11:59:56 +01:00
senke
58d63f2447 chore: Update BE-API-034 completion status 2025-12-24 11:57:07 +01:00
senke
b7b23ff4da [BE-API-034] be-api: Implement audit log search improvements
- Added additional filters: resource_id, ip_address, user_agent
- Added page-based pagination support in addition to offset-based
- Added CountLogs method to get total count for pagination
- Standardized SearchLogs handler to use RespondSuccess/RespondWithAppError
- Replaced c.Get with GetUserIDUUID helper
- Improved validation for query parameters
- Response includes total count, page, total_pages, and offset metadata

Phase: PHASE-2
Priority: P2
Progress: 41/267 (15.4%)
2025-12-24 11:56:57 +01:00
senke
29c81029bd chore: Update BE-API-033 completion status 2025-12-24 11:54:31 +01:00
senke
2904e7284c [BE-API-033] be-api: Implement webhook stats endpoint validation
- Standardized GetWebhookStats handler to use RespondSuccess/RespondWithAppError
- Replaced c.Get with GetUserIDUUID helper
- Handler retrieves webhook statistics via WebhookWorker.GetStats
- Handler returns queue_size, workers, and max_retries
- Handler uses standard API response format
- Added apperrors import

Phase: PHASE-2
Priority: P2
Progress: 40/267 (15.0%)
2025-12-24 11:54:22 +01:00
senke
31c71bfa89 chore: Update BE-API-032 completion status 2025-12-24 11:52:58 +01:00
senke
78a25f63f7 [BE-API-032] be-api: Implement upload stats endpoint
- Added GetUploadStats method in TrackUploadService to calculate statistics from tracks table
- Standardized GetUploadStats handler to use RespondSuccess/RespondWithAppError
- Replaced c.Get with GetUserIDUUID helper
- Handler retrieves statistics: total_uploads, total_size, audio_files, image_files, video_files
- Updated UploadHandler to include TrackUploadService dependency
- Updated router to pass TrackUploadService to UploadHandler

Phase: PHASE-2
Priority: P2
Progress: 39/267 (14.6%)
2025-12-24 11:52:49 +01:00
senke
325c496254 chore: Update BE-API-031 completion status 2025-12-24 11:48:54 +01:00
senke
d294245761 [BE-API-031] be-api: Implement session stats endpoint
- Standardized GetSessionStats handler to use RespondSuccess/RespondWithAppError
- Replaced c.Get with GetUserIDUUID helper
- Handler retrieves session statistics via SessionService.GetSessionStats
- Handler returns total_active sessions and unique_users count
- Handler uses standard API response format

Phase: PHASE-2
Priority: P2
Progress: 38/267 (14.2%)
2025-12-24 11:48:43 +01:00
senke
7724d28325 chore: Update BE-API-030 completion status 2025-12-24 11:47:25 +01:00
senke
5886fba2ec [BE-API-030] be-api: Implement session refresh endpoint validation
- Standardized RefreshSession handler to use RespondSuccess/RespondWithAppError
- Replaced c.Get with GetUserIDUUID helper
- Handler validates Authorization header and extracts Bearer token
- Handler extends session timeout to 24 hours via SessionService.RefreshSession
- Handler properly handles errors (session not found, expired, internal errors)
- Handler returns message, expires_in, and expires_at
- Handler uses standard API response format

Phase: PHASE-2
Priority: P1
Progress: 37/267 (13.9%)
2025-12-24 11:47:15 +01:00
senke
f9fde5e45b chore: Update BE-API-029 completion status 2025-12-24 11:45:41 +01:00
senke
4af22ab1c2 [BE-API-029] be-api: Implement shared track access endpoint validation
- Standardized GetSharedTrack handler to use RespondSuccess/RespondWithAppError
- Handler validates share token via TrackShareService.ValidateShareToken
- Handler retrieves track by share.TrackID
- Handler properly handles errors (share not found, expired, track not found)
- Handler returns track and share information
- Handler uses standard API response format
- Endpoint is public (no authentication required)

Phase: PHASE-2
Priority: P1
Progress: 36/267 (13.5%)
2025-12-24 11:45:27 +01:00
senke
fb31c6ceb8 chore: Update BE-API-028 completion status 2025-12-24 11:43:47 +01:00
senke
3a38b23381 [BE-API-028] be-api: Implement track share revoke endpoint validation
- Standardized RevokeShare handler to use RespondSuccess/RespondWithAppError
- Handler validates share ID and checks ownership
- Handler revokes share link via TrackShareService.RevokeShare
- Handler properly handles errors (share not found, forbidden, internal errors)
- Handler uses standard API response format

Phase: PHASE-2
Priority: P1
Progress: 35/267 (13.1%)
2025-12-24 11:43:31 +01:00
senke
0024b5320e chore: Update BE-API-027 completion status 2025-12-24 11:42:12 +01:00
senke
5bc2498744 [BE-API-027] be-api: Implement user liked tracks endpoint
- Standardized GetUserLikedTracks handler to use RespondSuccess/RespondWithAppError
- Added limit validation (max 100)
- Moved route from setupTrackRoutes to setupUserRoutes in protected group
- Handler uses existing TrackLikeService methods
- Handler returns paginated results with tracks, total, limit, and offset
- Handler uses standard API response format

Phase: PHASE-2
Priority: P1
Progress: 34/267 (12.7%)
2025-12-24 11:41:50 +01:00
senke
cabe17b1f2 chore: Update BE-API-024 completion status 2025-12-24 11:39:30 +01:00
senke
dc9e52ae7c [BE-API-024] be-api: Implement track batch operations validation
- Standardized BatchDeleteTracks and BatchUpdateTracks handlers
- Handlers use RespondSuccess and RespondWithAppError
- BatchDeleteTracks validates IDs, checks ownership, deletes in batch
- BatchUpdateTracks validates IDs and updates, checks ownership, updates in batch
- Both handlers return results with successful and failed operations
- Handlers use standard API response format

Phase: PHASE-2
Priority: P2
Progress: 33/267 (12.4%)
2025-12-24 11:39:21 +01:00
senke
f4dd60e230 chore: Update BE-API-023 completion status 2025-12-24 11:37:59 +01:00
senke
ea97662e63 [BE-API-023] be-api: Implement user completion endpoint validation
- Standardized GetProfileCompletion handler to use GetUserIDUUID
- Added validation to ensure completion percentage is between 0 and 100
- Handler already existed and was working correctly
- Endpoint returns correct completion percentage (0-100) and missing fields
- Handler uses standard API response format

Phase: PHASE-2
Priority: P1
Progress: 32/267 (12.0%)
2025-12-24 11:37:51 +01:00
senke
030905a1b2 chore: Update BE-API-022 completion status 2025-12-24 11:36:27 +01:00
senke
48734f8526 [BE-API-022] be-api: Implement avatar delete endpoint
- DeleteAvatar handler was already implemented and standardized
- Added route: DELETE /users/:userId/avatar
- Handler validates user authentication and ownership
- Handler deletes avatar file from storage and updates database
- Handler uses standard API response format

Phase: PHASE-2
Priority: P1
Progress: 31/267 (11.6%)
2025-12-24 11:36:15 +01:00
senke
e5ecaa7a3b chore: Update BE-API-021 completion status 2025-12-24 11:34:51 +01:00
senke
3afc57dfbc [BE-API-021] be-api: Implement avatar upload endpoint
- Standardized UploadAvatar handler to use RespondSuccess/RespondWithAppError
- Replaced common.GetUserIDFromContext with GetUserIDUUID
- Handler accepts both :userId and :id parameters
- Added route: POST /users/:userId/avatar
- Handler validates user authentication and ownership
- Handler uses existing ImageService methods
- Handler updates avatar URL in database

Phase: PHASE-2
Priority: P1
Progress: 30/267 (11.2%)
2025-12-24 11:34:41 +01:00
senke
a205ad44af chore: Update BE-API-020 completion status 2025-12-24 11:32:58 +01:00
senke
f75ebb5e20 [BE-API-020] be-api: Implement HLS stream info endpoint
- Added GetStreamInfo method to HLSService
- Added GetStreamInfo handler in HLSHandler
- Standardized GetStreamStatus handler to use RespondSuccess/RespondWithAppError
- Added routes: GET /tracks/:id/hls/info and GET /tracks/:id/hls/status
- GetStreamInfo returns general stream information
- GetStreamStatus returns status with processing info if applicable
- Handlers use standard API response format

Phase: PHASE-2
Priority: P1
Progress: 29/267 (10.9%)
2025-12-24 11:32:50 +01:00
senke
99edce5029 chore: Update BE-API-019 completion status 2025-12-24 11:31:13 +01:00
senke
971f9253bb [BE-API-019] be-api: Implement track play analytics endpoint
- Added RecordPlay handler in TrackHandler
- Added playbackAnalyticsService field and SetPlaybackAnalyticsService method
- Initialized PlaybackAnalyticsService in router.go
- Added route: POST /tracks/:id/play
- Handler accepts optional play_time in request body
- Handler uses existing PlaybackAnalyticsService.RecordPlayback method
- Handler uses standard API response format

Phase: PHASE-2
Priority: P1
Progress: 28/267 (10.5%)
2025-12-24 11:31:02 +01:00
senke
65062c5bbb chore: Update BE-API-018 completion status 2025-12-24 11:29:00 +01:00
senke
78862c6ee1 [BE-API-018] be-api: Implement user block/unblock endpoints
- Added BlockUser and UnblockUser methods to SocialService
- Added BlockUser and UnblockUser handlers in ProfileHandler
- Added routes: POST /users/:id/block and DELETE /users/:id/block
- Handlers use existing SocialService methods
- Includes validation to prevent users from blocking themselves
- Added IsBlocked helper method to check block status
- Handlers use standard API response format

Phase: PHASE-2
Priority: P2
Progress: 27/267 (10.1%)
2025-12-24 11:28:49 +01:00