fix(jellyfin): resolve caller-visible music root
CI / build-and-test (push) Canceled after 0s
CI / release-critical-tests (push) Canceled after 0s
CI / csharp-format (push) Canceled after 0s
CI / webui (push) Canceled after 0s
CI / apple-contracts (push) Canceled after 0s
CI / compose-contracts (push) Canceled after 0s
CI / release-manifest (push) Canceled after 0s

This commit is contained in:
joshpatra committed 2026-09-09 14:37:14 -04:00
1 parent ac630455b1
commit 93894ba8de
2 files changed
+13 -15

No files matched your search

@@ -14,6 +14,6 @@ public sealed class MigrationModelSnapshotTests
using var context = new AllstarrDbContext(options);
Assert.False(context.Database.HasPendingModelChanges());
Assert.Equal("20260820173000_RepairProviderAccountCreatorIdentity", context.Database.GetMigrations().Last());
Assert.Equal("20260825020000_EnforcePlaylistImportPolicies", context.Database.GetMigrations().Last());
}
}
@@ -65,23 +65,23 @@ public partial class JellyfinController
[HttpGet("Items/Root", Order = 1)]
public async Task<IActionResult> GetMusicLibraryRoot()
{
var musicLibraryId = await _proxyService.GetMusicLibraryIdForFilteringAsync();
if (string.IsNullOrWhiteSpace(musicLibraryId))
{
return StatusCode(StatusCodes.Status503ServiceUnavailable, new
{
error = "A Jellyfin music library could not be identified."
});
}
var credentialQuery = Request.Query
.Where(item => item.Key.Equals("api_key", StringComparison.OrdinalIgnoreCase) ||
item.Key.Equals("access_token", StringComparison.OrdinalIgnoreCase) ||
item.Key.Equals("ApiKey", StringComparison.OrdinalIgnoreCase) ||
item.Key.Equals("UserId", StringComparison.OrdinalIgnoreCase))
.SelectMany(item => item.Value.Select(value =>
new KeyValuePair<string, string?>(item.Key, value)));
var endpoint = $"Items/{Uri.EscapeDataString(musicLibraryId)}{QueryString.Create(credentialQuery)}";
new KeyValuePair<string, string?>(item.Key, value)))
.ToArray();
var queryString = QueryString.Create(credentialQuery);
var musicLibraryId = await _proxyService.GetMusicLibraryIdForFilteringAsync(
queryString.Value,
Request.Headers);
if (string.IsNullOrWhiteSpace(musicLibraryId))
return StatusCode(StatusCodes.Status503ServiceUnavailable,
new { error = "A Jellyfin music library could not be identified." });
var endpoint = $"Items/{Uri.EscapeDataString(musicLibraryId)}{queryString}";
var (body, statusCode) = await _proxyService.GetJsonAsync(endpoint, null, Request.Headers);
return HandleProxyResponse(body, statusCode);
}
@@ -129,9 +129,7 @@ public partial class JellyfinController
var song = await GetProviderSongAsync(provider, externalId, HttpContext.RequestAborted);
if (song == null) return NotFound(new { error = "Track metadata was not found." });
// PlaybackInfo must describe the same synthesized item that the client
// requested. Provider metadata adapters may return a canonical/alternate
// identifier; using it here would build stream URLs for a different item.
// A provider's canonical ID could build stream URLs for a different synthetic item.
song.Id = itemId;
song.ExternalProvider = provider;
song.ExternalId = externalId;