mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-04 21:18:31 +01:00
The resolver field only needs to find the working URL — the Jellyseerr version requirement is irrelevant there and only polluted the UI. - jellyseerrProbe: validate reachability + that it's a jellyseerr (no version gate, no version-too-low outcome). - Drop the version-too-low reason from the whole resolver stack (types, resolve, hook, status text, i18n). - Min version 2.0.0 stays enforced in JellyseerrApi.test() at login: now writes an error log + toast, and uses numeric isVersionBelow (fixes the "2.10.0" < "2.0.0" string-compare bug).
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import axios from "axios";
|
|
import type { ServerProbe } from "../types";
|
|
|
|
/**
|
|
* Probe for a Jellyseerr server. `/api/v1/status` is jellyseerr/overseerr
|
|
* specific and unauthenticated, so it both proves reachability and confirms we
|
|
* hit the right service. The minimum-version requirement is enforced at login
|
|
* time (see JellyseerrApi.test) — not surfaced here, to keep the field UI clean.
|
|
*/
|
|
export const jellyseerrProbe: ServerProbe = async (url, signal) => {
|
|
try {
|
|
const { status, data } = await axios.get(`${url}/api/v1/status`, {
|
|
signal,
|
|
timeout: 8000, // backstop; the resolver aborts via signal first
|
|
});
|
|
|
|
if (status < 200 || status >= 300) return { status: "unreachable" };
|
|
|
|
// A JSON body carrying version/commitTag identifies a real jellyseerr.
|
|
const looksLikeJellyseerr =
|
|
!!data &&
|
|
typeof data === "object" &&
|
|
(typeof data.version === "string" || "commitTag" in data);
|
|
if (!looksLikeJellyseerr) return { status: "wrong-service" };
|
|
|
|
return { status: "ok", meta: { version: data.version } };
|
|
} catch {
|
|
return { status: "unreachable" };
|
|
}
|
|
};
|