feat(jellyfin): the instance suggests a Jellyfin server, signed in to with a tap

An instance now names a Jellyfin server for its people to learn from
(instance.info().jellyfinUrl): its operator's JELLYFIN_URL (`none`: none),
else https://jellyfin. on the domain registered for its public host, as
learn.halkyon.eu suggests jellyfin.halkyon.eu, once that answers as a
Jellyfin server. The registered domain comes from Mozilla's Public Suffix
List, kept in the server's data folder, so an instance at example.co.uk
never names someone else's jellyfin.co.uk. The instance looks as it
starts and again hourly when asked; the app never reaches for a guessed
address.

In the app, Add material offers From Jellyfin as soon as the instance
suggests a server, before anyone signed in to one. The sign-in fills the
server in and finds it by itself, and lists the people the server shows
on its login screen: one without a password, as a demo's, signs in with
a tap; one with a password is named in the form, which asks for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-13 23:25:33 +02:00
commit 85506ac7eb
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -32,6 +32,10 @@ class FakeJellyfinGateway({
/// Whether the Quick Connect code was approved.
bool approved = false;
/// The people the server shows on its login screen; those without a
/// password sign in with none.
List<JellyfinPublicUser> shownUsers = const [];
/// What was reported of playbacks: their positions, in order.
final reports = <({Duration position, bool started, bool stopped})>[];
@ -47,10 +51,14 @@ class FakeJellyfinGateway({
}
}
JellyfinAccount _account(String token) => JellyfinAccount(
JellyfinAccount _account(
String token, {
String userId = 'user-1',
String userName = 'mika',
}) => JellyfinAccount(
server: fakeJellyfinServer,
userId: 'user-1',
userName: 'mika',
userId: userId,
userName: userName,
token: token,
);
@ -71,12 +79,21 @@ class FakeJellyfinGateway({
@override
Future<bool> quickConnectEnabled(JellyfinServer server) async => true;
@override
Future<List<JellyfinPublicUser>> publicUsers(JellyfinServer server) async =>
shownUsers;
@override
Future<JellyfinAccount> signIn(
JellyfinServer server,
String user,
String password,
) async {
for (final public in shownUsers) {
if (public.name == user && !public.hasPassword && password.isEmpty) {
return _account('token-3', userId: public.id, userName: public.name);
}
}
if (user != 'mika' || password != 'secret') {
throw JellyfinException(problem: JellyfinProblem.wrongCredentials);
}