Implement Watched Together shared viewing accounts
Replaces the plugin template with a working plugin that lets several users share one viewing account while keeping their individual watched lists accurate. Three pieces: - Auto-creating groups. Logging in as "alice+bob" with any named member's own password provisions the shared account and signs you in. Verified against 10.11.5: AuthenticateUser offers unmatched usernames to every enabled provider and re-queries afterwards, which is the hook this relies on. Gated on a real member password so knowing two usernames is not enough to create an account. - Multi-password authentication. IRequiresResolvedUser hands us the resolved shared account; each member's live stored hash is checked via ICryptoProvider.Verify. Deliberately avoids re-entering UserManager.AuthenticateUser, which would trip every member's failed-attempt counter whenever a different member's password matched. - One-way played-state sync. Shared account to members only, filtered to PlaybackFinished/TogglePlayed/Import so playback progress ticks are ignored. No loop guard needed: member writes carry a non-shared id. Membership is stored as user IDs rather than re-parsed from the username, so shared accounts can be renamed freely. The +/name collision resolves itself because Jellyfin only consults the plugin when no local user matches the typed name. Targets Jellyfin 10.11.x / net9.0. Adds Gitea CI (test, build, release), a builder image, and 34 tests covering the auth and sync rules.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Plugin.WatchedTogether.Configuration;
|
||||
|
||||
namespace Jellyfin.Plugin.WatchedTogether.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Creates shared accounts on demand from a separator-joined username typed at the login screen.
|
||||
/// </summary>
|
||||
public interface IDynamicGroupService
|
||||
{
|
||||
/// <summary>
|
||||
/// Attempts to authenticate a not-yet-existing shared account named like "alice+bob", creating
|
||||
/// it if the submitted password belongs to one of the named members.
|
||||
/// </summary>
|
||||
/// <param name="enteredUsername">The username typed at the login screen.</param>
|
||||
/// <param name="password">The submitted password.</param>
|
||||
/// <returns>
|
||||
/// The created group and the shared account's username, or <c>null</c> if the name is not a
|
||||
/// valid member combination or no named member's password matched.
|
||||
/// </returns>
|
||||
Task<DynamicGroupResult?> TryCreateFromLoginAsync(string enteredUsername, string password);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The outcome of a successful on-demand group creation.
|
||||
/// </summary>
|
||||
/// <param name="Group">The group that was created.</param>
|
||||
/// <param name="SharedUsername">The username of the shared account.</param>
|
||||
public record DynamicGroupResult(SharedGroup Group, string SharedUsername);
|
||||
Reference in New Issue
Block a user