| Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
|
|
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.
|
|
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.
|
|
|
|
|
|
|
|
|
|
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
|
|
- 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
|
|
- 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.
|
|
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.
|
|
|
|
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.
|
|
|
|
Prevents nil dereference panics in handlers that unconditionally
access s.cfg (share, media, auth). Fail-fast at wiring time matches
project convention.
|
|
- 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
|
|
- 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|