Fichiers
jellyfin-plugin-sharelinks/Jellyfin.Plugin.ShareLinks/Tasks/CleanupShareLinksScheduledTask.cs
T
Franciskid f2b523be97 stop storing guest passwords, mint sessions server side
The old flow encrypted the guest password on disk next to its own key,
then sent it to the guest in the bootstrap HTML anyway. Now redemption
mints the session with ISessionManager.AuthenticateDirect and the page
only ever carries the session token. The guest account still gets a
random password nobody knows, so blank login stays impossible, but no
password is stored or sent anywhere anymore. Cleanup now defaults to
every 30 minutes instead of daily at 4am so expired guests die fast.
2026-07-08 00:50:20 +02:00

62 lignes
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Plugin.ShareLinks.Services;
using MediaBrowser.Model.Tasks;
namespace Jellyfin.Plugin.ShareLinks.Tasks;
/// <summary>
/// Scheduled task that expires share links past their <c>ExpiresAtUtc</c> and tears down
/// the associated guest users and tags.
/// </summary>
public sealed class CleanupShareLinksScheduledTask : IScheduledTask, IConfigurableScheduledTask
{
private readonly IShareLinkCleanupService _cleanupService;
/// <summary>Initializes a new instance of the <see cref="CleanupShareLinksScheduledTask"/> class.</summary>
public CleanupShareLinksScheduledTask(IShareLinkCleanupService cleanupService)
{
_cleanupService = cleanupService;
}
/// <inheritdoc />
public string Name => "Clean up ShareLinks";
/// <inheritdoc />
public string Key => "ShareLinksCleanup";
/// <inheritdoc />
public string Description => "Expires share links past their expiry time and removes their guest users and tags.";
/// <inheritdoc />
public string Category => "ShareLinks";
/// <inheritdoc />
public bool IsHidden => false;
/// <inheritdoc />
public bool IsEnabled => true;
/// <inheritdoc />
public bool IsLogged => true;
/// <inheritdoc />
public async Task ExecuteAsync(IProgress<double> progress, CancellationToken cancellationToken)
{
_ = progress;
await _cleanupService.CleanupAsync(cancellationToken).ConfigureAwait(false);
}
/// <inheritdoc />
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{
yield return new TaskTriggerInfo
{
Type = TaskTriggerInfoType.IntervalTrigger,
IntervalTicks = TimeSpan.FromMinutes(30).Ticks,
};
}
}