diff --git a/Directory.Build.props b/Directory.Build.props index 1b37413..2c6528d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - 1.0.0.7 - 1.0.0.7 - 1.0.0.7 + 1.0.0.8 + 1.0.0.8 + 1.0.0.8 diff --git a/Jellyfin.Plugin.Request/Hosting/WebNavInjector.cs b/Jellyfin.Plugin.Request/Hosting/WebNavInjector.cs index 9f3c7ff..1f7aa2f 100644 --- a/Jellyfin.Plugin.Request/Hosting/WebNavInjector.cs +++ b/Jellyfin.Plugin.Request/Hosting/WebNavInjector.cs @@ -21,7 +21,7 @@ public sealed class WebNavInjector : IHostedService /// /// Script URL injected into jellyfin-web index.html. /// - public const string LoaderSrc = "/Requests/Assets/nav-loader.js?v=1.0.0.7"; + public const string LoaderSrc = "/Requests/Assets/nav-loader.js?v=1.0.0.8"; private const string MarkerStart = ""; private const string MarkerEnd = ""; diff --git a/Jellyfin.Plugin.Request/Web/request.js b/Jellyfin.Plugin.Request/Web/request.js index 8813443..4e00dda 100644 --- a/Jellyfin.Plugin.Request/Web/request.js +++ b/Jellyfin.Plugin.Request/Web/request.js @@ -131,17 +131,62 @@ } function statusName(value) { - if (typeof value === "string") { + if (typeof value === "string" && value) { return value; } - return ["Pending", "Approved", "Rejected", "Fulfilled"][value] || "Unknown"; + if (typeof value === "number" && value >= 0 && value <= 3) { + return ["Pending", "Approved", "Rejected", "Fulfilled"][value]; + } + + return "Unknown"; } function statusClass(value) { return statusName(value).toLowerCase(); } + function normalizeRequest(item) { + if (!item || typeof item !== "object") { + return { + id: "", + mediaType: "", + title: "Untitled", + year: null, + posterPath: null, + seasons: [], + allSeasons: false, + requestedByName: "Unknown", + createdAtUtc: null, + status: "Unknown", + adminNote: null + }; + } + + return { + id: item.id ?? item.Id ?? "", + mediaType: item.mediaType || item.MediaType || "", + title: item.title || item.Title || "Untitled", + year: item.year ?? item.Year ?? null, + posterPath: item.posterPath || item.PosterPath || null, + seasons: item.seasons || item.Seasons || [], + allSeasons: !!(item.allSeasons ?? item.AllSeasons), + requestedByName: item.requestedByName || item.RequestedByName || "Unknown", + createdAtUtc: item.createdAtUtc || item.CreatedAtUtc || null, + status: item.status ?? item.Status, + adminNote: item.adminNote || item.AdminNote || null + }; + } + + function formatRequestDate(value) { + if (!value) { + return "Unknown date"; + } + + const date = new Date(value); + return Number.isNaN(date.getTime()) ? "Unknown date" : date.toLocaleString(); + } + function escapeHtml(value) { return String(value ?? "") .replaceAll("&", "&") @@ -420,13 +465,16 @@ async function loadRequests() { try { - state.requests = await api(""); + const raw = await api(""); + state.requests = (Array.isArray(raw) ? raw : []).map(normalizeRequest); renderRequestList(els.mineList, state.requests, false); if (state.isAdmin) { const pendingFirst = [...state.requests].sort((a, b) => { const aPending = statusName(a.status) === "Pending" ? 0 : 1; const bPending = statusName(b.status) === "Pending" ? 0 : 1; - return aPending - bPending || new Date(b.createdAtUtc) - new Date(a.createdAtUtc); + const aTime = a.createdAtUtc ? new Date(a.createdAtUtc).getTime() : 0; + const bTime = b.createdAtUtc ? new Date(b.createdAtUtc).getTime() : 0; + return aPending - bPending || bTime - aTime; }); renderRequestList(els.adminList, pendingFirst, true); } @@ -441,21 +489,23 @@ return; } - container.innerHTML = items.map((item) => { + container.innerHTML = items.map((raw) => { + const item = normalizeRequest(raw); const img = posterUrl(item.posterPath, 185); const seasons = item.allSeasons ? "All seasons" - : (item.seasons || []).length - ? `Seasons ${(item.seasons || []).join(", ")}` + : item.seasons.length + ? `Seasons ${item.seasons.join(", ")}` : ""; + const status = statusName(item.status); const actions = adminMode ? ` - - - - ` - : (statusName(item.status) === "Pending" - ? `` + + + + ` + : (status === "Pending" + ? `` : ""); return ` @@ -463,9 +513,9 @@ ${img ? `` : "
"}

