Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/silo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2129,6 +2129,9 @@ func main() {
metadataImageCacheProcessor.SetLibraryRootResolver(deps.FolderRepo)
metadataImageCacheProcessor.SetImagePrefixDeleter(deps.Blobs.Assets)
metadataService.SetLocalArtworkCopier(metadataImageCacheProcessor)
// The admin image picker previews and applies the same local files,
// under the same confinement.
metadataService.SetLibraryRootResolver(deps.FolderRepo)
Comment on lines +2132 to +2134

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

kody code-review Bug high

metadataService.SetLibraryRootResolver is registered only inside the optional object-storage initialization block, so when deps.Blobs.Assets is nil, local sidecar discovery runs but every LocalImagePreview call fails with the missing resolver error and the admin picker silently omits local artwork even though preview reads do not require object storage. Register metadataService.SetLibraryRootResolver(deps.FolderRepo) outside the deps.Blobs.Assets conditional while keeping image caching setup conditional.

Prompt for LLM

File cmd/silo/main.go:

Line 2132 to 2134:

metadataService.SetLibraryRootResolver is registered only inside the optional object-storage initialization block, so when deps.Blobs.Assets is nil, local sidecar discovery runs but every LocalImagePreview call fails with the missing resolver error and the admin picker silently omits local artwork even though preview reads do not require object storage. Register metadataService.SetLibraryRootResolver(deps.FolderRepo) outside the deps.Blobs.Assets conditional while keeping image caching setup conditional.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

metadataService.SetAutoCacheImages(cfg.Metadata.CacheImages)
metadataImageCacheProcessor.SetEnabled(cfg.Metadata.CacheImages)
configWatcher.OnChange(func(_, updated *config.Config) {
Expand Down
21 changes: 20 additions & 1 deletion docs/admin-catalog-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -494,11 +494,30 @@ memory, and stores no server-side snapshot. Provider failures expose generic
messages. The web drains all pages under one captured authority and refuses
repeated or invalid continuation rather than publishing a partial list.

For a movie or series the list also offers its local sidecar artwork (the
`poster.jpg`, `fanart.jpg` and similar files a refresh would use), found by
Silo's own sidecar discovery whether or not the library's metadata chain uses
the NFO provider. A `file://` URL from any other provider is not offered. These
choices have `provider_id` `local`, a `file://` `original_url`, and a small
WebP preview as a `data:` URI in `url`. A file that cannot be read under the
library-root, symlink and size checks is left out, and `provider_errors`
reports the failure under `local`. Banner, thumb, clear art and disc art
sidecars, and image URLs an NFO names, are not offered. When the library's
provider chain cannot be resolved, the movie or series list still returns `200`
with its local choices and reports the failure under `chain` in
`provider_errors`; other lists return `500`. Frozen v1 lists provider choices
only. See
[Local NFO metadata](architecture/local-nfo-metadata.md#admin-image-picker).

`POST /api/v2/admin/items/{id}/images/apply` accepts `original_url`, `type`, and
optional `provider_id`. An HTTP(S) `original_url` may name a public or
local-network address; link-local, cloud metadata and other blocked addresses
are refused (see
[Outbound address guard](architecture/outbound-address-guard.md#artwork-downloads)).
[Outbound address guard](architecture/outbound-address-guard.md#artwork-downloads)). A `file://`
`original_url` is accepted for a movie or series only when the item's sidecar
discovery offers that file for that image type; anything else returns a `422`
validation problem. A failure to read or cache an offered file returns `500`.
Frozen v1 does not accept local files.
It preserves target validation before remote work,
episode-to-still coercion, parent/season/episode cache identity, immutable upload,
transactional catalog publication and orphan-GC scheduling after publication
Expand Down
48 changes: 44 additions & 4 deletions docs/architecture/local-nfo-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ Sidecar images are discovered by the provider's `GetImages`
always receive the normal presigned `poster_url`/`backdrop_url`/`logo_url`
(and, on `/api/v2` movie and series detail, `banner_url`, `thumb_url`,
`clearart_url`, `disc_url` and `backdrop_urls`); library files are never served
directly, and API nodes never need filesystem access to libraries.
directly. The admin image picker (below) is the only API path that reads
sidecar files.

Discovery lists each folder once per request and matches names ignoring case,
so `Poster.JPG` and `Folder.jpg` count on case-sensitive filesystems; an entry
Expand Down Expand Up @@ -401,7 +402,11 @@ Caching and refresh:
processor confines each read to the owning library's `media_folders` roots:
a lexical check on the logical path, then a symlink-resolving re-check (both
path and roots are resolved, so a legitimately symlinked root stays valid
while an intermediate directory symlink escaping a root is rejected). When
while an intermediate directory symlink escaping a root is rejected). Each
library root is opened as an `os.Root` before the path is resolved, and the
file is opened through the handle that is the same directory as the resolved
root, so a root or folder swapped for a symlink after that point cannot lead
the open out of the library. When
the re-check or the read fails, the processor probes, through
`internal/rootcheck`, the nearest folder that exists at or above the file's
folder, searching no higher than the library root: unless it lists entries
Expand Down Expand Up @@ -547,6 +552,41 @@ scope. A person refresh keeps a cached NFO photo over a provider's. Like other
local artwork, a sidecar photo is copied whatever `metadata.cache_images` says;
a photo URL an NFO names is used only while the setting is on.

### Admin image picker

`GET /api/v2/admin/items/{id}/images` also offers a movie's or series' local
sidecar artwork. The built-in sidecar discovery runs with the item's media files
and sidecar directories, so it finds the same files a refresh would, and it runs
whether or not the library's metadata chain uses the NFO provider: choosing an
image is an explicit admin action. Local choices come only from that discovery;
a `file://` URL returned by any provider in the chain is dropped, so a provider
cannot get another library file offered as this item's artwork. Only sidecar
files (including files an NFO names by relative path) for the slots an admin can
apply (poster, backdrop, logo) are offered: an image URL an NFO names has no file
to read here, and banner, thumb, clear art and disc art cannot be applied. Each
local choice has the provider ID `local`, keeps its fingerprinted `file://`
source as `original_url`, and shows a 300-pixel-wide WebP preview as an inline
`data:` URI (the web client authenticates with a bearer token, so an `<img>`
cannot fetch an authenticated preview route). The preview is read under the same
root confinement, symlink and size checks as the processor; a file that fails
them is left out of the list, and the list's `provider_errors` reports it under
`local`. Only the movie and series list does this: any other list treats a
provider's `file://` URL as an ordinary provider choice and never reads it.

`POST .../images/apply` with a `file://` `original_url` caches the file only
when the item's sidecar discovery offers that exact source for that image type,
so a file replaced since the list (a new fingerprint) must be picked again. It
reads the file under the same checks, stores it under the same `local/...` key
the processor would use, and publishes the fingerprinted source with the images
lock like any other choice. Seasons, episodes and frozen v1 keep provider-only
choices. The server answering the admin API reads the file, so it needs the
library mounted, like a server that copies local artwork; on a server without
the mount discovery finds nothing and local choices are not offered.

The reads open each library root as an `os.Root`, which needs read (list)
permission on the root directory, not only search permission. The scanner lists
the roots, so a server that scans a library already has it.

## Series depth and mixed libraries

`SeasonsRequest`/`EpisodesRequest` carry local path context; `season.nfo`
Expand Down Expand Up @@ -681,8 +721,8 @@ refresh (`internal/metadata/local_sidecar.go`, `local_reapply.go`).

## Known limitations

- The admin image picker does not surface local art (automatic chain path
only).
- The admin image picker offers local art for movies and series only, not
for seasons or episodes.
- Seasons have no banner, thumb or extra backdrops (`seasonNN-fanart`,
`seasonNN-banner`, `seasonNN-landscape` and their season-folder forms are not
read).
Expand Down
Loading
Loading