3 Commits
Author SHA1 Message Date
JoshiCodes 512633d49b chore: release 1.1.0.0
Build / build (push) Successful in 1m53s
2026-11-13 22:46:07 +01:00
JoshiCodes 4b91c380a1 docs: describe the accept delay 2026-11-13 22:46:07 +01:00
JoshiCodes 93036bae89 feat: add a wait before a notice can be accepted 2026-11-13 22:46:07 +01:00
17 changed files with 144 additions and 18 deletions
+1
View File
@@ -29,6 +29,7 @@ One line per decision, with the reason.
- The pending-users list in the report only contains users that still exist. Responses of deleted users are kept and shown without a name. - The pending-users list in the report only contains users that still exist. Responses of deleted users are kept and shown without a name.
- `GET /Herald/Notices/Pending` with an API key (no user) returns an empty list rather than an error. - `GET /Herald/Notices/Pending` with an API key (no user) returns an empty list rather than an error.
- Body format is the Markdown subset from the task (bold, italic, links, lists) rendered in the browser with DOM nodes; the server stores the text as typed. Links are limited to `http`, `https` and `mailto`. - Body format is the Markdown subset from the task (bold, italic, links, lists) rendered in the browser with DOM nodes; the server stores the text as typed. Links are limited to `http`, `https` and `mailto`.
- The wait before accepting (`AcceptDelaySeconds`, 0 to 600) is per notice and only kept for must-accept notices. It is enforced by the client script, not by the `Ack` endpoint: the server does not know when a popup appeared, and must-accept is a record of consent, not a gate. The countdown pauses while the tab is hidden.
- Notice titles and ids are logged. Bodies and user names are not. - Notice titles and ids are logged. Bodies and user names are not.
## Client injection ## Client injection
+3 -3
View File
@@ -7,8 +7,8 @@
<!-- Microsoft.Data.Sqlite version shipped with that Jellyfin release (Directory.Packages.props upstream). --> <!-- Microsoft.Data.Sqlite version shipped with that Jellyfin release (Directory.Packages.props upstream). -->
<JellyfinSqliteVersion>9.0.11</JellyfinSqliteVersion> <JellyfinSqliteVersion>9.0.11</JellyfinSqliteVersion>
<Version>1.0.1.0</Version> <Version>1.1.0.0</Version>
<AssemblyVersion>1.0.1.0</AssemblyVersion> <AssemblyVersion>1.1.0.0</AssemblyVersion>
<FileVersion>1.0.1.0</FileVersion> <FileVersion>1.1.0.0</FileVersion>
</PropertyGroup> </PropertyGroup>
</Project> </Project>
@@ -143,6 +143,18 @@ public class NoticeRulesTests
Assert.NotNull(NoticeRules.ValidateDraft(new NoticeDraft { Title = title })); Assert.NotNull(NoticeRules.ValidateDraft(new NoticeDraft { Title = title }));
} }
[Theory]
[InlineData(-1, false)]
[InlineData(0, true)]
[InlineData(600, true)]
[InlineData(601, false)]
public void Draft_AcceptDelayHasToBeInRange(int seconds, bool valid)
{
var draft = new NoticeDraft { Title = "Hi", RequireAccept = true, AcceptDelaySeconds = seconds };
Assert.Equal(valid, NoticeRules.ValidateDraft(draft) is null);
}
[Fact] [Fact]
public void Draft_SelectedUsersNeedAtLeastOneUser() public void Draft_SelectedUsersNeedAtLeastOneUser()
{ {
@@ -30,6 +30,26 @@ public sealed class NoticeServiceTests : IDisposable
return notice; return notice;
} }
[Fact]
public void AcceptDelay_IsStoredForMustAcceptNotices()
{
var created = Create("Terms", d =>
{
d.RequireAccept = true;
d.AcceptDelaySeconds = 15;
});
Assert.Equal(15, _service.Get(created.Id)!.AcceptDelaySeconds);
}
[Fact]
public void AcceptDelay_IsDroppedWithoutRequireAccept()
{
var created = Create("Info", d => d.AcceptDelaySeconds = 15);
Assert.Equal(0, _service.Get(created.Id)!.AcceptDelaySeconds);
}
[Fact] [Fact]
public void Create_RoundTripsThroughTheDatabase() public void Create_RoundTripsThroughTheDatabase()
{ {
@@ -83,6 +83,7 @@ public class HeraldController : ControllerBase
Title = n.Title, Title = n.Title,
Body = n.Body, Body = n.Body,
RequireAccept = n.RequireAccept, RequireAccept = n.RequireAccept,
AcceptDelaySeconds = n.AcceptDelaySeconds,
Revision = n.Revision Revision = n.Revision
})); }));
} }
@@ -27,6 +27,11 @@ public class PendingNotice
/// </summary> /// </summary>
public bool RequireAccept { get; set; } public bool RequireAccept { get; set; }
/// <summary>
/// Gets or sets the number of seconds the notice has to be on screen before it can be accepted.
/// </summary>
public int AcceptDelaySeconds { get; set; }
/// <summary> /// <summary>
/// Gets or sets the revision to send back with the response. /// Gets or sets the revision to send back with the response.
/// </summary> /// </summary>
@@ -72,6 +72,11 @@
</label> </label>
<div class="fieldDescription checkboxFieldDescription">The notice can only be closed with an "Accept" button.</div> <div class="fieldDescription checkboxFieldDescription">The notice can only be closed with an "Accept" button.</div>
</div> </div>
<div class="inputContainer" id="heraldDelayField">
<label class="inputLabel inputLabelUnfocused" for="heraldAcceptDelay">Wait before "Accept" can be clicked (seconds)</label>
<input id="heraldAcceptDelay" type="number" is="emby-input" min="0" max="600" step="1" value="0" />
<div class="fieldDescription">The button stays locked and counts down while the notice is on screen. 0 means no wait.</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescription"> <div class="checkboxContainer checkboxContainer-withDescription">
<label class="emby-checkbox-label"> <label class="emby-checkbox-label">
<input id="heraldEnabled" type="checkbox" is="emby-checkbox" checked /> <input id="heraldEnabled" type="checkbox" is="emby-checkbox" checked />
@@ -310,7 +315,7 @@
text.appendChild(el('h3', 'listItemBodyText', notice.Title)); text.appendChild(el('h3', 'listItemBodyText', notice.Title));
var meta = [describeTarget(notice)]; var meta = [describeTarget(notice)];
if (notice.RequireAccept) { if (notice.RequireAccept) {
meta.push('must be accepted'); meta.push(notice.AcceptDelaySeconds > 0 ? 'must be accepted after ' + notice.AcceptDelaySeconds + ' s' : 'must be accepted');
} }
if (notice.Revision > 1) { if (notice.Revision > 1) {
meta.push('shown ' + notice.Revision + ' times'); meta.push('shown ' + notice.Revision + ' times');
@@ -342,6 +347,7 @@
Title: notice.Title, Title: notice.Title,
Body: notice.Body, Body: notice.Body,
RequireAccept: notice.RequireAccept, RequireAccept: notice.RequireAccept,
AcceptDelaySeconds: notice.AcceptDelaySeconds || 0,
Enabled: notice.Enabled, Enabled: notice.Enabled,
Target: { AllUsers: notice.Target.AllUsers, UserIds: notice.Target.UserIds } Target: { AllUsers: notice.Target.AllUsers, UserIds: notice.Target.UserIds }
}; };
@@ -413,6 +419,8 @@
byId('heraldTitle').value = notice ? notice.Title : ''; byId('heraldTitle').value = notice ? notice.Title : '';
byId('heraldBody').value = notice ? notice.Body : ''; byId('heraldBody').value = notice ? notice.Body : '';
byId('heraldRequireAccept').checked = notice ? notice.RequireAccept : false; byId('heraldRequireAccept').checked = notice ? notice.RequireAccept : false;
byId('heraldAcceptDelay').value = notice ? (notice.AcceptDelaySeconds || 0) : 0;
toggle(byId('heraldDelayField'), byId('heraldRequireAccept').checked);
byId('heraldEnabled').checked = notice ? notice.Enabled : true; byId('heraldEnabled').checked = notice ? notice.Enabled : true;
byId('heraldTarget').value = notice && !notice.Target.AllUsers ? 'selected' : 'all'; byId('heraldTarget').value = notice && !notice.Target.AllUsers ? 'selected' : 'all';
renderUserPicker(notice ? notice.Target.UserIds : []); renderUserPicker(notice ? notice.Target.UserIds : []);
@@ -448,6 +456,7 @@
Title: byId('heraldTitle').value, Title: byId('heraldTitle').value,
Body: byId('heraldBody').value, Body: byId('heraldBody').value,
RequireAccept: byId('heraldRequireAccept').checked, RequireAccept: byId('heraldRequireAccept').checked,
AcceptDelaySeconds: byId('heraldRequireAccept').checked ? (parseInt(byId('heraldAcceptDelay').value, 10) || 0) : 0,
Enabled: byId('heraldEnabled').checked, Enabled: byId('heraldEnabled').checked,
Target: { AllUsers: allUsers, UserIds: userIds } Target: { AllUsers: allUsers, UserIds: userIds }
}; };
@@ -617,6 +626,9 @@
byId('heraldAcksClose').addEventListener('click', closeAcks); byId('heraldAcksClose').addEventListener('click', closeAcks);
byId('heraldStatsRefresh').addEventListener('click', loadStats); byId('heraldStatsRefresh').addEventListener('click', loadStats);
byId('heraldNoticeForm').addEventListener('submit', submitForm); byId('heraldNoticeForm').addEventListener('submit', submitForm);
byId('heraldRequireAccept').addEventListener('change', function () {
toggle(byId('heraldDelayField'), this.checked);
});
byId('heraldTarget').addEventListener('change', function () { byId('heraldTarget').addEventListener('change', function () {
toggle(byId('heraldUsers'), byId('heraldTarget').value === 'selected'); toggle(byId('heraldUsers'), byId('heraldTarget').value === 'selected');
}); });
+5
View File
@@ -27,6 +27,11 @@ public class Notice
/// </summary> /// </summary>
public bool RequireAccept { get; set; } public bool RequireAccept { get; set; }
/// <summary>
/// Gets or sets the number of seconds the notice has to be on screen before it can be accepted.
/// </summary>
public int AcceptDelaySeconds { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether the notice is shown at all. /// Gets or sets a value indicating whether the notice is shown at all.
/// </summary> /// </summary>
@@ -20,6 +20,11 @@ public class NoticeDraft
/// </summary> /// </summary>
public bool RequireAccept { get; set; } public bool RequireAccept { get; set; }
/// <summary>
/// Gets or sets the number of seconds the notice has to be on screen before it can be accepted.
/// </summary>
public int AcceptDelaySeconds { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether the notice is shown. /// Gets or sets a value indicating whether the notice is shown.
/// </summary> /// </summary>
@@ -19,6 +19,11 @@ public static class NoticeRules
/// </summary> /// </summary>
public const int MaxBodyLength = 20000; public const int MaxBodyLength = 20000;
/// <summary>
/// Longest wait before a notice can be accepted, in seconds.
/// </summary>
public const int MaxAcceptDelaySeconds = 600;
/// <summary> /// <summary>
/// Checks whether a notice is addressed to a user. /// Checks whether a notice is addressed to a user.
/// </summary> /// </summary>
@@ -124,6 +129,11 @@ public static class NoticeRules
return "Body is too long."; return "Body is too long.";
} }
if (draft.AcceptDelaySeconds < 0 || draft.AcceptDelaySeconds > MaxAcceptDelaySeconds)
{
return "The wait before accepting has to be between 0 and 600 seconds.";
}
if (draft.Target is { AllUsers: false } target && (target.UserIds is null || target.UserIds.Count == 0)) if (draft.Target is { AllUsers: false } target && (target.UserIds is null || target.UserIds.Count == 0))
{ {
return "Select at least one user or address all users."; return "Select at least one user or address all users.";
@@ -210,6 +210,7 @@ public class NoticeService
notice.Title = (draft.Title ?? string.Empty).Trim(); notice.Title = (draft.Title ?? string.Empty).Trim();
notice.Body = (draft.Body ?? string.Empty).Replace("\r\n", "\n", StringComparison.Ordinal).Trim(); notice.Body = (draft.Body ?? string.Empty).Replace("\r\n", "\n", StringComparison.Ordinal).Trim();
notice.RequireAccept = draft.RequireAccept; notice.RequireAccept = draft.RequireAccept;
notice.AcceptDelaySeconds = draft.RequireAccept ? draft.AcceptDelaySeconds : 0;
notice.Enabled = draft.Enabled; notice.Enabled = draft.Enabled;
var allUsers = draft.Target?.AllUsers ?? true; var allUsers = draft.Target?.AllUsers ?? true;
@@ -50,6 +50,11 @@ public class HeraldDatabase
PRIMARY KEY (user_id, date) PRIMARY KEY (user_id, date)
); );
CREATE INDEX ix_watch_daily_date ON watch_daily (date); CREATE INDEX ix_watch_daily_date ON watch_daily (date);
""",
// 3: wait before a notice can be accepted
"""
ALTER TABLE notices ADD COLUMN accept_delay INTEGER NOT NULL DEFAULT 0;
""" """
]; ];
@@ -12,7 +12,7 @@ namespace Jellyfin.Plugin.Herald.Storage;
/// </summary> /// </summary>
public class SqliteNoticeStore : INoticeStore public class SqliteNoticeStore : INoticeStore
{ {
private const string NoticeColumns = "id, title, body, require_accept, enabled, target_all, target_users, revision, created_at, updated_at"; private const string NoticeColumns = "id, title, body, require_accept, enabled, target_all, target_users, revision, created_at, updated_at, accept_delay";
private const string AckColumns = "notice_id, revision, user_id, action, timestamp"; private const string AckColumns = "notice_id, revision, user_id, action, timestamp";
private readonly HeraldDatabase _database; private readonly HeraldDatabase _database;
@@ -66,12 +66,13 @@ public class SqliteNoticeStore : INoticeStore
connection, connection,
transaction, transaction,
""" """
INSERT INTO notices (id, title, body, require_accept, enabled, target_all, target_users, revision, created_at, updated_at) INSERT INTO notices (id, title, body, require_accept, enabled, target_all, target_users, revision, created_at, updated_at, accept_delay)
VALUES ($id, $title, $body, $requireAccept, $enabled, $targetAll, $targetUsers, $revision, $createdAt, $updatedAt) VALUES ($id, $title, $body, $requireAccept, $enabled, $targetAll, $targetUsers, $revision, $createdAt, $updatedAt, $acceptDelay)
ON CONFLICT (id) DO UPDATE SET ON CONFLICT (id) DO UPDATE SET
title = excluded.title, title = excluded.title,
body = excluded.body, body = excluded.body,
require_accept = excluded.require_accept, require_accept = excluded.require_accept,
accept_delay = excluded.accept_delay,
enabled = excluded.enabled, enabled = excluded.enabled,
target_all = excluded.target_all, target_all = excluded.target_all,
target_users = excluded.target_users, target_users = excluded.target_users,
@@ -88,6 +89,7 @@ public class SqliteNoticeStore : INoticeStore
command.Parameters.AddWithValue("$revision", notice.Revision); command.Parameters.AddWithValue("$revision", notice.Revision);
command.Parameters.AddWithValue("$createdAt", Db.Time(notice.CreatedAt)); command.Parameters.AddWithValue("$createdAt", Db.Time(notice.CreatedAt));
command.Parameters.AddWithValue("$updatedAt", Db.Time(notice.UpdatedAt)); command.Parameters.AddWithValue("$updatedAt", Db.Time(notice.UpdatedAt));
command.Parameters.AddWithValue("$acceptDelay", notice.AcceptDelaySeconds);
return command.ExecuteNonQuery(); return command.ExecuteNonQuery();
}); });
} }
@@ -184,6 +186,7 @@ public class SqliteNoticeStore : INoticeStore
Title = reader.GetString(1), Title = reader.GetString(1),
Body = reader.GetString(2), Body = reader.GetString(2),
RequireAccept = reader.GetBoolean(3), RequireAccept = reader.GetBoolean(3),
AcceptDelaySeconds = reader.GetInt32(10),
Enabled = reader.GetBoolean(4), Enabled = reader.GetBoolean(4),
Target = new NoticeTarget Target = new NoticeTarget
{ {
+48 -3
View File
@@ -186,7 +186,8 @@
'.heraldLink{color:var(--jf-palette-primary-main,#00a4dc);text-decoration:underline}', '.heraldLink{color:var(--jf-palette-primary-main,#00a4dc);text-decoration:underline}',
'.heraldFoot{flex:none;display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:.4em 1em;padding:.7em 1.7em 1.3em}', '.heraldFoot{flex:none;display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:.4em 1em;padding:.7em 1.7em 1.3em}',
'.heraldError{flex:1 1 12em;margin:0;font-size:.9em;color:var(--jf-palette-error-main,#e2574c)}', '.heraldError{flex:1 1 12em;margin:0;font-size:.9em;color:var(--jf-palette-error-main,#e2574c)}',
'.heraldButton.heraldButton{flex:none;margin:0;min-width:8.5em;justify-content:center;text-align:center}', '.heraldButton.heraldButton{flex:none;margin:0;min-width:8.5em;justify-content:center;text-align:center;font-variant-numeric:tabular-nums}',
'.heraldButton.heraldWaiting{opacity:.5;cursor:default}',
'@media (max-width:30em){.heraldBackdrop{padding:.6em;align-items:flex-end}.heraldMast{padding:1.2em 1.2em 0}', '@media (max-width:30em){.heraldBackdrop{padding:.6em;align-items:flex-end}.heraldMast{padding:1.2em 1.2em 0}',
'.heraldBody{padding:.8em 1.2em .2em}.heraldFoot{padding:.6em 1.2em 1.1em}.heraldButton.heraldButton{flex:1 1 100%}}', '.heraldBody{padding:.8em 1.2em .2em}.heraldFoot{padding:.6em 1.2em 1.1em}.heraldButton.heraldButton{flex:1 1 100%}}',
'@media (prefers-reduced-motion:reduce){.heraldBackdrop,.heraldSheet.heraldSheet{transition:none}}' '@media (prefers-reduced-motion:reduce){.heraldBackdrop,.heraldSheet.heraldSheet{transition:none}}'
@@ -228,6 +229,7 @@
var backdrop = element('div', 'heraldBackdrop'); var backdrop = element('div', 'heraldBackdrop');
// "dialog" and the button classes are jellyfin-web's own, so the active theme colors them. // "dialog" and the button classes are jellyfin-web's own, so the active theme colors them.
var sheet = element('div', 'heraldSheet dialog'); var sheet = element('div', 'heraldSheet dialog');
sheet.tabIndex = -1;
sheet.setAttribute('role', mustAccept ? 'alertdialog' : 'dialog'); sheet.setAttribute('role', mustAccept ? 'alertdialog' : 'dialog');
sheet.setAttribute('aria-modal', 'true'); sheet.setAttribute('aria-modal', 'true');
sheet.setAttribute('aria-labelledby', titleId); sheet.setAttribute('aria-labelledby', titleId);
@@ -266,6 +268,7 @@
button: button, button: button,
error: error, error: error,
sending: false, sending: false,
timer: null,
previousFocus: document.activeElement, previousFocus: document.activeElement,
onKey: null onKey: null
}; };
@@ -302,7 +305,45 @@
backdrop.classList.add('heraldIn'); backdrop.classList.add('heraldIn');
}); });
}); });
button.focus(); var wait = mustAccept ? Math.floor(Number(notice.AcceptDelaySeconds) || 0) : 0;
if (wait > 0) {
holdButton(state, wait);
sheet.focus();
} else {
button.focus();
}
}
// Keeps the button locked for the given number of seconds. Only time with the tab in view counts.
function holdButton(state, seconds) {
var button = state.button;
var label = button.textContent;
var left = seconds;
function paint() {
button.textContent = label + ' (' + left + ')';
}
button.disabled = true;
button.classList.add('heraldWaiting');
paint();
state.timer = setInterval(function () {
if (document.hidden) {
return;
}
left--;
if (left > 0) {
paint();
return;
}
clearInterval(state.timer);
state.timer = null;
button.textContent = label;
button.classList.remove('heraldWaiting');
button.disabled = false;
button.focus();
}, 1000);
} }
function keepFocusInside(e, sheet) { function keepFocusInside(e, sheet) {
@@ -325,7 +366,7 @@
} }
function respond(state, action) { function respond(state, action) {
if (state.sending || open !== state) { if (state.sending || state.timer || open !== state) {
return; return;
} }
state.sending = true; state.sending = true;
@@ -361,6 +402,10 @@
return; return;
} }
open = null; open = null;
if (state.timer) {
clearInterval(state.timer);
state.timer = null;
}
document.removeEventListener('keydown', state.onKey, true); document.removeEventListener('keydown', state.onKey, true);
if (state.backdrop.parentNode) { if (state.backdrop.parentNode) {
state.backdrop.parentNode.removeChild(state.backdrop); state.backdrop.parentNode.removeChild(state.backdrop);
+4 -2
View File
@@ -84,6 +84,7 @@ Jellyfin 10.11 has no "Custom HTML" setting in the dashboard. The branding page
**Notices tab** **Notices tab**
- *New notice*: title, message, whether it has to be accepted, whether it is enabled, and who gets it (all users, or users picked from a list). - *New notice*: title, message, whether it has to be accepted, whether it is enabled, and who gets it (all users, or users picked from a list).
- *Wait before "Accept" can be clicked*: for a must-accept notice, the number of seconds (0 to 600) the *Accept* button stays locked. It shows a countdown, and only time with the tab in view counts.
- The message is plain text and line breaks are kept. A small Markdown subset is understood: `**bold**`, `*italic*`, `[text](https://…)`, and lines starting with `- ` or `1. ` as lists. HTML is not interpreted; it shows up as text. - The message is plain text and line breaks are kept. A small Markdown subset is understood: `**bold**`, `*italic*`, `[text](https://…)`, and lines starting with `- ` or `1. ` as lists. HTML is not interpreted; it shows up as text.
- *Enabled* switches a notice off without deleting it. - *Enabled* switches a notice off without deleting it.
- *Re-show to everyone* shows the notice again to all addressed users, including those who already responded. Editing a notice does **not** do that. - *Re-show to everyone* shows the notice again to all addressed users, including those who already responded. Editing a notice does **not** do that.
@@ -91,7 +92,7 @@ Jellyfin 10.11 has no "Custom HTML" setting in the dashboard. The branding page
**What users see** **What users see**
One notice at a time, oldest first. A normal notice has a *Close* button; clicking outside or pressing Escape also closes it and counts as dismissed. A must-accept notice has only an *Accept* button; clicking outside and Escape do nothing. The script asks for new notices after login, after a user switch, and then every 10 minutes while the tab is visible. One notice at a time, oldest first. A normal notice has a *Close* button; clicking outside or pressing Escape also closes it and counts as dismissed. A must-accept notice has only an *Accept* button; clicking outside and Escape do nothing. If a wait is set, the button reads *Accept (12)* and unlocks when the countdown reaches zero. The script asks for new notices after login, after a user switch, and then every 10 minutes while the tab is visible.
**Stats tab** **Stats tab**
@@ -108,7 +109,7 @@ All routes are under `/Herald`. Authentication is Jellyfin's normal `Authorizati
| `POST` | `/Herald/Notices/{id}/Ack` | signed-in user | Body `{ "revision": 1, "action": "Accepted" }` (`Accepted` or `Dismissed`). `204` on success, `400` if a must-accept notice is dismissed, `404` if the notice is gone or not addressed to the caller, `409` if the revision is outdated. | | `POST` | `/Herald/Notices/{id}/Ack` | signed-in user | Body `{ "revision": 1, "action": "Accepted" }` (`Accepted` or `Dismissed`). `204` on success, `400` if a must-accept notice is dismissed, `404` if the notice is gone or not addressed to the caller, `409` if the revision is outdated. |
| `GET` | `/Herald/Notices` | admin | All notices. | | `GET` | `/Herald/Notices` | admin | All notices. |
| `GET` | `/Herald/Notices/{id}` | admin | One notice. | | `GET` | `/Herald/Notices/{id}` | admin | One notice. |
| `POST` | `/Herald/Notices` | admin | Create. Body: `Title`, `Body`, `RequireAccept`, `Enabled`, `Target: { AllUsers, UserIds }`. | | `POST` | `/Herald/Notices` | admin | Create. Body: `Title`, `Body`, `RequireAccept`, `AcceptDelaySeconds` (0 to 600, ignored unless `RequireAccept`), `Enabled`, `Target: { AllUsers, UserIds }`. |
| `PUT` | `/Herald/Notices/{id}` | admin | Update, same body. Keeps the revision. | | `PUT` | `/Herald/Notices/{id}` | admin | Update, same body. Keeps the revision. |
| `DELETE` | `/Herald/Notices/{id}` | admin | Delete the notice and its responses. | | `DELETE` | `/Herald/Notices/{id}` | admin | Delete the notice and its responses. |
| `POST` | `/Herald/Notices/{id}/Reshow` | admin | Bump the revision. | | `POST` | `/Herald/Notices/{id}/Reshow` | admin | Bump the revision. |
@@ -123,6 +124,7 @@ A notice looks like this:
"Title": "House rules", "Title": "House rules",
"Body": "Be nice.", "Body": "Be nice.",
"RequireAccept": true, "RequireAccept": true,
"AcceptDelaySeconds": 15,
"Enabled": true, "Enabled": true,
"Target": { "AllUsers": false, "UserIds": ["21b3bac6acfe496bbca02a21c21e36d4"] }, "Target": { "AllUsers": false, "UserIds": ["21b3bac6acfe496bbca02a21c21e36d4"] },
"Revision": 2, "Revision": 2,
+2 -2
View File
@@ -8,14 +8,14 @@
- **Client injection**: registered with the File Transformation plugin by reflection at startup; a warning is logged when that plugin is missing. Manual fallbacks are documented. - **Client injection**: registered with the File Transformation plugin by reflection at startup; a warning is logged when that plugin is missing. Manual fallbacks are documented.
- **Watch-time stats**: playback start/progress/stop events are turned into daily per-user aggregates; `GET /Herald/Stats` and a sortable "Stats" tab show them; a daily scheduled task drops rows older than 90 days. - **Watch-time stats**: playback start/progress/stop events are turned into daily per-user aggregates; `GET /Herald/Stats` and a sortable "Stats" tab show them; a daily scheduled task drops rows older than 90 days.
- **Storage**: one SQLite database in Jellyfin's data directory, using the `Microsoft.Data.Sqlite` that the server ships. Versioned migrations, serialized writes. - **Storage**: one SQLite database in Jellyfin's data directory, using the `Microsoft.Data.Sqlite` that the server ships. Versioned migrations, serialized writes.
- **Project plumbing**: xUnit test project (58 tests), `build.yaml` for jprm, a Gitea Actions workflow (build, test, package; tags and releases automatically when the version changes), the plugin repository `manifest.json`, `README.md`, `DECISIONS.md`. - **Project plumbing**: xUnit test project (64 tests), `build.yaml` for jprm, a Gitea Actions workflow (build, test, package; tags and releases automatically when the version changes), the plugin repository `manifest.json`, `README.md`, `DECISIONS.md`.
## What was verified, and how ## What was verified, and how
| Check | Result | | Check | Result |
| --- | --- | | --- | --- |
| `dotnet build -c Release` | Succeeds, 0 warnings, 0 errors (template analyzers kept, warnings as errors). | | `dotnet build -c Release` | Succeeds, 0 warnings, 0 errors (template analyzers kept, warnings as errors). |
| `dotnet test -c Release` | 58 passed. Covers watch-time deltas (pause, seek, gaps, stale sessions, midnight incl. a non-UTC zone), pending-notice selection (revision bump, targeting, disabled), ack validation, the SQLite stores incl. concurrent writes and migrations, and the index.html transformer. | | `dotnet test -c Release` | 64 passed. Covers watch-time deltas (pause, seek, gaps, stale sessions, midnight incl. a non-UTC zone), pending-notice selection (revision bump, targeting, disabled), ack validation, the SQLite stores incl. concurrent writes and migrations, and the index.html transformer. |
| `jprm plugin build` | Produces `artifacts/herald_1.0.0.0.zip` containing only `Jellyfin.Plugin.Herald.dll` and `meta.json`. `jprm repo add` accepted it and generated a manifest. | | `jprm plugin build` | Produces `artifacts/herald_1.0.0.0.zip` containing only `Jellyfin.Plugin.Herald.dll` and `meta.json`. `jprm repo add` accepted it and generated a manifest. |
| Docker, `jellyfin/jellyfin:10.11.11` + File Transformation 3.0.3.0 (its 10.11.11 build) | The zip from jprm was unpacked into `plugins/Herald_1.0.0.0/`. Log: `Loaded plugin: Herald 1.0.0.0`, `Registered the Herald client script with File Transformation 3.0.3.0`, scheduled task registered, no `[ERR]` lines. `/Plugins` reports both plugins as `Active`. | | Docker, `jellyfin/jellyfin:10.11.11` + File Transformation 3.0.3.0 (its 10.11.11 build) | The zip from jprm was unpacked into `plugins/Herald_1.0.0.0/`. Log: `Loaded plugin: Herald 1.0.0.0`, `Registered the Herald client script with File Transformation 3.0.3.0`, scheduled task registered, no `[ERR]` lines. `/Plugins` reports both plugins as `Active`. |
| Injection | `GET /web/index.html` and `GET /web/` contain the `<script data-herald-client … src="../Herald/client.js">` tag; script chunks are untouched. | | Injection | `GET /web/index.html` and `GET /web/` contain the `<script data-herald-client … src="../Herald/client.js">` tag; script chunks are untouched. |
+3 -4
View File
@@ -1,7 +1,7 @@
--- ---
name: "Herald" name: "Herald"
guid: "006114bd-2c46-407b-8b31-57199a10fb1c" guid: "006114bd-2c46-407b-8b31-57199a10fb1c"
version: "1.0.1.0" version: "1.1.0.0"
# Jellyfin 10.11.x. Built against Jellyfin.Controller / Jellyfin.Model 10.11.11 # Jellyfin 10.11.x. Built against Jellyfin.Controller / Jellyfin.Model 10.11.11
# (see Directory.Build.props). Plugins built for 10.11 do not load on 10.10 or 12.x. # (see Directory.Build.props). Plugins built for 10.11 do not load on 10.10 or 12.x.
targetAbi: "10.11.0.0" targetAbi: "10.11.0.0"
@@ -22,6 +22,5 @@ owner: "JoshiCodes"
artifacts: artifacts:
- "Jellyfin.Plugin.Herald.dll" - "Jellyfin.Plugin.Herald.dll"
changelog: > changelog: >
Notices now show up when other plugins (MediaBar, Home Screen Sections, ...) Must-accept notices can have a wait: the Accept button stays locked and
also change index.html through File Transformation. Herald has its own entry counts down for a set number of seconds.
in the dashboard sidebar.