${escapeHtml(item.title)}

-

${escapeHtml(item.mediaType)}${item.year ? ` · ${item.year}` : ""}${seasons ? ` · ${escapeHtml(seasons)}` : ""}

-

Requested by ${escapeHtml(item.requestedByName)} · ${new Date(item.createdAtUtc).toLocaleString()}

- ${escapeHtml(statusName(item.status))} +

${escapeHtml(item.mediaType)}${item.year ? ` · ${escapeHtml(item.year)}` : ""}${seasons ? ` · ${escapeHtml(seasons)}` : ""}

+

Requested by ${escapeHtml(item.requestedByName)} · ${escapeHtml(formatRequestDate(item.createdAtUtc))}

+ ${escapeHtml(status)} ${item.adminNote ? `

${escapeHtml(item.adminNote)}

` : ""}
${actions}
diff --git a/build.yaml b/build.yaml index a2de4e1..b3ec91c 100644 --- a/build.yaml +++ b/build.yaml @@ -1,7 +1,7 @@ --- name: "Request" guid: "11c08950-c4bb-484d-89ff-205b3724416b" -version: "1.0.0.7" +version: "1.0.0.8" targetAbi: "10.11.11.0" framework: "net9.0" overview: "Request movies and TV shows from a local admin review queue" diff --git a/manifest.json b/manifest.json index 0a6053f..87d0576 100644 --- a/manifest.json +++ b/manifest.json @@ -9,12 +9,12 @@ "repositoryUrl": "https://git.masengr.com/Michael-A-Sloan/Jellyfin_Request_tvandmovies", "versions": [ { - "version": "1.0.0.7", - "changelog": "Fix request submit errors with clearer validation and ApiClient base URL", + "version": "1.0.0.8", + "changelog": "Fix My requests/Admin queue showing Unknown status and Invalid Date", "targetAbi": "10.11.11.0", - "sourceUrl": "https://git.masengr.com/Michael-A-Sloan/Jellyfin_Request_tvandmovies/raw/branch/main/release/Jellyfin.Plugin.Request_1.0.0.7.zip", - "checksum": "55DBF64784413920B09287802EE25732", - "timestamp": "2026-08-02T21:32:22.2192886Z", + "sourceUrl": "https://git.masengr.com/Michael-A-Sloan/Jellyfin_Request_tvandmovies/raw/branch/main/release/Jellyfin.Plugin.Request_1.0.0.8.zip", + "checksum": "50A8114FF61E2E4C440C332E1AEF3D01", + "timestamp": "2026-08-02T21:38:10.7513883Z", "dependencies": [] } ] diff --git a/release/Jellyfin.Plugin.Request_1.0.0.8.zip b/release/Jellyfin.Plugin.Request_1.0.0.8.zip new file mode 100644 index 0000000..ce656fe Binary files /dev/null and b/release/Jellyfin.Plugin.Request_1.0.0.8.zip differ diff --git a/scripts/package-release.ps1 b/scripts/package-release.ps1 index 372fddd..b6f0cb8 100644 --- a/scripts/package-release.ps1 +++ b/scripts/package-release.ps1 @@ -1,5 +1,5 @@ param( - [string]$Version = "1.0.0.7", + [string]$Version = "1.0.0.8", [string]$TargetAbi = "10.11.11.0", [string]$RepoRawBase = "https://git.masengr.com/Michael-A-Sloan/Jellyfin_Request_tvandmovies/raw/branch/main" ) @@ -17,7 +17,7 @@ $dllPath = Join-Path $root "Jellyfin.Plugin.Request\bin\Release\net9.0\Jellyfin. $zipPath = Join-Path $releaseDir $zipFileName $manifestPath = Join-Path $root "manifest.json" $timestamp = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ") -$changelog = "Fix request submit errors with clearer validation and ApiClient base URL" +$changelog = "Fix My requests/Admin queue showing Unknown status and Invalid Date" Write-Host "Building plugin..." dotnet build (Join-Path $root "Jellyfin.Plugin.Request.sln") -c Release