9 Commits
Author SHA1 Message Date
JoshiCodes fe4e1b843e chore: add v1.1.0.0 to the plugin manifest [skip ci] 2026-11-13 21:48:01 +00:00
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
JoshiCodes 28b6244a17 ci: serve the plugin repository from manifest.json on main
Build / build (push) Successful in 1m50s
The install URL is now the raw manifest in the source tree. The workflow
adds each release to it and commits it back.
2026-11-13 22:37:04 +01:00
JoshiCodes 9e38c98da2 chore: release 1.0.1.0
Build / build (push) Successful in 1m52s
2026-11-13 22:34:31 +01:00
JoshiCodes ea28ad29ac docs: describe the shared pattern and the sidebar entry 2026-11-13 22:34:31 +01:00
JoshiCodes dea2569fd7 feat: add Herald to the dashboard sidebar 2026-11-13 22:34:31 +01:00
JoshiCodes 9c89852e97 fix: register the index.html transformation under the shared pattern
File Transformation only runs the callbacks whose pattern string equals
the requested path, so the anchored pattern was skipped whenever another
plugin had registered the plain one. Script chunks that match the pattern
as a regex are returned unchanged.
2026-11-13 22:34:31 +01:00
23 changed files with 235 additions and 46 deletions
+21 -12
View File
@@ -69,24 +69,15 @@ jobs:
jprm plugin build . --output artifacts --version "${{ steps.version.outputs.version }}" jprm plugin build . --output artifacts --version "${{ steps.version.outputs.version }}"
ls -l artifacts ls -l artifacts
# The repository manifest travels with the releases: take the one from the # manifest.json in the source tree is the plugin repository users install from.
# latest release, add this version, and publish it again as an asset. # Add this version to it; it is committed back once the release exists.
- name: Update repository manifest - name: Update repository manifest
if: steps.version.outputs.release == 'true' if: steps.version.outputs.release == 'true'
env: env:
TOKEN: ${{ secrets.GITEA_TOKEN }}
TAG: ${{ steps.version.outputs.tag }} TAG: ${{ steps.version.outputs.tag }}
run: | run: |
api="$GITHUB_API_URL/repos/$GITHUB_REPOSITORY"
mkdir -p repo mkdir -p repo
previous="$(curl -fsS -H "Authorization: token $TOKEN" "$api/releases/latest" 2>/dev/null \ cp manifest.json repo/manifest.json
| python3 -c 'import json,sys; print(next((a["browser_download_url"] for a in json.load(sys.stdin).get("assets", []) if a["name"] == "manifest.json"), ""))' 2>/dev/null || true)"
if [ -n "$previous" ] && curl -fsSL -H "Authorization: token $TOKEN" -o repo/manifest.json "$previous"; then
echo "Continuing the manifest of the latest release"
else
rm -f repo/manifest.json
jprm repo init repo
fi
zip="$(ls artifacts/*.zip)" zip="$(ls artifacts/*.zip)"
jprm repo add \ jprm repo add \
@@ -123,3 +114,21 @@ jobs:
-F "attachment=@$file" "$api/releases/$id/assets?name=$(basename "$file")" > /dev/null -F "attachment=@$file" "$api/releases/$id/assets?name=$(basename "$file")" > /dev/null
echo "Attached $(basename "$file")" echo "Attached $(basename "$file")"
done done
- name: Commit repository manifest
if: steps.version.outputs.release == 'true'
env:
TOKEN: ${{ secrets.GITEA_TOKEN }}
TAG: ${{ steps.version.outputs.tag }}
run: |
cp artifacts/manifest.json manifest.json
if git diff --quiet -- manifest.json; then
echo "manifest.json is already up to date"
exit 0
fi
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@noreply.${GITHUB_SERVER_URL#*://}"
git add manifest.json
git commit -m "chore: add $TAG to the plugin manifest [skip ci]"
git push "${GITHUB_SERVER_URL%%://*}://x-access-token:$TOKEN@${GITHUB_SERVER_URL#*://}/$GITHUB_REPOSITORY.git" HEAD:main
+8 -3
View File
@@ -7,7 +7,7 @@ One line per decision, with the reason.
- Target Jellyfin **10.11.11** (`Jellyfin.Controller` / `Jellyfin.Model` 10.11.11, `net9.0`): it is the last 10.11 release on NuGet; the nuspec of that package lists `net9.0` as its only framework. Versions live in `Directory.Build.props`. - Target Jellyfin **10.11.11** (`Jellyfin.Controller` / `Jellyfin.Model` 10.11.11, `net9.0`): it is the last 10.11 release on NuGet; the nuspec of that package lists `net9.0` as its only framework. Versions live in `Directory.Build.props`.
- `targetAbi` is `10.11.0.0`: the plugin only uses APIs that exist across 10.11, so it should not be pinned to the patch release it was compiled against. - `targetAbi` is `10.11.0.0`: the plugin only uses APIs that exist across 10.11, so it should not be pinned to the patch release it was compiled against.
- Removed the template's `.github` workflows and Renovate preset: they call reusable workflows and secrets of the Jellyfin organisation and cannot run elsewhere. Replaced by one self-contained workflow for Gitea Actions in `.gitea/workflows`; it talks to the Gitea API with `curl`, so it needs no forge-specific CLI on the runner. - Removed the template's `.github` workflows and Renovate preset: they call reusable workflows and secrets of the Jellyfin organisation and cannot run elsewhere. Replaced by one self-contained workflow for Gitea Actions in `.gitea/workflows`; it talks to the Gitea API with `curl`, so it needs no forge-specific CLI on the runner.
- Releases are driven by the version, not by hand-made tags: a push to `main` whose `build.yaml` version has no `v<version>` tag is tagged and released by the workflow. The plugin repository manifest is a release asset carried forward from release to release, so nothing has to be committed back by CI. - Releases are driven by the version, not by hand-made tags: a push to `main` whose `build.yaml` version has no `v<version>` tag is tagged and released by the workflow. The plugin repository is `manifest.json` in the source tree, installed through its raw link on `main`; the workflow adds each release to it and commits the file back (`[skip ci]`), so the install URL does not depend on a release asset.
- Removed the template's `.vscode` folder: it assumes a local checkout of the Jellyfin server and web client next to the repo. - Removed the template's `.vscode` folder: it assumes a local checkout of the Jellyfin server and web client next to the repo.
- No analyzer warnings are suppressed project-wide. The only suppressions are three `CA2100` pragmas in `Storage/` where a command text is assigned from a constant string, which the analyzer cannot see through a helper. - No analyzer warnings are suppressed project-wide. The only suppressions are three `CA2100` pragmas in `Storage/` where a command text is assigned from a constant string, which the analyzer cannot see through a helper.
- The test project does not reference the StyleCop/`AllEnabledByDefault` analyzer set: XML docs and naming rules on test methods add noise without value. It still builds with warnings as errors. - The test project does not reference the StyleCop/`AllEnabledByDefault` analyzer set: XML docs and naming rules on test methods add noise without value. It still builds with warnings as errors.
@@ -29,19 +29,24 @@ 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
- Registration with File Transformation is done purely by reflection, including building the payload: the `JObject` is created by calling `Parse` on the parameter type of `RegisterTransformation`, so the plugin has no Newtonsoft reference of its own. - Registration with File Transformation is done purely by reflection, including building the payload: the `JObject` is created by calling `Parse` on the parameter type of `RegisterTransformation`, so the plugin has no Newtonsoft reference of its own.
- The file pattern is `^index\.html$`. File Transformation treats patterns as regular expressions, and the unanchored `index.html` also matched the script chunk `session-login-index-html.<hash>.chunk.js`, which broke the login page. Found in the container test. - The file pattern is the literal `index.html`, the same string every other plugin registers. File Transformation groups callbacks by pattern string and, for a request, runs only the group whose key equals the requested path; a regex fallback is used only when no key matches exactly. The earlier anchored `^index\.html$` was therefore never called once MediaBar (or any plugin using `index.html`) was installed. Found by reproducing a server with MediaBar and Jellyfin Enhanced.
- The transformer leaves anything without a `</body>` alone, as a second line of defence against touching non-HTML files. - As a regular expression `index.html` also matches script chunks such as `session-login-index-html.<hash>.chunk.js`, so those are handed to the callback too. The transformer returns anything that is not an HTML page (`<html` and `</body>` present) unchanged.
- The script tag uses the relative URL `../Herald/client.js` so it keeps working behind a base URL. - The script tag uses the relative URL `../Herald/client.js` so it keeps working behind a base URL.
- `GET /Herald/client.js` is anonymous: a `<script>` tag cannot send Jellyfin's auth header, and the file holds nothing secret. - `GET /Herald/client.js` is anonymous: a `<script>` tag cannot send Jellyfin's auth header, and the file holds nothing secret.
- Jellyfin 10.11 has **no "Custom HTML" setting** (branding only offers custom CSS, a login disclaimer and the splash screen; checked against `BrandingOptions`). The documented manual fallbacks are therefore the JavaScript Injector plugin and editing `index.html`. - Jellyfin 10.11 has **no "Custom HTML" setting** (branding only offers custom CSS, a login disclaimer and the splash screen; checked against `BrandingOptions`). The documented manual fallbacks are therefore the JavaScript Injector plugin and editing `index.html`.
- Login and user switches are detected by comparing `ApiClient.getCurrentUserId()` on a 3 s local timer. That costs no request; the server is only asked after a change of user and then at most every 10 minutes. jellyfin-web's own login events are not reachable from an injected script in a stable way. - Login and user switches are detected by comparing `ApiClient.getCurrentUserId()` on a 3 s local timer. That costs no request; the server is only asked after a change of user and then at most every 10 minutes. jellyfin-web's own login events are not reachable from an injected script in a stable way.
- The modal reuses jellyfin-web's `dialog`, `raised`, `button-submit` and `emby-button` classes so the active theme colours it; own CSS only handles layout. - The modal reuses jellyfin-web's `dialog`, `raised`, `button-submit` and `emby-button` classes so the active theme colours it; own CSS only handles layout.
## Admin UI
- The config page is flagged `EnableInMainMenu`, so it has its own entry in the dashboard sidebar under "Plugins". Jellyfin 10.11 draws a fixed icon there; `MenuIcon` is set for versions that honour it.
## Watch-time stats ## Watch-time stats
- Time is measured on the **server clock between two reports** of the same playback, not from playback positions: a seek changes the position by minutes without anyone watching, and position deltas also break with playback speed. - Time is measured on the **server clock between two reports** of the same playback, not from playback positions: a seek changes the position by minutes without anyone watching, and position deltas also break with playback speed.
+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.0.0</Version> <Version>1.1.0.0</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion> <AssemblyVersion>1.1.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion> <FileVersion>1.1.0.0</FileVersion>
</PropertyGroup> </PropertyGroup>
</Project> </Project>
@@ -31,6 +31,25 @@ public class IndexHtmlTransformerTests
Assert.Equal(Script, IndexHtmlTransformer.Inject(Script)); Assert.Equal(Script, IndexHtmlTransformer.Inject(Script));
} }
[Fact]
public void Inject_LeavesScriptsThatMentionABodyTagAlone()
{
const string Script = "(self.webpackChunk=self.webpackChunk||[]).push([[17244],{t:\"<div></div></body>\"}]);";
Assert.Equal(Script, IndexHtmlTransformer.Inject(Script));
}
[Fact]
public void Inject_KeepsTagsOtherPluginsAdded()
{
const string Other = "<script defer src=\"../MediaBar/slideshowpure.js\"></script>";
var page = Page.Replace("</body>", Other + "</body>", StringComparison.Ordinal);
var result = IndexHtmlTransformer.Inject(page);
Assert.Contains(Other + IndexHtmlTransformer.ScriptTag + "</body>", result, StringComparison.Ordinal);
}
[Fact] [Fact]
public void Transform_HandlesAnEmptyPayload() public void Transform_HandlesAnEmptyPayload()
{ {
@@ -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');
}); });
@@ -17,9 +17,11 @@ namespace Jellyfin.Plugin.Herald.Injection;
public class FileTransformationRegistrar : IHostedService public class FileTransformationRegistrar : IHostedService
{ {
private const string InterfaceTypeName = "Jellyfin.Plugin.FileTransformation.PluginInterface"; private const string InterfaceTypeName = "Jellyfin.Plugin.FileTransformation.PluginInterface";
// File Transformation treats this as a regular expression. Unanchored, "index.html" would also // Has to be the literal "index.html" every other plugin registers. File Transformation groups
// match script chunks such as "session-login-index-html.<hash>.chunk.js". // callbacks by pattern string and, for a request, only runs the group whose key equals the path;
private const string IndexHtmlPattern = @"^index\.html$"; // a differently spelled pattern is skipped as soon as another plugin uses the plain one.
// The pattern is also used as a regex and matches some script chunks, which the transformer ignores.
private const string IndexHtmlPattern = "index.html";
private static readonly Guid _transformationId = Guid.Parse("bf6fabc9-721c-46d9-9e13-3cc415a9ae1b"); private static readonly Guid _transformationId = Guid.Parse("bf6fabc9-721c-46d9-9e13-3cc415a9ae1b");
private readonly ILogger<FileTransformationRegistrar> _logger; private readonly ILogger<FileTransformationRegistrar> _logger;
@@ -37,7 +37,7 @@ public static class IndexHtmlTransformer
} }
/// <summary> /// <summary>
/// Inserts the script tag before the closing body tag. Content without one is not a page and is left alone. /// Inserts the script tag before the closing body tag. Anything that is not an HTML page is left alone.
/// </summary> /// </summary>
/// <param name="html">The page.</param> /// <param name="html">The page.</param>
/// <returns>The page with the script tag.</returns> /// <returns>The page with the script tag.</returns>
@@ -50,6 +50,12 @@ public static class IndexHtmlTransformer
return html; return html;
} }
// File Transformation also hands over script chunks whose name happens to match the pattern.
if (!html.Contains("<html", StringComparison.OrdinalIgnoreCase))
{
return html;
}
var index = html.LastIndexOf("</body>", StringComparison.OrdinalIgnoreCase); var index = html.LastIndexOf("</body>", StringComparison.OrdinalIgnoreCase);
return index < 0 ? html : html.Insert(index, ScriptTag); return index < 0 ? html : html.Insert(index, ScriptTag);
} }
+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;
+3
View File
@@ -47,6 +47,9 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
new PluginPageInfo new PluginPageInfo
{ {
Name = Name, Name = Name,
DisplayName = Name,
EnableInMainMenu = true,
MenuIcon = "campaign",
EmbeddedResourcePath = string.Format(CultureInfo.InvariantCulture, "{0}.Configuration.configPage.html", GetType().Namespace) EmbeddedResourcePath = string.Format(CultureInfo.InvariantCulture, "{0}.Configuration.configPage.html", GetType().Namespace)
} }
]; ];
@@ -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);
+10 -6
View File
@@ -19,7 +19,7 @@ Watch-time stats are collected on the server and cover all clients.
### From a plugin repository ### From a plugin repository
1. In Jellyfin: **Dashboard → Plugins → Manage Repositories → New Repository**, enter `https://github.com/JoshiCodes/jellyfin-Herald/releases/latest/download/manifest.json`. 1. In Jellyfin: **Dashboard → Plugins → Manage Repositories → New Repository**, enter `https://git.joshicodes.de/JoshiCodes/jellyfin-herald/raw/branch/main/manifest.json`.
2. Install **Herald** from the catalogue and restart the server. 2. Install **Herald** from the catalogue and restart the server.
### Manually ### Manually
@@ -28,7 +28,7 @@ Watch-time stats are collected on the server and cover all clients.
2. Unpack it into `plugins/Herald_<version>/` inside the Jellyfin data directory, for example `/config/plugins/Herald_1.0.0.0/` in the official container. The folder holds `Jellyfin.Plugin.Herald.dll` and `meta.json`. 2. Unpack it into `plugins/Herald_<version>/` inside the Jellyfin data directory, for example `/config/plugins/Herald_1.0.0.0/` in the official container. The folder holds `Jellyfin.Plugin.Herald.dll` and `meta.json`.
3. Restart Jellyfin. The log shows `Loaded plugin: Herald`. 3. Restart Jellyfin. The log shows `Loaded plugin: Herald`.
The settings page is under **Dashboard → Plugins → Herald**. Herald has its own entry in the dashboard sidebar, in the **Plugins** section. The same page opens from **Dashboard → Plugins → Herald**.
## Getting the popup into the web client ## Getting the popup into the web client
@@ -52,6 +52,8 @@ The File Transformation plugin is not installed, so the Herald client script is
File Transformation releases are tied to exact Jellyfin versions, so pick the build that matches your server. File Transformation releases are tied to exact Jellyfin versions, so pick the build that matches your server.
To check the result, open `http://<server>/web/index.html` and look for `data-herald-client` in the source. Other plugins that use File Transformation (MediaBar, Home Screen Sections, Jellyfin Enhanced and so on) can be installed alongside.
### Fallback: JavaScript Injector ### Fallback: JavaScript Injector
With the [JavaScript Injector](https://github.com/n00bcodr/Jellyfin-JavaScript-Injector) plugin, add a script with this content and enable it: With the [JavaScript Injector](https://github.com/n00bcodr/Jellyfin-JavaScript-Injector) plugin, add a script with this content and enable it:
@@ -82,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.
@@ -89,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**
@@ -106,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. |
@@ -121,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,
@@ -181,11 +185,11 @@ This writes `artifacts/herald_<version>.zip`. The Jellyfin version, target frame
The version lives in `build.yaml` (`version`) and `Directory.Build.props` (`Version`, `AssemblyVersion`, `FileVersion`); keep them equal, the workflow fails otherwise. Put the release notes in `changelog` in `build.yaml`. The version lives in `build.yaml` (`version`) and `Directory.Build.props` (`Version`, `AssemblyVersion`, `FileVersion`); keep them equal, the workflow fails otherwise. Put the release notes in `changelog` in `build.yaml`.
Every push to `main` builds and tests. If the version has no `v<version>` tag yet, the workflow (`.gitea/workflows/build.yaml`, Gitea Actions) also creates that tag and a release with two assets: the plugin zip and a `manifest.json` that lists this and all earlier releases. So a release is: bump the version, push. Every push to `main` builds and tests. If the version has no `v<version>` tag yet, the workflow (`.gitea/workflows/build.yaml`, Gitea Actions) also creates that tag and a release with the plugin zip, adds the version to `manifest.json` and commits that file back to `main`. So a release is: bump the version, push, and pull the manifest commit afterwards.
## Hosting your own repository ## Hosting your own repository
The `manifest.json` attached to the latest release is a complete plugin repository; the URL under [Installation](#installation) always points at it. The `manifest.json` in the source tree is only a sample of the format. The `manifest.json` in the source tree is a complete plugin repository; the URL under [Installation](#installation) is its raw link on `main`. A copy is attached to every release.
To host it elsewhere, build the manifest yourself: To host it elsewhere, build the manifest yourself:
+5 -5
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 (56 tests), `build.yaml` for jprm, a Gitea Actions workflow (build, test, package; tags and releases automatically when the version changes), a sample `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` | 56 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. |
@@ -25,14 +25,14 @@
| Popup (headless Chromium, logged in as a normal user) | Must-accept notice shows only "Accept", Escape and outside click do nothing; next notice shows "Close" and Escape dismisses it; one `Pending` request after login and none on navigation; HTML and `javascript:` links in a notice are rendered as text. | | Popup (headless Chromium, logged in as a normal user) | Must-accept notice shows only "Accept", Escape and outside click do nothing; next notice shows "Close" and Escape dismisses it; one `Pending` request after login and none on navigation; HTML and `javascript:` links in a notice are rendered as text. |
| Stats end to end | A playback was reported through `/Sessions/Playing*` for a generated test video: 5 s + 5 s playing, 6 s paused, 4 s + 3 s playing with a seek in between. Stored: 17.15 s, 1 play. | | Stats end to end | A playback was reported through `/Sessions/Playing*` for a generated test video: 5 s + 5 s playing, 6 s paused, 4 s + 3 s playing with a seek in between. Stored: 17.15 s, 1 play. |
Two bugs were found and fixed through the container test: the unanchored File Transformation pattern also matched a JavaScript chunk and broke the login page, and jellyfin-web's `document.createElement` shim rejected the element-options form used by the admin page. Two bugs were found and fixed through the container test: the transformer touched a JavaScript chunk that File Transformation also matches against the `index.html` pattern, which broke the login page, and jellyfin-web's `document.createElement` shim rejected the element-options form used by the admin page.
## Known gaps ## Known gaps
- Notices only appear in clients built on jellyfin-web. Native clients are not covered and cannot be from a plugin. - Notices only appear in clients built on jellyfin-web. Native clients are not covered and cannot be from a plugin.
- The popup was tested against the default dark theme in Chromium. Other themes, the TV layout and real mobile wrappers were not tried. - The popup was tested in Chromium against the default dark theme and NeutralFin, at desktop and phone size. The TV layout and real mobile wrappers were not tried.
- The JavaScript Injector fallback and the manual `index.html` edit are documented but were not run. - The JavaScript Injector fallback and the manual `index.html` edit are documented but were not run.
- File Transformation was tested in version 3.0.3.0 only. Its registration API is found by reflection, so a rename on their side turns into the logged warning, not a crash. - File Transformation was tested in version 3.0.3.0 only, alone and together with MediaBar 3.0.2.0 and Jellyfin Enhanced 12.15.0.0. Its registration API is found by reflection, so a rename on their side turns into the logged warning, not a crash.
- Stats were verified with simulated reports, not with a real player. The systematic inaccuracies are listed in the README. - Stats were verified with simulated reports, not with a real player. The systematic inaccuracies are listed in the README.
- The UI is English only. - The UI is English only.
- Must-accept is a record of consent, not an access gate: nothing on the server is blocked for users who have not accepted. - Must-accept is a record of consent, not an access gate: nothing on the server is blocked for users who have not accepted.
+3 -2
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.0.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,4 +22,5 @@ owner: "JoshiCodes"
artifacts: artifacts:
- "Jellyfin.Plugin.Herald.dll" - "Jellyfin.Plugin.Herald.dll"
changelog: > changelog: >
Initial release: notices with acknowledgement tracking, watch-time stats. Must-accept notices can have a wait: the Accept button stays locked and
counts down for a set number of seconds.
+20 -4
View File
@@ -2,19 +2,35 @@
{ {
"guid": "006114bd-2c46-407b-8b31-57199a10fb1c", "guid": "006114bd-2c46-407b-8b31-57199a10fb1c",
"name": "Herald", "name": "Herald",
"description": "Admins write notices that pop up once per user in the web client, optionally requiring the user to accept them, and can see who responded. Also keeps an approximate per-user watch time for the last weeks.\nShowing notices automatically needs the File Transformation plugin (https://github.com/IAmParadox27/jellyfin-plugin-file-transformation), which is not bundled.\n", "description": "Admins write notices that pop up once per user in the web client, optionally requiring the user to accept them, and can see who responded. Also keeps an approximate per-user watch time for the last weeks.\nShowing notices automatically needs the File Transformation plugin (https://github.com/IAmParadox27/jellyfin-plugin-file-transformation), which is not bundled. Without it the client script has to be added by hand, see the README. Microsoft.Data.Sqlite is used from the Jellyfin server itself and is not bundled either.\n",
"overview": "One-time notices for your users and simple watch-time stats", "overview": "One-time notices for your users and simple watch-time stats",
"owner": "JoshiCodes", "owner": "JoshiCodes",
"category": "General", "category": "General",
"versions": [ "versions": [
{
"version": "1.1.0.0",
"changelog": "Must-accept notices can have a wait: the Accept button stays locked and counts down for a set number of seconds.\n",
"targetAbi": "10.11.0.0",
"sourceUrl": "https://git.joshicodes.de/JoshiCodes/jellyfin-herald/releases/download/v1.1.0.0/herald_1.1.0.0.zip",
"checksum": "fa36bfeb9ae3b9c3ef2c1b8b213523c0",
"timestamp": "2026-11-13T21:47:58Z"
},
{
"version": "1.0.1.0",
"changelog": "Notices now show up when other plugins (MediaBar, Home Screen Sections, ...) also change index.html through File Transformation. Herald has its own entry in the dashboard sidebar.\n",
"targetAbi": "10.11.0.0",
"sourceUrl": "https://git.joshicodes.de/JoshiCodes/jellyfin-herald/releases/download/v1.0.1.0/herald_1.0.1.0.zip",
"checksum": "a65e32fbc536fa668a544739e24766a5",
"timestamp": "2026-11-13T21:36:23Z"
},
{ {
"version": "1.0.0.0", "version": "1.0.0.0",
"changelog": "Initial release: notices with acknowledgement tracking, watch-time stats.\n", "changelog": "Initial release: notices with acknowledgement tracking, watch-time stats.\n",
"targetAbi": "10.11.0.0", "targetAbi": "10.11.0.0",
"sourceUrl": "https://git.joshicodes.de/JoshiCodes/jellyfin-herald/releases/download/v1.0.0.0/herald_1.0.0.0.zip", "sourceUrl": "https://git.joshicodes.de/JoshiCodes/jellyfin-herald/releases/download/v1.0.0.0/herald_1.0.0.0.zip",
"checksum": "00000000000000000000000000000000", "checksum": "6bf1e0b971dc178c9b86d48a07d657d2",
"timestamp": "2026-11-13T00:00:00Z" "timestamp": "2026-11-13T18:10:25Z"
} }
] ]
} }
] ]