Skip to content

feat: plugin-backed playback, history import, and admin UX improvements - #415

Closed
drondeseries wants to merge 8 commits into
Silo-Server:mainfrom
drondeseries:pr/upstream-main-20260716
Closed

drondeseries wants to merge 8 commits into
Silo-Server:mainfrom
drondeseries:pr/upstream-main-20260716

Conversation

@drondeseries

@drondeseries drondeseries commented Jul 16, 2026 •

Copy link
Copy Markdown

Summary

This PR rolls up the current main branch on top of upstream/main.

What changed

  • Added plugin-backed dynamic stream playback so the server can delegate stream selection and playback planning to enabled plugins.
  • Added .strm / aiostream-style shortcut support so those files are discovered and resolved through scanner, playback planning, and transcode input handling.
  • Added request-integration autofill from plugins, reducing manual admin setup.
  • Fixed saved multi-select values in the plugin admin form so selections persist reliably.
  • Added paginated GraphQL watchlist sync and Plex OAuth support in the history import admin UI.
  • Updated CI to publish multi-arch GHCR images.

Benefits

  • Less manual configuration for admins and fewer opportunities for drift.
  • .strm shortcut files now flow through the normal media pipeline instead of relying on separate handling.
  • More flexible playback routing through plugins, which is the foundation for broader plugin-driven playback behavior.
  • Better import coverage and a smoother admin onboarding flow for Plex-connected history imports.
  • Broader container compatibility from multi-arch image publishing.

Testing

  • Not re-run in this session; the branch is a clean fast-forward of the existing local main state.

Notes

  • This is a grouped PR covering the current unpublished work on main.
  • No manual migration steps are expected.

Summary by CodeRabbit

  • New Features

    • Added support for .strm media files, including scanning, direct playback redirects, and adaptive HLS transcoding.
    • Added Plex watchlist history importing, including friend watchlists and graceful warning handling.
    • Added server-path plugin ZIP installation with filesystem browsing.
    • Added Plex OAuth sign-in for history imports.
    • Added filesystem browsing indicators and ZIP file selection.
    • Added support for multi-select plugin configuration defaults and automatic integration defaults.
  • Bug Fixes

    • Corrected subtitle-off playback handling.
    • Improved title matching when years appear in titles.
    • Prevented clean transcoder exits from being treated as crashes.
    • Extended container builds to support ARM64.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@drondeseries, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 32 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 745fe0f1-10f3-4940-a0af-501090ee1161

📥 Commits

Reviewing files that changed from the base of the PR and between e50c04a and 8e14f88.

📒 Files selected for processing (5)
  • cmd/silo/main.go
  • cmd/silo/main_internal_url_test.go
  • internal/playback/directplay.go
  • internal/playback/directplay_test.go
  • web/src/pages/AdminHistoryImport.tsx
📝 Walkthrough

Walkthrough

This PR adds .strm dynamic-stream support, Plex watchlist importing and OAuth, server-path plugin installation, plugin callback URLs, filesystem browsing metadata, request-router defaults, and multi-architecture Docker builds.

Changes

Dynamic stream playback

