summaryrefslogtreecommitdiff
path: root/internal
AgeCommit message (Collapse)Author
2026-05-17Restructure repo: move Go server into player-server/Paul Buetow
2026-05-17Fix in-progress media thresholdPaul Buetow
2026-05-17Add progress status API routesPaul Buetow
2026-05-17Add progress service completion methodsPaul Buetow
2026-05-17Add playback repository cleanup queriesPaul Buetow
2026-05-17Add finished flag to playback progressPaul Buetow
2026-05-16Configure SQLite for NFS-backed deploymentsPaul Buetow
2026-05-16Migrate stale sets schema for podcastsPaul Buetow
2026-05-10refactor: move ServeHTTP above unexported helpers for public-method orderingPaul Buetow
2026-05-10Decompose podcastService (SRP): split subscription, episode, and ↵Paul Buetow
feed-checker into sub-services Extract three role-focused sub-services from the monolithic podcastService: - podcast_sub.go: podcastSubscriptionService handles SubscribeFeed, ListFeeds, EditFeed, UnsubscribeFeed and podcast set lifecycle. - podcast_episode.go: podcastEpisodeService handles ListEpisodes, DownloadEpisode, ToggleEpisodeComplete and enclosure downloading. - podcast_checker.go: podcastFeedChecker handles CheckFeeds, conditional GET, backoff and episode upserting. - podcast_helpers.go: shared helpers (podcastFolderName, sanitizeSetName, sanitizeFilename). podcast.go becomes a thin composite that embeds the three sub-services and exposes a PodcastEpisodeService-compatible interface, preserving existing API-layer wiring and tests.
2026-05-10Move self-deletion guard from handler into AdminService (DeleteUser) to fix ↵Paul Buetow
SoC violation - Add ErrCannotDeleteSelf sentinel error in service layer. - Change DeleteUser signature to (ctx, callerID, id) across all layers. - Move self-deletion guard from handleDeleteUser handler into userAdminService.DeleteUser. - Update handleError to map ErrCannotDeleteSelf to 400 BadRequest. - Adjust all affected tests to use the new signature.
2026-05-10refactor(service,scanner): return concrete types from constructorsPaul Buetow
Apply the Go best-practice convention 'accept interfaces, return concrete types' across the service and scanner packages: - NewBrowseService -> *browseService - NewWriteService -> *writeService - NewMediaStreamer -> *mediaStreamer - NewFSScanner -> *FSScanner - NewFSScannerWithLogger -> *FSScanner - NewPodcastBrowseService -> *podcastBrowseService - NewTagService -> *tagService - NewShareService -> *shareService - NewProgressService -> *progressService - NewAdminService -> *adminService - NewAdminServiceWithLogger -> *adminService - NewAuthService -> *authService - NewNoteService -> *noteService - NewFavService -> *favService - NewMediaService -> *mediaService - NewMediaServiceWithPodcastBrowser -> *mediaService Callers continue to work unchanged because Go allows assigning a concrete type to an interface variable. All tests pass with -race -cover.
2026-05-10fix(browse): return ErrNotFound when set cover is missingPaul Buetow
GetSetCover was returning a stale os.Stat wrapped error when no thumbnail candidate was found (line 465), and was not translating os.IsNotExist to ErrNotFound when the candidate thumbnail was missing (line 468). Both cases now return service.ErrNotFound so the caller/handler can respond with 404 instead of 500.
2026-05-10api: reject id==0 in handleDeleteUser to avoid 200 OK for invalid pathPaul Buetow
2026-05-10internal/service: stop swallowing CreateEpisode errors in ↵Paul Buetow
insertPodcastEpisodes and upsertFeedEpisodes - insertPodcastEpisodes now returns an error when CreateEpisode fails so callers (e.g. SubscribeFeed) can log it instead of silently dropping episodes. - upsertFeedEpisodes now logs per-episode lookup/insert failures, collects the failed GUIDs, and returns a summary error so the background CheckFeeds caller can log a warning while continuing to process the rest of the feed. All tests pass with -race -cover.
2026-05-10podcast: propagate UpdateFeed error on 304 Not Modified pathPaul Buetow
Previously checkFeed silently discarded the DB update error when a feed returned 304 Not Modified. If the update failed, LastCheckedAt was not persisted, causing the next background check to re-fetch the same unchanged feed unnecessarily. Now the error is propagated back to CheckFeeds so it is logged like any other feed-check failure.
2026-05-10player: log downloadCover errors in podcast subscribe and feed checkPaul Buetow
2026-05-10refactor(api): replace all writeJSON 500 error patterns with handleError helperPaul Buetow
2026-05-10fix(tests): handle json.Unmarshal errors explicitly in *_test.goPaul Buetow
2026-05-10Add compile-time interface assertions for FFProber, FFmpegGenerator, FFRemuxerPaul Buetow
2026-05-10internal/service: fix ListEpisodes global pagination by using cross-feed SQL ↵Paul Buetow
query Previously ListEpisodes requested per-feed episodes with the full limit from every feed, concatenated them, and then sliced the resulting slice in memory. This silently skipped episodes from deeper pages because the per-feed DB limit never returned them. Fix: Add a new repository method ListEpisodesByFeedIDsWithStatus that takes a slice of feed IDs and applies LIMIT/OFFSET globally in a single SQL query (IN (...)). The service builds the feed ID list and delegates pagination to the database instead of emulating it in memory. Files changed: - internal/repository/podcast.go: add ListEpisodesByFeedIDsWithStatus - internal/repository/podcast_repo.go: extend PodcastRepo interface - internal/repository/mock.go: add mock implementation - internal/service/podcast.go: replace per-feed loop with new method - internal/service/podcast_test.go: add tests for ListEpisodes - internal/repository/podcast_test.go: add integration tests for new repo method - internal/api/handlers_test.go: add mockPingStore method
2026-05-10Add circuit breaker / backoff for failing podcast feeds in CheckFeedsPaul Buetow
- DB: add consecutive_failures and next_check_at to podcast_feeds - model: add ConsecutiveFailures and NextCheckAt to PodcastFeed struct - repository: update CRUD queries to handle new columns and ListFeedsNeedingCheck to skip feeds with future next_check_at - service: update CheckFeeds to use new query, update checkFeed to reset counters on success and increment exponential backoff on failure - tests: adapt mock signatures, add backoff integration test
2026-05-10fix: close destination file and clean up partial copies in copyFilePaul Buetow
- Add defer out.Close() after os.Create in copyFile to prevent fd leak. - Remove redundant explicit out.Close() calls in error and success paths. - Best-effort remove partially written destination file on io.Copy error.
2026-05-10internal/service: swap GC hard-delete orderingPaul Buetow
Remove the media file from disk before deleting the DB row so that a failed os.Remove doesn't create an orphaned file. If the file is already missing (os.IsNotExist), proceed with the DB deletion. Other removal errors abort the iteration for that item. Also update the existing ordering test to assert removal happens before HardDeleteMedia, and add a test covering the file-remove-failure short-circuit.
2026-05-10internal/repository: use placeholders for LIMIT and OFFSET in ListMediaPaul Buetow
2026-05-10Decouple podcast browse logic from BrowseSet via PodcastBrowser interfacePaul Buetow
Extract PodcastBrowser interface and podcastBrowseService implementation to move podcast-specific grid augmentation out of browseService.BrowseSet. - Remove PodcastRepo from BrowseServiceStore and MediaServiceStore. - browseService now delegates podcast set augmentation to an injected PodcastBrowser strategy (kept optional/nil-safe). - Add NewMediaServiceWithPodcastBrowser to wire a real PodcastBrowser (backed by PodcastRepo) in production while keeping the plain NewMediaService for existing callers/tests. - Update main.go to instantiate NewPodcastBrowseService and inject it. - Update browse_test.go to test PodcastBrowser-augmented paths through the new constructor signature. This keeps BrowseSet focused on files and folders only and removes the podcast dependency from the browse contract.
2026-05-09style: gofmt and goimports formatting fixesPaul Buetow
2026-05-09internal/api: panic early in NewServerWithLogger if Config is nilPaul Buetow
Prevents nil dereference panics in handlers that unconditionally access s.cfg (share, media, auth). Fail-fast at wiring time matches project convention.
2026-05-09Extract SessionManager interface to fix DIP violationPaul Buetow
- Introduce auth.SessionManager interface in internal/auth/interfaces.go - Rename concrete struct to sessionManager (unexported) and have it satisfy interface - Update api/service layers to depend on interface, not concrete type - Add MockSessionManager for testing - Update all call sites and tests to use interface
2026-05-09Harden external process and network callsPaul Buetow
- Add cmd.WaitDelay (10-15s) to ffprobe, ffmpeg remux, and thumbnail generation. - Add bounded retries with exponential backoff to FFProber.Probe (max 3 attempts). - Inject *http.Client into podcast ParseFeed, replacing gofeed's default client. - Update all callers (podcast service, tests, integration tests) to pass client. - Ensure go test ./... -race -cover passes.
2026-05-09Handle background worker panics for task 42Paul Buetow
2026-05-09more on thisPaul Buetow
2026-05-09t1: remove repository migration shimPaul Buetow
2026-05-09s1 fix immediate scan progress statePaul Buetow
2026-05-09s1 add media rescan hotkey and progress indicatorPaul Buetow
2026-05-09Refine media browsing and set coversPaul Buetow
2026-05-07k1 avoid duplicate downloaded podcast episodesPaul Buetow
2026-05-07Fix podcast browser workflows for k1Paul Buetow
2026-05-07i1 omit empty share thumbnail URLPaul Buetow
2026-05-07Fix missing share thumbnails for i1Paul Buetow
2026-05-07j1 fix admin media lifecycle QA defectsPaul Buetow
2026-05-07Fix PWA static routes for browser smoke test g1Paul Buetow
2026-05-07Fix upload multipart memory budget for t0Paul Buetow
2026-05-07Fix static file read seeker guard for s0Paul Buetow
2026-05-07Fix scan cancellation progress error for q0Paul Buetow
2026-05-07Fix remux error propagation for task o0Paul Buetow
2026-05-07Task 51: add API error helpersPaul Buetow
2026-05-07task 31: introduce media streamer servicePaul Buetow
2026-05-07Task 21: move thumbnail regeneration to write servicePaul Buetow
2026-05-07Refactor API server dependencies for task 11Paul Buetow