Skip to content

Show shared albums#628

Closed
3rob3 wants to merge 4 commits intomainfrom
dev.3rob3.SharedAlbums
Closed

Show shared albums#628
3rob3 wants to merge 4 commits intomainfrom
dev.3rob3.SharedAlbums

Conversation

@3rob3
Copy link
Copy Markdown
Collaborator

@3rob3 3rob3 commented Apr 11, 2026

closes #625

Summary by CodeRabbit

  • Chores
    • Album-related API requests now automatically include the required query parameter for shared albums when it’s not already present.
    • Detection handles existing query strings and recognizes the parameter regardless of case, preserving other query parameters and separators.

@3rob3 3rob3 requested a review from JW-CH April 11, 2026 16:26
@3rob3 3rob3 added the enhancement New feature or request label Apr 11, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4c83ad88-04b6-437f-9dd5-b44d3c32c4ac

📥 Commits

Reviewing files that changed from the base of the PR and between 6add5b1 and 5989b9b.

📒 Files selected for processing (1)
  • ImmichFrame.Core/Api/ImmichApi.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • ImmichFrame.Core/Api/ImmichApi.cs

📝 Walkthrough

Walkthrough

Added a PrepareRequest partial hook to ImmichApi that inspects outgoing album-related request URLs and appends shared=true to the query string when the parameter is not already present.

Changes

Cohort / File(s) Summary
Album Endpoint Enhancement
ImmichFrame.Core/Api/ImmichApi.cs
Added partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder) that reads the URL from urlBuilder, separates path vs query, detects album endpoints (path ends with /albums or contains /albums/), and appends shared=true if the shared query parameter (case-insensitive) is absent.

Sequence Diagram(s)

sequenceDiagram
    participant ImmichApi
    participant HttpClient as HttpClient
    participant Request as HttpRequestMessage
    participant URLBuilder as StringBuilder

    ImmichApi->>URLBuilder: build request URL
    ImmichApi->>ImmichApi: PrepareRequest(client, Request, URLBuilder)
    ImmichApi->>URLBuilder: read url, parse path & query
    alt path is album endpoint and no shared param
        ImmichApi->>URLBuilder: append shared=true (? or &)
    end
    ImmichApi->>HttpClient: send Request with updated URL
    HttpClient->>Request: execute HTTP call
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰
I sniffed the URL by moonlit cue,
Found albums hidden from view,
I nudged a query, small and true,
Now shared albums hop into view! 📸✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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 'Show shared albums' is concise and directly related to the main change in the PR, which adds functionality to display shared albums via the album endpoint.
Linked Issues check ✅ Passed The PR implements the core requirement from issue #625 by appending 'shared=true' to album endpoint queries, enabling shared albums to be displayed for frame users.
Out of Scope Changes check ✅ Passed The change is narrowly focused on adding a PrepareRequest hook to auto-append the shared parameter to album endpoints, directly addressing the linked issue requirement.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev.3rob3.SharedAlbums

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@ImmichFrame.Core/Api/ImmichApi.cs`:
- Around line 49-53: The current substring check using
url.Contains("shared=true") is brittle; in ImmichApi.cs locate the url and
urlBuilder usage (the block referencing url.Contains("/albums/") and urlBuilder)
and replace the naive check with proper query parsing: parse the URL's query
parameters (e.g., with QueryHelpers.ParseQuery or HttpUtility.ParseQueryString),
check for the "shared" key specifically, and if it's missing add shared=true, or
if present but not "true" update/replace it to "true" to avoid duplicates like
unshared=true or conflicting shared=false; then rebuild the URL/query string via
urlBuilder so the final URL contains a single correct shared=true parameter.
- Line 49: The check that looks for album collection requests only matches
"/albums/" and therefore misses URLs ending with "/albums"; update the
conditional that uses the variable url (in ImmichApi.cs) to detect album
collection paths by checking for "/albums" (e.g., change
url.Contains("/albums/") to url.Contains("/albums")) while keeping the existing
guard for "!url.Contains(\"shared=true\")" so shared=true is still not added
when present.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 075c0628-bc2a-4a75-af37-85115cb20848

📥 Commits

Reviewing files that changed from the base of the PR and between 265a890 and 6add5b1.

📒 Files selected for processing (1)
  • ImmichFrame.Core/Api/ImmichApi.cs

Comment thread ImmichFrame.Core/Api/ImmichApi.cs Outdated
Comment thread ImmichFrame.Core/Api/ImmichApi.cs Outdated
@JW-CH
Copy link
Copy Markdown
Collaborator

JW-CH commented Apr 13, 2026

Filter by shared status: true = only shared, false = not shared, undefined = all owned albums

What are you trying to archieve here? Having shared not defined should result in showing both shared and not shared albums (API docs).

Could you elaborate more?

@JW-CH
Copy link
Copy Markdown
Collaborator

JW-CH commented Apr 13, 2026

We are calling the /Search/Random endpoint which does not accept a shared-parameter. If you really want this, creating an issue in immich would be the best thing to do I assume.

@3rob3
Copy link
Copy Markdown
Collaborator Author

3rob3 commented Apr 13, 2026

We are calling the /Search/Random endpoint which does not accept a shared-parameter. If you really want this, creating an issue in immich would be the best thing to do I assume.

This is only for albums, has nothing to do with search/random. You will still need to specify the album with this approach, I don't see any way around that.

@JW-CH
Copy link
Copy Markdown
Collaborator

JW-CH commented Apr 13, 2026

This is only for albums, has nothing to do with search/random

Yes, but what are you trying to archieve?

@3rob3
Copy link
Copy Markdown
Collaborator Author

3rob3 commented Apr 13, 2026

Filter by shared status: true = only shared, false = not shared, undefined = all owned albums

What are you trying to archieve here? Having shared not defined should result in showing both shared and not shared albums (API docs).

Could you elaborate more?

If you don't specify shared=true, you will not get back any shared albums (as that API doc explains). Try it:

  • Create a NewUser and share an album with them
  • As NewUser create your own new album and add some images
  • In ImmichFrame config specify both albums UUIDs and NewUser's API key
  • Result is only the NewUser images are shown, no shared album images.

@JW-CH
Copy link
Copy Markdown
Collaborator

JW-CH commented Apr 13, 2026

I think there might be a design flaw in immich but not a problem in ImmichFrame:

I have a album that is shared to me from another account. This album will be shown if I add id in immichframe.

The way the /albums API works rn:
shared=true: albums that I share and that are shared by others are shown
shared=false: albums that I don't share
shared=undefined: albums that are owned by me

so the behaviour of shared=true feels off but should not be an issue in ImmichFrame. A album that was shared is still displayed correctly in ImmichFrame.

@JW-CH
Copy link
Copy Markdown
Collaborator

JW-CH commented Apr 13, 2026

This will change in a future version of immich.

Quick confirmation from discord:
image

@3rob3 3rob3 closed this Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to show all albums

2 participants