server

Methods

(static) Delete() → {void}

Reset server to defaults

Returns:
Type: 
void

(static) Discover(redirectCountopt) → {object}

Discovers server information and handles redirects.

Convention: all API calls should go through the ApiClient class via GetApi() (for example GetApi().GetUser()). Those functions bundle APIRequest() with a synchronous execution strategy (getJson, postVoid, etc.).

Discover() is an intentional exception: it must intercept the roUrlEvent to read GetResponseHeaders() so it can detect and persist server-side redirects. The api.* wrappers use GetToString() which follows redirects silently, making the redirect URL undetectable. By calling APIRequest() directly and executing async, we get the same auth header and HTTPS certificate setup without losing the redirect headers.

Parameters:
NameTypeAttributesDefaultDescription
redirectCountinteger<optional>
0

Internal counter for tracking redirects (default: 0)

Returns:

Server info with Error field set on failure

Type: 
object

(static) Populate() → {boolean}

Fetch and populate server info from Jellyfin API

Returns:
Type: 
boolean

(static) UpdateURL(url, originalUrlopt) → {boolean}

Update server URL and populate from API If not provided, the url parameter will be persisted. This preserves the user's input for multi-network access while allowing runtime discovery to use canonical URLs.

Parameters:
NameTypeAttributesDefaultDescription
urlstring

The URL to connect to (will be normalized for API calls)

originalUrlstring<optional>
""

Optional: The original user-entered URL to persist to registry.

Returns:
Type: 
boolean

(static) UrlToPersist(url, originalUrlopt) → {string}

The server URL to persist to the registry after a successful connection: the ORIGINAL URL (what the user entered), never the canonical one it was normalized or redirected to. Re-discovery then runs on every connection, so a canonical URL that only resolves on one network is never saved.

Parameters:
NameTypeAttributesDefaultDescription
urlstring

The URL UpdateURL was asked to connect to

originalUrlstring<optional>
""

The user-entered URL, when the caller has one

Returns:
Type: 
string