From 30c49a0e26c5a4d76bcd55a124e72b27f8c66a8e Mon Sep 17 00:00:00 2001 From: Rob Rogers Date: Sat, 11 Apr 2026 12:18:25 -0400 Subject: [PATCH 1/4] inject shared=true to album endpoints --- ImmichFrame.Core/Api/ImmichApi.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ImmichFrame.Core/Api/ImmichApi.cs b/ImmichFrame.Core/Api/ImmichApi.cs index 49edb490..b3780bbc 100644 --- a/ImmichFrame.Core/Api/ImmichApi.cs +++ b/ImmichFrame.Core/Api/ImmichApi.cs @@ -7,6 +7,7 @@ public ImmichApi(string url, HttpClient httpClient) BaseUrl = url + "/api"; _httpClient = httpClient; _settings = new Lazy(CreateSerializerSettings); + } public async Task PlayAssetVideoWithRangeAsync(Guid id, string rangeHeader, CancellationToken cancellationToken = default) @@ -41,5 +42,16 @@ public async Task PlayAssetVideoWithRangeAsync(Guid id, string ran response.Dispose(); throw new ApiException($"Unexpected status code ({status}).", status, error, headers, null); } + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder) + { + var url = urlBuilder.ToString(); + + // ensure every call to the albums endpoint includes shared content + if (url.Contains("/albums/") && !url.Contains("shared=true")) + { + string separator = url.Contains("?") ? "&" : "?"; + urlBuilder.Append($"{separator}shared=true"); + } + } } } From 4bc086776c839b90c71ea1502153607d5c972f61 Mon Sep 17 00:00:00 2001 From: Rob Rogers Date: Sat, 11 Apr 2026 12:21:14 -0400 Subject: [PATCH 2/4] formatting --- ImmichFrame.Core/Api/ImmichApi.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ImmichFrame.Core/Api/ImmichApi.cs b/ImmichFrame.Core/Api/ImmichApi.cs index b3780bbc..6f6c64ca 100644 --- a/ImmichFrame.Core/Api/ImmichApi.cs +++ b/ImmichFrame.Core/Api/ImmichApi.cs @@ -6,8 +6,7 @@ public ImmichApi(string url, HttpClient httpClient) { BaseUrl = url + "/api"; _httpClient = httpClient; - _settings = new Lazy(CreateSerializerSettings); - + _settings = new Lazy(CreateSerializerSettings); } public async Task PlayAssetVideoWithRangeAsync(Guid id, string rangeHeader, CancellationToken cancellationToken = default) From 6add5b15e6b42028c050098aa2ea9388a6324982 Mon Sep 17 00:00:00 2001 From: Rob Rogers Date: Sat, 11 Apr 2026 12:21:57 -0400 Subject: [PATCH 3/4] . --- ImmichFrame.Core/Api/ImmichApi.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ImmichFrame.Core/Api/ImmichApi.cs b/ImmichFrame.Core/Api/ImmichApi.cs index 6f6c64ca..e7b76e0a 100644 --- a/ImmichFrame.Core/Api/ImmichApi.cs +++ b/ImmichFrame.Core/Api/ImmichApi.cs @@ -6,7 +6,7 @@ public ImmichApi(string url, HttpClient httpClient) { BaseUrl = url + "/api"; _httpClient = httpClient; - _settings = new Lazy(CreateSerializerSettings); + _settings = new Lazy(CreateSerializerSettings); } public async Task PlayAssetVideoWithRangeAsync(Guid id, string rangeHeader, CancellationToken cancellationToken = default) From 5989b9b69682dfc8a0a16c08e7a76d2a0e28c3a7 Mon Sep 17 00:00:00 2001 From: Rob Rogers Date: Sat, 11 Apr 2026 12:41:59 -0400 Subject: [PATCH 4/4] code rabbit suggestion --- ImmichFrame.Core/Api/ImmichApi.cs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/ImmichFrame.Core/Api/ImmichApi.cs b/ImmichFrame.Core/Api/ImmichApi.cs index e7b76e0a..ca0bc6b3 100644 --- a/ImmichFrame.Core/Api/ImmichApi.cs +++ b/ImmichFrame.Core/Api/ImmichApi.cs @@ -45,11 +45,24 @@ partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.H { var url = urlBuilder.ToString(); - // ensure every call to the albums endpoint includes shared content - if (url.Contains("/albums/") && !url.Contains("shared=true")) + var parts = url.Split('?', 2); + var path = parts[0]; + var query = parts.Length > 1 ? parts[1] : string.Empty; + + var isAlbumsEndpoint = path.EndsWith("/albums", StringComparison.OrdinalIgnoreCase) || path.Contains("/albums/", StringComparison.OrdinalIgnoreCase); + + if (isAlbumsEndpoint) { - string separator = url.Contains("?") ? "&" : "?"; - urlBuilder.Append($"{separator}shared=true"); + var hasSharedKey = query + .Split('&', StringSplitOptions.RemoveEmptyEntries) + .Select(p => p.Split('=', 2)[0]) + .Any(k => string.Equals(k, "shared", StringComparison.OrdinalIgnoreCase)); + + if (!hasSharedKey) + { + string separator = query.Length > 0 ? "&" : "?"; + urlBuilder.Append($"{separator}shared=true"); + } } } }