Layer / File(s) Summary
Dynamic stream discovery and probe handling
internal/scanner/*
.strm files are recognized as video inputs, receive synthetic probe metadata, and skip critical probe repair.
Dynamic stream planning and execution
internal/playback/*
Playback creates conservative HLS plans, resolves validated HTTP(S) shortcuts, redirects direct play, waits longer for startup segments, and avoids crash callbacks after clean FFmpeg exits.
Subtitle-off remapping
internal/api/handlers/playback_v3.go, internal/api/handlers/playback_v3_test.go
Negative subtitle indexes clear subtitle identity.

Plex history and watchlist import

Layer / File(s) Summary
Title and source normalization
internal/historyimport/matcher.go, internal/historyimport/service.go, internal/historyimport/*_test.go
Matching cleans trailing title years, and source URLs are normalized on create and update.
Plex account and watchlist flows
internal/historyimport/plex_client.go, internal/historyimport/plex_admin_provider.go, internal/historyimport/*_test.go
Plex UUID resolution is cached, watchlists are fetched and normalized, and failures become warnings.

Plugin hosting and local installation

Layer / File(s) Summary
Plugin host URL propagation
cmd/silo/main.go, internal/pluginhost/*
Public and internal URLs configure plugin hosting, runtime configuration includes installation-scoped proxy URLs, and host information exposes them.
Server-path plugin installation
internal/api/handlers/plugins.go, internal/api/router.go, web/src/hooks/queries/admin/plugins.ts, web/src/pages/AdminPlugins.tsx
Administrators can install an existing server-side plugin archive through a validated API and web form.
Plugin path browsing and configuration values
internal/api/handlers/filesystem.go, web/src/api/types.ts, web/src/components/FolderBrowser.tsx, web/src/components/admin/plugins/*
Filesystem entries expose directory status, archive files can be selected, path fields can open a browser, and array configuration values are preserved.

Plex OAuth authentication

Layer / File(s) Summary
OAuth lifecycle and dialogs
web/src/pages/AdminHistoryImport.tsx
Plex source and token dialogs use PIN-based popup OAuth with polling, cancellation, cleanup, error display, and pending-state handling.

Request-router plugin defaults

Layer / File(s) Summary
Default derivation and application
web/src/pages/AdminRequests.tsx
Plugin global configuration supplies connection defaults, which populate empty fields and replace values when switching plugins.

Multi-architecture Docker builds

Layer / File(s) Summary
Docker workflow
.github/workflows/docker.yml
Docker builds run on ubuntu-latest, configure ARM64 QEMU, and target Linux AMD64 and ARM64.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

Suggested labels: v1

Suggested reviewers: quick104

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main themes of the PR: plugin-backed playback, history import, and admin UX improvements.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the v1.0 Silo v1 scope - auto-adds to the Silo v1 project label Jul 16, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Normalize BaseURL before 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 value

Use strings.EqualFold for consistency.

For consistency with NeedsCriticalProbeRepair in probe_repair.go, consider using strings.EqualFold to check the file extension. This is more idiomatic and avoids the temporary allocation created by strings.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 win

Assert the resolved UUID in the GraphQL variables.

The mock currently succeeds regardless of the requested user, so the test would pass if ResolveUserUUID were not propagated correctly. Decode the request body and assert variables.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

📥 Commits

Reviewing files that changed from the base of the PR and between c36d70d and 31b7173.

📒 Files selected for processing (35)
  • .github/workflows/docker.yml
  • cmd/silo/main.go
  • internal/api/handlers/filesystem.go
  • internal/api/handlers/playback_v3.go
  • internal/api/handlers/playback_v3_test.go
  • internal/api/handlers/plugins.go
  • internal/api/router.go
  • internal/historyimport/matcher.go
  • internal/historyimport/matcher_test.go
  • internal/historyimport/plex_admin_provider.go
  • internal/historyimport/plex_admin_provider_test.go
  • internal/historyimport/plex_client.go
  • internal/historyimport/service.go
  • internal/playback/directplay.go
  • internal/playback/plan_v3.go
  • internal/playback/protocol_v3_test.go
  • internal/playback/strm_test.go
  • internal/playback/transcode.go
  • internal/playback/transcode_manager.go
  • internal/playback/transcode_manifest_test.go
  • internal/pluginhost/host.go
  • internal/pluginhost/runtime_host_server.go
  • internal/pluginhost/runtime_host_server_test.go
  • internal/scanner/probe_repair.go
  • internal/scanner/probe_repair_strm_test.go
  • internal/scanner/scanner.go
  • web/src/api/types.ts
  • web/src/components/FolderBrowser.tsx
  • web/src/components/admin/plugins/PluginConfigForm.test.tsx
  • web/src/components/admin/plugins/PluginConfigForm.tsx
  • web/src/components/admin/plugins/SchemaForm.tsx
  • web/src/hooks/queries/admin/plugins.ts
  • web/src/pages/AdminHistoryImport.tsx
  • web/src/pages/AdminPlugins.tsx
  • web/src/pages/AdminRequests.tsx
💤 Files with no reviewable changes (1)
  • internal/playback/transcode_manager.go

Comment thread cmd/silo/main.go Resolved
Comment thread internal/api/handlers/plugins.go Resolved
Comment thread internal/historyimport/matcher.go Resolved
Comment thread internal/historyimport/plex_client.go Resolved
Comment thread internal/historyimport/plex_client.go Resolved
Comment thread internal/playback/directplay.go Resolved
Comment thread web/src/pages/AdminHistoryImport.tsx Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 31b7173 and e50c04a.

📒 Files selected for processing (9)
  • cmd/silo/main.go
  • internal/api/handlers/plugins.go
  • internal/historyimport/matcher.go
  • internal/historyimport/plex_admin_provider_test.go
  • internal/historyimport/plex_client.go
  • internal/historyimport/service.go
  • internal/playback/directplay.go
  • internal/playback/directplay_test.go
  • internal/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

Comment thread cmd/silo/main.go Resolved
Comment thread internal/playback/directplay.go Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1.0 Silo v1 scope - auto-adds to the Silo v1 project

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants