feat(request): custom titles and remount blank request tab
Allow movie/TV requests without a TMDB match via a Custom form, and remount the embedded Request UI when the home tab opens empty. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
2eed62390b
commit
7044023d98
12 files changed
+312
-33
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>1.0.0.9</Version>
|
<Version>1.0.1.0</Version>
|
||||||
<AssemblyVersion>1.0.0.9</AssemblyVersion>
|
<AssemblyVersion>1.0.1.0</AssemblyVersion>
|
||||||
<FileVersion>1.0.0.9</FileVersion>
|
<FileVersion>1.0.1.0</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -13,10 +13,30 @@ public sealed class CreateRequestDto
|
|||||||
public string MediaType { get; set; } = string.Empty;
|
public string MediaType { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the TMDB identifier.
|
/// Gets or sets the TMDB identifier. Ignored for custom requests.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int TmdbId { get; set; }
|
public int TmdbId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether this is a custom title not on TMDB.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsCustom { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the title for custom requests.
|
||||||
|
/// </summary>
|
||||||
|
public string? Title { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets an optional release year for custom requests.
|
||||||
|
/// </summary>
|
||||||
|
public int? Year { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets optional requester notes.
|
||||||
|
/// </summary>
|
||||||
|
public string? Notes { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets optional season numbers for TV.
|
/// Gets or sets optional season numbers for TV.
|
||||||
/// Null or empty with <see cref="AllSeasons"/> true requests everything.
|
/// Null or empty with <see cref="AllSeasons"/> true requests everything.
|
||||||
|
|||||||
@@ -242,9 +242,62 @@ public sealed class RequestController : ControllerBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
var mediaType = NormalizeMediaType(body.MediaType);
|
var mediaType = NormalizeMediaType(body.MediaType);
|
||||||
if (mediaType is null || body.TmdbId <= 0)
|
if (mediaType is null)
|
||||||
{
|
{
|
||||||
return BadRequest(new { message = "mediaType must be movie or tv and tmdbId must be positive." });
|
return BadRequest(new { message = "mediaType must be movie or tv." });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (body.IsCustom)
|
||||||
|
{
|
||||||
|
var customTitle = (body.Title ?? string.Empty).Trim();
|
||||||
|
if (customTitle.Length is < 1 or > 200)
|
||||||
|
{
|
||||||
|
return BadRequest(new { message = "Custom requests need a title (1–200 characters)." });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (body.Year.HasValue && (body.Year.Value < 1870 || body.Year.Value > 2100))
|
||||||
|
{
|
||||||
|
return BadRequest(new { message = "Year must be between 1870 and 2100 when provided." });
|
||||||
|
}
|
||||||
|
|
||||||
|
var notes = string.IsNullOrWhiteSpace(body.Notes) ? null : body.Notes.Trim();
|
||||||
|
if (notes is { Length: > 1000 })
|
||||||
|
{
|
||||||
|
return BadRequest(new { message = "Notes must be 1000 characters or fewer." });
|
||||||
|
}
|
||||||
|
|
||||||
|
var existingCustom = await _store.GetAllAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
if (HasCustomDuplicate(existingCustom, userId, mediaType, customTitle, body.Year))
|
||||||
|
{
|
||||||
|
return Conflict(new { message = "You already have an open request for this custom title." });
|
||||||
|
}
|
||||||
|
|
||||||
|
var customUser = _userManager.GetUserById(userId);
|
||||||
|
var customRequest = new MediaRequest
|
||||||
|
{
|
||||||
|
Id = Guid.NewGuid(),
|
||||||
|
MediaType = mediaType,
|
||||||
|
TmdbId = 0,
|
||||||
|
IsCustom = true,
|
||||||
|
Title = customTitle,
|
||||||
|
Year = body.Year,
|
||||||
|
Notes = notes,
|
||||||
|
PosterPath = null,
|
||||||
|
Seasons = null,
|
||||||
|
AllSeasons = mediaType == "tv",
|
||||||
|
RequestedByUserId = userId,
|
||||||
|
RequestedByName = customUser?.Username ?? "Unknown",
|
||||||
|
CreatedAtUtc = DateTime.UtcNow,
|
||||||
|
Status = RequestStatus.Pending
|
||||||
|
};
|
||||||
|
|
||||||
|
await _store.AddAsync(customRequest, cancellationToken).ConfigureAwait(false);
|
||||||
|
return StatusCode(StatusCodes.Status201Created, customRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (body.TmdbId <= 0)
|
||||||
|
{
|
||||||
|
return BadRequest(new { message = "tmdbId must be positive for TMDB requests." });
|
||||||
}
|
}
|
||||||
|
|
||||||
var allSeasons = body.AllSeasons;
|
var allSeasons = body.AllSeasons;
|
||||||
@@ -290,8 +343,10 @@ public sealed class RequestController : ControllerBase
|
|||||||
Id = Guid.NewGuid(),
|
Id = Guid.NewGuid(),
|
||||||
MediaType = mediaType,
|
MediaType = mediaType,
|
||||||
TmdbId = detail.TmdbId,
|
TmdbId = detail.TmdbId,
|
||||||
|
IsCustom = false,
|
||||||
Title = detail.Title,
|
Title = detail.Title,
|
||||||
Year = detail.Year,
|
Year = detail.Year,
|
||||||
|
Notes = string.IsNullOrWhiteSpace(body.Notes) ? null : body.Notes.Trim(),
|
||||||
PosterPath = detail.PosterPath,
|
PosterPath = detail.PosterPath,
|
||||||
Seasons = seasons,
|
Seasons = seasons,
|
||||||
AllSeasons = mediaType == "tv" && allSeasons,
|
AllSeasons = mediaType == "tv" && allSeasons,
|
||||||
@@ -428,6 +483,7 @@ public sealed class RequestController : ControllerBase
|
|||||||
foreach (var item in existing)
|
foreach (var item in existing)
|
||||||
{
|
{
|
||||||
if (item.RequestedByUserId != userId
|
if (item.RequestedByUserId != userId
|
||||||
|
|| item.IsCustom
|
||||||
|| !item.MediaType.Equals(mediaType, StringComparison.OrdinalIgnoreCase)
|
|| !item.MediaType.Equals(mediaType, StringComparison.OrdinalIgnoreCase)
|
||||||
|| item.TmdbId != tmdbId
|
|| item.TmdbId != tmdbId
|
||||||
|| item.Status is not (RequestStatus.Pending or RequestStatus.Approved))
|
|| item.Status is not (RequestStatus.Pending or RequestStatus.Approved))
|
||||||
@@ -459,6 +515,35 @@ public sealed class RequestController : ControllerBase
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool HasCustomDuplicate(
|
||||||
|
IReadOnlyList<MediaRequest> existing,
|
||||||
|
Guid userId,
|
||||||
|
string mediaType,
|
||||||
|
string title,
|
||||||
|
int? year)
|
||||||
|
{
|
||||||
|
foreach (var item in existing)
|
||||||
|
{
|
||||||
|
if (item.RequestedByUserId != userId
|
||||||
|
|| !item.IsCustom
|
||||||
|
|| !item.MediaType.Equals(mediaType, StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| item.Status is not (RequestStatus.Pending or RequestStatus.Approved)
|
||||||
|
|| !item.Title.Equals(title, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (year.HasValue && item.Year.HasValue && year.Value != item.Year.Value)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private static PluginConfiguration GetConfig()
|
private static PluginConfiguration GetConfig()
|
||||||
{
|
{
|
||||||
return Plugin.Instance?.Configuration ?? new PluginConfiguration();
|
return Plugin.Instance?.Configuration ?? new PluginConfiguration();
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public sealed class WebNavInjector : IHostedService
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Script URL injected into jellyfin-web index.html.
|
/// Script URL injected into jellyfin-web index.html.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string LoaderSrc = "/Requests/Assets/nav-loader.js?v=1.0.0.9";
|
public const string LoaderSrc = "/Requests/Assets/nav-loader.js?v=1.0.1.0";
|
||||||
|
|
||||||
private const string MarkerStart = "<!-- jellyfin-plugin-request-nav-start -->";
|
private const string MarkerStart = "<!-- jellyfin-plugin-request-nav-start -->";
|
||||||
private const string MarkerEnd = "<!-- jellyfin-plugin-request-nav-end -->";
|
private const string MarkerEnd = "<!-- jellyfin-plugin-request-nav-end -->";
|
||||||
|
|||||||
@@ -19,15 +19,25 @@ public sealed class MediaRequest
|
|||||||
public string MediaType { get; set; } = string.Empty;
|
public string MediaType { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the TMDB identifier.
|
/// Gets or sets the TMDB identifier. Zero for custom titles not found on TMDB.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int TmdbId { get; set; }
|
public int TmdbId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether this was a custom (non-TMDB) request.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsCustom { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the display title.
|
/// Gets or sets the display title.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets optional notes from the requester (useful for custom titles).
|
||||||
|
/// </summary>
|
||||||
|
public string? Notes { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the release year when known.
|
/// Gets or sets the release year when known.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -182,7 +182,14 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function mountRequestUi(panel) {
|
async function mountRequestUi(panel, forceRemount) {
|
||||||
|
if (!panel) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
panel.classList.remove("hide");
|
||||||
|
panel.classList.add("is-active");
|
||||||
|
|
||||||
const mount = panel.querySelector('[data-role="request-mount"]');
|
const mount = panel.querySelector('[data-role="request-mount"]');
|
||||||
if (!mount) {
|
if (!mount) {
|
||||||
return;
|
return;
|
||||||
@@ -196,11 +203,32 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.JellyfinRequestUI) {
|
if (!window.JellyfinRequestUI) {
|
||||||
window.JellyfinRequestUI.mount(mount, { embed: true });
|
|
||||||
} else {
|
|
||||||
mount.textContent = "Request UI failed to initialize.";
|
mount.textContent = "Request UI failed to initialize.";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const needsForce = forceRemount || !mount.querySelector(".req-root");
|
||||||
|
window.JellyfinRequestUI.mount(mount, { embed: true, force: needsForce });
|
||||||
|
}
|
||||||
|
|
||||||
|
function showRequestPanel() {
|
||||||
|
const page = document.getElementById("indexPage");
|
||||||
|
const button = document.querySelector(`.headerTabs [${TAB_ATTR}="request"]`);
|
||||||
|
const panel = page?.querySelector(`.tabContent[${TAB_ATTR}="request"]`);
|
||||||
|
if (!button || !panel) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const index = parseInt(button.getAttribute("data-index"), 10);
|
||||||
|
if (!isNaN(index)) {
|
||||||
|
syncPanelVisibility(index);
|
||||||
|
} else {
|
||||||
|
panel.classList.remove("hide");
|
||||||
|
panel.classList.add("is-active");
|
||||||
|
}
|
||||||
|
|
||||||
|
mountRequestUi(panel, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isRequestTabButton(button) {
|
function isRequestTabButton(button) {
|
||||||
@@ -231,9 +259,7 @@
|
|||||||
const selectedButton = tabsEl.querySelector(`.emby-tab-button[data-index="${index}"]`);
|
const selectedButton = tabsEl.querySelector(`.emby-tab-button[data-index="${index}"]`);
|
||||||
if (isRequestTabButton(selectedButton)) {
|
if (isRequestTabButton(selectedButton)) {
|
||||||
const panel = document.querySelector(`.tabContent[${TAB_ATTR}="request"]`);
|
const panel = document.querySelector(`.tabContent[${TAB_ATTR}="request"]`);
|
||||||
if (panel) {
|
mountRequestUi(panel, false);
|
||||||
mountRequestUi(panel);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
@@ -256,9 +282,7 @@
|
|||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
syncPanelVisibility(index);
|
syncPanelVisibility(index);
|
||||||
const panel = document.querySelector(`.tabContent[${TAB_ATTR}="request"]`);
|
const panel = document.querySelector(`.tabContent[${TAB_ATTR}="request"]`);
|
||||||
if (panel) {
|
mountRequestUi(panel, true);
|
||||||
mountRequestUi(panel);
|
|
||||||
}
|
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,6 +384,14 @@
|
|||||||
button = createTabButton();
|
button = createTabButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (button.dataset.jfRequestClickBound !== "1") {
|
||||||
|
button.dataset.jfRequestClickBound = "1";
|
||||||
|
button.addEventListener("click", () => {
|
||||||
|
setTimeout(showRequestPanel, 0);
|
||||||
|
setTimeout(showRequestPanel, 120);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let panel = page.querySelector(`.tabContent[${TAB_ATTR}="request"]`);
|
let panel = page.querySelector(`.tabContent[${TAB_ATTR}="request"]`);
|
||||||
if (!panel) {
|
if (!panel) {
|
||||||
panel = createTabPanel();
|
panel = createTabPanel();
|
||||||
|
|||||||
@@ -255,6 +255,41 @@ body.jellyfin-request-standalone {
|
|||||||
.req-badge.approved { background: #0f3d1f; color: #8dffb0; }
|
.req-badge.approved { background: #0f3d1f; color: #8dffb0; }
|
||||||
.req-badge.rejected { background: #4a1212; color: #ff9d9d; }
|
.req-badge.rejected { background: #4a1212; color: #ff9d9d; }
|
||||||
.req-badge.fulfilled { background: #0a3345; color: #8ad7ff; }
|
.req-badge.fulfilled { background: #0a3345; color: #8ad7ff; }
|
||||||
|
.req-badge.custom { background: #3a2a55; color: #d7b8ff; margin-left: 0.35rem; }
|
||||||
|
|
||||||
|
.req-custom-form {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.85rem;
|
||||||
|
max-width: 560px;
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.req-field {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.35rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.req-field span {
|
||||||
|
color: var(--req-muted);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.req-field input,
|
||||||
|
.req-field textarea {
|
||||||
|
padding: 0.7rem 0.85rem;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid var(--req-border);
|
||||||
|
background: var(--req-panel);
|
||||||
|
color: var(--req-text);
|
||||||
|
font: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.req-field textarea {
|
||||||
|
resize: vertical;
|
||||||
|
min-height: 5rem;
|
||||||
|
}
|
||||||
|
|
||||||
.req-list-actions {
|
.req-list-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
<h1 class="req-title">Request</h1>
|
<h1 class="req-title">Request</h1>
|
||||||
<nav class="req-tabs" aria-label="Request views">
|
<nav class="req-tabs" aria-label="Request views">
|
||||||
<button type="button" class="req-tab active" data-view="search">Search</button>
|
<button type="button" class="req-tab active" data-view="search">Search</button>
|
||||||
|
<button type="button" class="req-tab" data-view="custom">Custom</button>
|
||||||
<button type="button" class="req-tab" data-view="mine">My requests</button>
|
<button type="button" class="req-tab" data-view="mine">My requests</button>
|
||||||
<button type="button" class="req-tab req-hidden" data-view="admin" data-role="admin-tab">Admin queue</button>
|
<button type="button" class="req-tab req-hidden" data-view="admin" data-role="admin-tab">Admin queue</button>
|
||||||
</nav>
|
</nav>
|
||||||
@@ -30,7 +31,7 @@
|
|||||||
<p class="req-message req-hidden" data-role="global-message"></p>
|
<p class="req-message req-hidden" data-role="global-message"></p>
|
||||||
<section data-role="search-view">
|
<section data-role="search-view">
|
||||||
<div class="req-search-row">
|
<div class="req-search-row">
|
||||||
<input data-role="search-input" type="search" placeholder="Search movies or TV shows" autocomplete="off" />
|
<input data-role="search-input" type="search" placeholder="Search movies or TV shows on TMDB" autocomplete="off" />
|
||||||
<div class="req-type-toggle" role="group" aria-label="Media type">
|
<div class="req-type-toggle" role="group" aria-label="Media type">
|
||||||
<button type="button" class="req-type-btn active" data-type="multi">All</button>
|
<button type="button" class="req-type-btn active" data-type="multi">All</button>
|
||||||
<button type="button" class="req-type-btn" data-type="movie">Movies</button>
|
<button type="button" class="req-type-btn" data-type="movie">Movies</button>
|
||||||
@@ -42,6 +43,28 @@
|
|||||||
<div class="req-grid" data-role="results"></div>
|
<div class="req-grid" data-role="results"></div>
|
||||||
<div class="req-detail req-hidden" data-role="detail"></div>
|
<div class="req-detail req-hidden" data-role="detail"></div>
|
||||||
</section>
|
</section>
|
||||||
|
<section class="req-hidden" data-role="custom-view">
|
||||||
|
<p class="req-muted">Can’t find it on TMDB? Submit a custom movie or TV request for the admin to review.</p>
|
||||||
|
<form class="req-custom-form" data-role="custom-form">
|
||||||
|
<label class="req-field">
|
||||||
|
<span>Title</span>
|
||||||
|
<input data-role="custom-title" type="text" maxlength="200" required placeholder="Exact title" autocomplete="off" />
|
||||||
|
</label>
|
||||||
|
<div class="req-type-toggle" role="group" aria-label="Custom media type">
|
||||||
|
<button type="button" class="req-type-btn active" data-role="custom-type" data-type="movie">Movie</button>
|
||||||
|
<button type="button" class="req-type-btn" data-role="custom-type" data-type="tv">TV</button>
|
||||||
|
</div>
|
||||||
|
<label class="req-field">
|
||||||
|
<span>Year (optional)</span>
|
||||||
|
<input data-role="custom-year" type="number" min="1870" max="2100" placeholder="e.g. 2024" />
|
||||||
|
</label>
|
||||||
|
<label class="req-field">
|
||||||
|
<span>Notes (optional)</span>
|
||||||
|
<textarea data-role="custom-notes" rows="3" maxlength="1000" placeholder="Links, alternate titles, quality, seasons…"></textarea>
|
||||||
|
</label>
|
||||||
|
<button type="submit" class="req-btn primary" data-role="custom-submit">Submit custom request</button>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
<section class="req-hidden" data-role="mine-view">
|
<section class="req-hidden" data-role="mine-view">
|
||||||
<div class="req-list" data-role="mine-list"></div>
|
<div class="req-list" data-role="mine-list"></div>
|
||||||
</section>
|
</section>
|
||||||
@@ -163,6 +186,8 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const tmdbId = Number(item.tmdbId ?? item.TmdbId ?? 0);
|
||||||
|
const isCustom = !!(item.isCustom ?? item.IsCustom) || tmdbId <= 0;
|
||||||
return {
|
return {
|
||||||
id: item.id ?? item.Id ?? "",
|
id: item.id ?? item.Id ?? "",
|
||||||
mediaType: item.mediaType || item.MediaType || "",
|
mediaType: item.mediaType || item.MediaType || "",
|
||||||
@@ -174,7 +199,10 @@
|
|||||||
requestedByName: item.requestedByName || item.RequestedByName || "Unknown",
|
requestedByName: item.requestedByName || item.RequestedByName || "Unknown",
|
||||||
createdAtUtc: item.createdAtUtc || item.CreatedAtUtc || null,
|
createdAtUtc: item.createdAtUtc || item.CreatedAtUtc || null,
|
||||||
status: item.status ?? item.Status,
|
status: item.status ?? item.Status,
|
||||||
adminNote: item.adminNote || item.AdminNote || null
|
adminNote: item.adminNote || item.AdminNote || null,
|
||||||
|
notes: item.notes || item.Notes || null,
|
||||||
|
isCustom,
|
||||||
|
tmdbId
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,6 +226,7 @@
|
|||||||
function createController(root) {
|
function createController(root) {
|
||||||
const state = {
|
const state = {
|
||||||
mediaType: "multi",
|
mediaType: "multi",
|
||||||
|
customMediaType: "movie",
|
||||||
status: null,
|
status: null,
|
||||||
isAdmin: false,
|
isAdmin: false,
|
||||||
detail: null,
|
detail: null,
|
||||||
@@ -213,10 +242,16 @@
|
|||||||
searchMeta: root.querySelector('[data-role="search-meta"]'),
|
searchMeta: root.querySelector('[data-role="search-meta"]'),
|
||||||
results: root.querySelector('[data-role="results"]'),
|
results: root.querySelector('[data-role="results"]'),
|
||||||
detail: root.querySelector('[data-role="detail"]'),
|
detail: root.querySelector('[data-role="detail"]'),
|
||||||
|
customForm: root.querySelector('[data-role="custom-form"]'),
|
||||||
|
customTitle: root.querySelector('[data-role="custom-title"]'),
|
||||||
|
customYear: root.querySelector('[data-role="custom-year"]'),
|
||||||
|
customNotes: root.querySelector('[data-role="custom-notes"]'),
|
||||||
|
customSubmit: root.querySelector('[data-role="custom-submit"]'),
|
||||||
mineList: root.querySelector('[data-role="mine-list"]'),
|
mineList: root.querySelector('[data-role="mine-list"]'),
|
||||||
adminList: root.querySelector('[data-role="admin-list"]'),
|
adminList: root.querySelector('[data-role="admin-list"]'),
|
||||||
adminTab: root.querySelector('[data-role="admin-tab"]'),
|
adminTab: root.querySelector('[data-role="admin-tab"]'),
|
||||||
searchView: root.querySelector('[data-role="search-view"]'),
|
searchView: root.querySelector('[data-role="search-view"]'),
|
||||||
|
customView: root.querySelector('[data-role="custom-view"]'),
|
||||||
mineView: root.querySelector('[data-role="mine-view"]'),
|
mineView: root.querySelector('[data-role="mine-view"]'),
|
||||||
adminView: root.querySelector('[data-role="admin-view"]')
|
adminView: root.querySelector('[data-role="admin-view"]')
|
||||||
};
|
};
|
||||||
@@ -246,6 +281,7 @@
|
|||||||
tab.classList.toggle("active", tab.dataset.view === view);
|
tab.classList.toggle("active", tab.dataset.view === view);
|
||||||
});
|
});
|
||||||
els.searchView.classList.toggle("req-hidden", view !== "search");
|
els.searchView.classList.toggle("req-hidden", view !== "search");
|
||||||
|
els.customView.classList.toggle("req-hidden", view !== "custom");
|
||||||
els.mineView.classList.toggle("req-hidden", view !== "mine");
|
els.mineView.classList.toggle("req-hidden", view !== "mine");
|
||||||
els.adminView.classList.toggle("req-hidden", view !== "admin");
|
els.adminView.classList.toggle("req-hidden", view !== "admin");
|
||||||
if (view === "mine" || (view === "admin" && state.isAdmin)) {
|
if (view === "mine" || (view === "admin" && state.isAdmin)) {
|
||||||
@@ -546,10 +582,11 @@
|
|||||||
<article class="req-list-item">
|
<article class="req-list-item">
|
||||||
${img ? `<img src="${escapeHtml(img)}" alt="" />` : "<div></div>"}
|
${img ? `<img src="${escapeHtml(img)}" alt="" />` : "<div></div>"}
|
||||||
<div>
|
<div>
|
||||||
<p class="req-card-title">${escapeHtml(item.title)}</p>
|
<p class="req-card-title">${escapeHtml(item.title)}${item.isCustom ? ' <span class="req-badge custom">Custom</span>' : ""}</p>
|
||||||
<p class="req-muted">${escapeHtml(item.mediaType)}${item.year ? ` · ${escapeHtml(item.year)}` : ""}${seasons ? ` · ${escapeHtml(seasons)}` : ""}</p>
|
<p class="req-muted">${escapeHtml(item.mediaType)}${item.year ? ` · ${escapeHtml(item.year)}` : ""}${seasons ? ` · ${escapeHtml(seasons)}` : ""}</p>
|
||||||
<p class="req-muted">Requested by ${escapeHtml(item.requestedByName)} · ${escapeHtml(formatRequestDate(item.createdAtUtc))}</p>
|
<p class="req-muted">Requested by ${escapeHtml(item.requestedByName)} · ${escapeHtml(formatRequestDate(item.createdAtUtc))}</p>
|
||||||
<span class="req-badge ${statusClass(item.status)}">${escapeHtml(status)}</span>
|
<span class="req-badge ${statusClass(item.status)}">${escapeHtml(status)}</span>
|
||||||
|
${item.notes ? `<p class="req-muted">Notes: ${escapeHtml(item.notes)}</p>` : ""}
|
||||||
${item.adminNote ? `<p class="req-muted">${escapeHtml(item.adminNote)}</p>` : ""}
|
${item.adminNote ? `<p class="req-muted">${escapeHtml(item.adminNote)}</p>` : ""}
|
||||||
</div>
|
</div>
|
||||||
<div class="req-list-actions">${actions}</div>
|
<div class="req-list-actions">${actions}</div>
|
||||||
@@ -609,14 +646,22 @@
|
|||||||
tab.addEventListener("click", () => setView(tab.dataset.view));
|
tab.addEventListener("click", () => setView(tab.dataset.view));
|
||||||
});
|
});
|
||||||
|
|
||||||
root.querySelectorAll(".req-type-btn").forEach((button) => {
|
els.searchView.querySelectorAll(".req-type-btn").forEach((button) => {
|
||||||
button.addEventListener("click", () => {
|
button.addEventListener("click", () => {
|
||||||
root.querySelectorAll(".req-type-btn").forEach((item) => item.classList.remove("active"));
|
els.searchView.querySelectorAll(".req-type-btn").forEach((item) => item.classList.remove("active"));
|
||||||
button.classList.add("active");
|
button.classList.add("active");
|
||||||
state.mediaType = button.dataset.type;
|
state.mediaType = button.dataset.type;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
root.querySelectorAll('[data-role="custom-type"]').forEach((button) => {
|
||||||
|
button.addEventListener("click", () => {
|
||||||
|
root.querySelectorAll('[data-role="custom-type"]').forEach((item) => item.classList.remove("active"));
|
||||||
|
button.classList.add("active");
|
||||||
|
state.customMediaType = button.dataset.type;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
els.searchBtn.addEventListener("click", runSearch);
|
els.searchBtn.addEventListener("click", runSearch);
|
||||||
els.searchInput.addEventListener("keydown", (event) => {
|
els.searchInput.addEventListener("keydown", (event) => {
|
||||||
if (event.key === "Enter") {
|
if (event.key === "Enter") {
|
||||||
@@ -624,6 +669,54 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
els.customForm.addEventListener("submit", async (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
const title = els.customTitle.value.trim();
|
||||||
|
if (!title) {
|
||||||
|
showMessage("Enter a title for the custom request.", true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.status && !(state.status.requestSubmissionEnabled ?? state.status.RequestSubmissionEnabled)) {
|
||||||
|
showMessage("Request submission is disabled. Enable it in Dashboard → Plugins → Request.", true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const yearRaw = els.customYear.value.trim();
|
||||||
|
const year = yearRaw ? Number(yearRaw) : null;
|
||||||
|
if (yearRaw && (!Number.isFinite(year) || year < 1870 || year > 2100)) {
|
||||||
|
showMessage("Year must be between 1870 and 2100.", true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
els.customSubmit.disabled = true;
|
||||||
|
try {
|
||||||
|
await api("", {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify({
|
||||||
|
isCustom: true,
|
||||||
|
mediaType: state.customMediaType,
|
||||||
|
title,
|
||||||
|
year,
|
||||||
|
notes: els.customNotes.value.trim() || null,
|
||||||
|
allSeasons: true,
|
||||||
|
tmdbId: 0
|
||||||
|
})
|
||||||
|
});
|
||||||
|
els.customForm.reset();
|
||||||
|
state.customMediaType = "movie";
|
||||||
|
root.querySelectorAll('[data-role="custom-type"]').forEach((item) => {
|
||||||
|
item.classList.toggle("active", item.dataset.type === "movie");
|
||||||
|
});
|
||||||
|
showMessage(`Custom request submitted for “${title}”.`);
|
||||||
|
setView("mine");
|
||||||
|
} catch (error) {
|
||||||
|
showMessage(error.message, true);
|
||||||
|
} finally {
|
||||||
|
els.customSubmit.disabled = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Promise.all([loadStatus(), loadCurrentUser()]).then(() => {
|
Promise.all([loadStatus(), loadCurrentUser()]).then(() => {
|
||||||
applyAdminUi();
|
applyAdminUi();
|
||||||
});
|
});
|
||||||
@@ -636,8 +729,12 @@
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (container.dataset.reqMounted === "1") {
|
const force = !!options.force;
|
||||||
return container._jellyfinRequestController || null;
|
const hasUi = !!container.querySelector(".req-root");
|
||||||
|
if (container.dataset.reqMounted === "1" && hasUi && !force) {
|
||||||
|
const existing = container._jellyfinRequestController || null;
|
||||||
|
existing?.reload?.();
|
||||||
|
return existing;
|
||||||
}
|
}
|
||||||
|
|
||||||
container.innerHTML = MARKUP;
|
container.innerHTML = MARKUP;
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: "Request"
|
name: "Request"
|
||||||
guid: "11c08950-c4bb-484d-89ff-205b3724416b"
|
guid: "11c08950-c4bb-484d-89ff-205b3724416b"
|
||||||
version: "1.0.0.9"
|
version: "1.0.1.0"
|
||||||
targetAbi: "10.11.11.0"
|
targetAbi: "10.11.11.0"
|
||||||
framework: "net9.0"
|
framework: "net9.0"
|
||||||
overview: "Request movies and TV shows from a local admin review queue"
|
overview: "Request movies and TV shows from a local admin review queue"
|
||||||
|
|||||||
+5
-5
@@ -9,12 +9,12 @@
|
|||||||
"repositoryUrl": "https://git.masengr.com/Michael-A-Sloan/Jellyfin_Request_tvandmovies",
|
"repositoryUrl": "https://git.masengr.com/Michael-A-Sloan/Jellyfin_Request_tvandmovies",
|
||||||
"versions": [
|
"versions": [
|
||||||
{
|
{
|
||||||
"version": "1.0.0.9",
|
"version": "1.0.1.0",
|
||||||
"changelog": "Admin queue approve/reject/fulfill/delete; admin tab and buttons only for admins",
|
"changelog": "Custom non-TMDB requests; fix blank Request tab needing hard refresh",
|
||||||
"targetAbi": "10.11.11.0",
|
"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.9.zip",
|
"sourceUrl": "https://git.masengr.com/Michael-A-Sloan/Jellyfin_Request_tvandmovies/raw/branch/main/release/Jellyfin.Plugin.Request_1.0.1.0.zip",
|
||||||
"checksum": "0A263FF8AC56B02D9C8021607CD1B087",
|
"checksum": "1DBFBFD428DCBD011C4154147C42EA1F",
|
||||||
"timestamp": "2026-08-02T21:40:27.2325188Z",
|
"timestamp": "2026-08-02T21:46:53.5809145Z",
|
||||||
"dependencies": []
|
"dependencies": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
param(
|
param(
|
||||||
[string]$Version = "1.0.0.9",
|
[string]$Version = "1.0.1.0",
|
||||||
[string]$TargetAbi = "10.11.11.0",
|
[string]$TargetAbi = "10.11.11.0",
|
||||||
[string]$RepoRawBase = "https://git.masengr.com/Michael-A-Sloan/Jellyfin_Request_tvandmovies/raw/branch/main"
|
[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
|
$zipPath = Join-Path $releaseDir $zipFileName
|
||||||
$manifestPath = Join-Path $root "manifest.json"
|
$manifestPath = Join-Path $root "manifest.json"
|
||||||
$timestamp = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ")
|
$timestamp = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ")
|
||||||
$changelog = "Admin queue approve/reject/fulfill/delete; admin tab and buttons only for admins"
|
$changelog = "Custom non-TMDB requests; fix blank Request tab needing hard refresh"
|
||||||
|
|
||||||
Write-Host "Building plugin..."
|
Write-Host "Building plugin..."
|
||||||
dotnet build (Join-Path $root "Jellyfin.Plugin.Request.sln") -c Release
|
dotnet build (Join-Path $root "Jellyfin.Plugin.Request.sln") -c Release
|
||||||
|
|||||||
Reference in new issue
Block a user