mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-05 05:28:37 +01:00
feat(settings): unified server-URL resolver + field; adopt in Jellyseerr
Type a loose address (media.example.com, https://…, host:port) and the app finds the working, canonical URL. - utils/serverUrl: generic candidate generator (https-first, port/path preserved, no Jellyfin-specific ports), parallel-probe resolver, numeric semver compare, and a Jellyseerr probe (/api/v1/status, min 2.0.0). - useServerUrlResolver: idle -> resolving -> ok | error state machine with cancellation. - ServerUrlField: shared input that auto-resolves on blur, inline status chip (tap to re-test) + resolved URL, persists the canonical URL. - Jellyseerr settings adopt the field and log in with the resolved URL. Probe contract makes Streamystats/Jellyfin/Merlin a drop-in follow-up.
This commit is contained in:
16
utils/serverUrl/types.ts
Normal file
16
utils/serverUrl/types.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
/** Result of probing a single candidate URL for a specific service. */
|
||||
export type ServerProbeOutcome =
|
||||
| { status: "ok"; meta?: Record<string, unknown> }
|
||||
| { status: "version-too-low"; version?: string }
|
||||
| { status: "wrong-service" }
|
||||
| { status: "unreachable" };
|
||||
|
||||
/**
|
||||
* Validates one fully-qualified candidate URL for a given service.
|
||||
* Implementations must resolve (never reject) — map errors to "unreachable".
|
||||
* The provided signal is aborted on timeout or cancellation.
|
||||
*/
|
||||
export type ServerProbe = (
|
||||
url: string,
|
||||
signal: AbortSignal,
|
||||
) => Promise<ServerProbeOutcome>;
|
||||
Reference in New Issue
Block a user