Repository navigation
feat: plugin-backed playback, history import, and admin UX improvements - #415
drondeseries wants to merge 8 commits into
Conversation
|
Warning Review limit reached
Next review available in: 32 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR adds ChangesDynamic stream playback
Plex history and watchlist import
Plugin hosting and local installation
Plex OAuth authentication
Request-router plugin defaults
Multi-architecture Docker builds
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
internal/historyimport/service.go (1)
654-664: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winNormalize
BaseURLbefore validating it.A whitespace-only value passes Line 655, then becomes empty and reaches the repository, bypassing the required-field check.
Proposed fix
func (s *Service) CreateSource(ctx context.Context, input CreateSourceInput) (*Source, error) { + input.BaseURL = normalizeBaseURL(input.BaseURL) if input.Name == "" || input.BaseURL == "" { return nil, fmt.Errorf("name and base_url are required") } @@ - input.BaseURL = normalizeBaseURL(input.BaseURL) return s.repo.CreateSource(ctx, input) }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/historyimport/service.go` around lines 654 - 664, Update CreateSource to normalize input.BaseURL before the required-field validation, then reject it when normalization produces an empty value. Preserve the existing source-type validation and repository creation flow.
🧹 Nitpick comments (2)
internal/scanner/scanner.go (1)
2942-2943: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse
strings.EqualFoldfor consistency.For consistency with
NeedsCriticalProbeRepairinprobe_repair.go, consider usingstrings.EqualFoldto check the file extension. This is more idiomatic and avoids the temporary allocation created bystrings.ToLower.♻️ Proposed refactor
- if strings.ToLower(filepath.Ext(filePath)) == ".strm" { + if strings.EqualFold(filepath.Ext(filePath), ".strm") { lowerPath := strings.ToLower(filePath)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/scanner/scanner.go` around lines 2942 - 2943, Update the extension check in the scanner flow to use strings.EqualFold with filepath.Ext(filePath), matching the pattern in NeedsCriticalProbeRepair and avoiding the temporary lowercased string; leave the subsequent lowerPath handling unchanged.internal/historyimport/plex_admin_provider_test.go (1)
71-93: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the resolved UUID in the GraphQL variables.
The mock currently succeeds regardless of the requested user, so the test would pass if
ResolveUserUUIDwere not propagated correctly. Decode the request body and assertvariables.user.id == "resolved-friend-uuid".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/historyimport/plex_admin_provider_test.go` around lines 71 - 93, Update the /api mock handler in the test to decode the incoming GraphQL request body and assert that variables.user.id equals "resolved-friend-uuid" before returning the watchlist response, ensuring ResolveUserUUID is propagated correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cmd/silo/main.go`:
- Around line 987-991: Update the SILO_INTERNAL_URL fallback in the main server
setup to derive the port from cfg.Server.Listen instead of hardcoding 8080,
while preserving an explicitly configured SILO_INTERNAL_URL unchanged. Use the
existing listen-address configuration and ensure the resulting fallback points
to 127.0.0.1 with the configured server port.
In `@internal/api/handlers/plugins.go`:
- Around line 675-678: Update the path validation around os.Stat in the plugin
request handler to inspect the returned FileInfo and reject paths where IsDir()
is true. Return the existing bad-request response with a clear
directory-specific message before downstream processing; preserve the current
missing-path error handling.
In `@internal/historyimport/matcher.go`:
- Line 184: Update the no-match warning near MatchMediaByTitleYear to report
cleanedTitle and cleanedYear instead of the original title and year values, so
the reason reflects the normalized lookup inputs.
In `@internal/historyimport/plex_client.go`:
- Around line 618-622: The watchlist pagination loop must stop when Plex reports
an empty or repeated cursor, even if HasNextPage is true. In the loop around
gqlResp.Data.UserV2.Watchlist.PageInfo, validate EndCursor before assigning
afterCursor: break when it is empty or equals the previously requested cursor,
otherwise preserve the existing cursor update and continue pagination.
- Around line 544-586: Update the GraphQL pagination flow around the local
gqlResp declaration to call c.doJSON instead of c.httpClient.Do, preserving the
existing request and response-status/error handling semantics. Remove the direct
response body close and decoder usage, and pass the request plus gqlResp through
doJSON so each page is rate-limited and its response is closed promptly.
In `@internal/playback/directplay.go`:
- Around line 55-69: Update the `.strm` handling in the direct-play flow to
reuse `resolveTranscodeInputPath` from `transcode.go` instead of reading and
trimming the file directly. Preserve the existing error responses and redirect
behavior while propagating the helper’s size and URL validation outcomes,
including empty or invalid inputs.
In `@web/src/pages/AdminHistoryImport.tsx`:
- Around line 175-269: Update triggerOAuth and its polling lifecycle to use
sequential polling with an attempt/generation guard, so an in-flight
checkPlexPin result cannot call onSuccess after cancellation, timeout, unmount,
or source/mode changes. Invalidate the active generation and clear the
interval/popup in cancelOAuth, the unmount cleanup, and timeout handling; also
invoke cancellation whenever either mode transitions away from "oauth",
including the Paste token flow.
---
Outside diff comments:
In `@internal/historyimport/service.go`:
- Around line 654-664: Update CreateSource to normalize input.BaseURL before the
required-field validation, then reject it when normalization produces an empty
value. Preserve the existing source-type validation and repository creation
flow.
---
Nitpick comments:
In `@internal/historyimport/plex_admin_provider_test.go`:
- Around line 71-93: Update the /api mock handler in the test to decode the
incoming GraphQL request body and assert that variables.user.id equals
"resolved-friend-uuid" before returning the watchlist response, ensuring
ResolveUserUUID is propagated correctly.
In `@internal/scanner/scanner.go`:
- Around line 2942-2943: Update the extension check in the scanner flow to use
strings.EqualFold with filepath.Ext(filePath), matching the pattern in
NeedsCriticalProbeRepair and avoiding the temporary lowercased string; leave the
subsequent lowerPath handling unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 3476570c-cf2b-40bd-80e2-7a23633f0483
📒 Files selected for processing (35)
.github/workflows/docker.ymlcmd/silo/main.gointernal/api/handlers/filesystem.gointernal/api/handlers/playback_v3.gointernal/api/handlers/playback_v3_test.gointernal/api/handlers/plugins.gointernal/api/router.gointernal/historyimport/matcher.gointernal/historyimport/matcher_test.gointernal/historyimport/plex_admin_provider.gointernal/historyimport/plex_admin_provider_test.gointernal/historyimport/plex_client.gointernal/historyimport/service.gointernal/playback/directplay.gointernal/playback/plan_v3.gointernal/playback/protocol_v3_test.gointernal/playback/strm_test.gointernal/playback/transcode.gointernal/playback/transcode_manager.gointernal/playback/transcode_manifest_test.gointernal/pluginhost/host.gointernal/pluginhost/runtime_host_server.gointernal/pluginhost/runtime_host_server_test.gointernal/scanner/probe_repair.gointernal/scanner/probe_repair_strm_test.gointernal/scanner/scanner.goweb/src/api/types.tsweb/src/components/FolderBrowser.tsxweb/src/components/admin/plugins/PluginConfigForm.test.tsxweb/src/components/admin/plugins/PluginConfigForm.tsxweb/src/components/admin/plugins/SchemaForm.tsxweb/src/hooks/queries/admin/plugins.tsweb/src/pages/AdminHistoryImport.tsxweb/src/pages/AdminPlugins.tsxweb/src/pages/AdminRequests.tsx
💤 Files with no reviewable changes (1)
- internal/playback/transcode_manager.go
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cmd/silo/main.go`:
- Around line 129-145: Update internalBaseURLFromListen to validate the
extracted port as numeric and within a usable nonzero range, rejecting :0 and
malformed inputs instead of constructing an invalid URL. Preserve valid handling
for :8080 and [::]:1234, define the existing fallback or error behavior for
invalid listens, and add coverage for all four cases.
In `@internal/playback/directplay.go`:
- Around line 56-62: Update the error handling after resolveTranscodeInputPath
in the direct-play flow to use errors.Is(err, os.ErrNotExist) and return HTTP
404 for missing files, including wrapped .strm errors. For other errors, keep
the existing shortcut-specific 500 classification but send a generic client-safe
message instead of err.Error(), preventing absolute paths from being exposed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f34ca5d8-39e4-449b-b662-3ba3aa48c6df
📒 Files selected for processing (9)
cmd/silo/main.gointernal/api/handlers/plugins.gointernal/historyimport/matcher.gointernal/historyimport/plex_admin_provider_test.gointernal/historyimport/plex_client.gointernal/historyimport/service.gointernal/playback/directplay.gointernal/playback/directplay_test.gointernal/scanner/scanner.go
🚧 Files skipped from review as they are similar to previous changes (6)
- internal/api/handlers/plugins.go
- internal/historyimport/plex_admin_provider_test.go
- internal/scanner/scanner.go
- internal/historyimport/service.go
- internal/historyimport/matcher.go
- internal/historyimport/plex_client.go
Summary
This PR rolls up the current
mainbranch on top ofupstream/main.What changed
.strm/ aiostream-style shortcut support so those files are discovered and resolved through scanner, playback planning, and transcode input handling.Benefits
.strmshortcut files now flow through the normal media pipeline instead of relying on separate handling.Testing
mainstate.Notes
main.Summary by CodeRabbit
New Features
.strmmedia files, including scanning, direct playback redirects, and adaptive HLS transcoding.Bug Fixes