// Presentation of the backend's server-compatibility verdict. // // The decision is Rust's — see `ServerCompatibility` in `auth/mod.rs`. This file // decides only how it *reads*, which is presentation and changes only if the UI // is redesigned. Nothing here compares a version number, and nothing here may // start to: the backend sends an opaque state precisely so the frontend cannot. // // TRACES: UR-085 | DR-286 import type { ServerCompatibility } from "$lib/api/bindings"; export interface CompatibilityNotice { /** Blocks going on to the login step. Only a server below the floor does. */ blocking: boolean; tone: "error" | "warning"; message: string; } /** * What to show the user about a server's version, or `null` when there is * nothing worth saying — which is the common case. */ export function compatibilityNotice( compatibility: ServerCompatibility, serverVersion: string, ): CompatibilityNotice | null { switch (compatibility.type) { case "supported": return null; case "unknownVersion": // Not worth interrupting anyone over: the server almost certainly works, // and we simply could not read what it called itself. return null; case "newerThanKnown": return { blocking: false, tone: "warning", message: `This server (${serverVersion}) is newer than this version of JellyTau. ` + `It should work normally — update the app if anything looks wrong.`, }; case "tooOld": return { blocking: true, tone: "error", message: `This server runs Jellyfin ${serverVersion}. JellyTau needs ` + `${compatibility.minimum} or newer.`, }; } }