- Change cookie SameSite policy from Strict to Lax (Strict blocks media subresources on mobile)
- Decouple Secure cookie flag from APP_ENV:
- Add SECURE_COOKIES config (defaults to true in prod, but can be overridden)
- Allows testing production builds over HTTP (home network)
- Increase gocyclo threshold to 25 to accommodate complex handlers
- Fix refresh token cookie Secure flag bug (was hardcoded to false)
- Wire up AllowedOrigins config in CORS middleware (router, handlers, chat, SSE)
- Add APP_ENV=production to Dockerfile and Dockerfile.cuda
- Update all docker-compose files with APP_ENV and ALLOWED_ORIGINS examples
- CORS now validates origins in production, allows all in development
- Increase gocyclo threshold from 20 to 25 for complex handlers
Phase 5: Refactor queue.go (10 DB calls removed)
- Added JobRepository to TaskQueue struct and constructor
- Added UpdateStatus, UpdateError, FindByStatus, CountByStatus methods to JobRepository
- Replaced all database.DB calls with repository methods
Phase 6: Refactor chat_handlers.go and summarize_handlers.go (6 DB calls removed)
- Added GetMessageCountsBySessionIDs and GetLastMessagesBySessionIDs to ChatRepository
- Added UpdateSummary to JobRepository
- Replaced batch queries and update calls with repository methods
- Removed database import from both files
Phase 7: Refactor quick_transcription.go (3 DB calls removed)
- Added JobRepository injection to QuickTranscriptionService
- Updated constructor and all callers
Summary: 46+ database.DB calls replaced with repository methods across 7 phases.
All tests pass, build succeeds.
Phase 1: Define interfaces
- Created internal/interfaces/ package with AuthServiceInterface, TaskQueueInterface, JobProcessorInterface
Phase 2: Refactor handlers.go (21 DB calls removed)
- Replaced all database.DB calls with repository methods
- Added RefreshTokenRepository for token management
- Added new repository methods: Count, FindActiveTrackJobs, FindLatestCompletedExecution, FindByName
Phase 3: Refactor dropzone.go (3 DB calls removed)
- Added CountWithAutoTranscription to UserRepository
- Injected JobRepository and UserRepository into Service
Phase 4: Refactor multitrack_processor.go
- Changed constructor to accept *gorm.DB and JobRepository
- Updated Handler to inject MultiTrackProcessor
Updated all test files with new dependencies and mock implementations.
- Implemented strict separation between 'pending' (queued) and 'uploaded' (waiting) states
- Added queue position indicator (Queue #N) for pending jobs
- Fixed React hook dependency bug that caused queue positions to display as #-
The jobScanner was running every 10 seconds and re-enqueueing jobs that
were already in the queue but hadn't started processing yet. This caused
completed files to be re-transcribed when auto-transcribe was enabled.
Changes:
- Removed jobScanner goroutine (10-second polling loop)
- Removed scanPendingJobs function
- Added recoverPendingJobs that runs ONCE at startup to recover
any pending jobs left from previous server runs
- Jobs are now only enqueued when explicitly requested:
- Upload with auto-transcribe enabled
- Manual transcription start
- Server restart recovery (one-time)
- Created WandAdvancedIcon component (Wand2 with + badge)
- Updated AudioFilesTable to use new icon for 'Transcribe (Advanced)'
- Updated SwipeableItem to use new icon in mobile swipe actions
- Makes it clear advanced transcribe is related to regular transcribe
- Created GlobalUploadContext for global upload functionality
- Header now uses context when props not provided
- Upload from Settings/AudioDetail shows toast notifications
- Upload from Dashboard shows progress bar
- All add button options (Quick Transcribe, YouTube, Record, etc.) work everywhere
- Added backdrop-blur-sm to Dialog and AlertDialog overlays
- Fixed dialog flash bug by setting modal default to true