Methods
(static) getBaseUrl(url) → {string}
Extract base URL (scheme + authority) from a full URL
| Name | Type | Description |
|---|---|---|
url | string | The full URL |
- Source
Base URL (e.g., "https://example.com:8096"), or empty string if invalid
- Type:
- string
(static) getServerBaseUrl(url, endpointPath) → {string}
Extract server base URL by removing a known endpoint path suffix This preserves any base path (e.g., /jellyfin) unlike getBaseUrl() which strips all paths
| Name | Type | Description |
|---|---|---|
url | string | The full URL (e.g., "https://host/jellyfin/system/info/public") |
endpointPath | string | The endpoint path to remove (e.g., "/system/info/public") |
- Source
Base URL with preserved path (e.g., "https://host/jellyfin"), or empty string if invalid
- Type:
- string
(static) mergePaths(basePath, relPath) → {string}
Merge a relative path with a base path
| Name | Type | Description |
|---|---|---|
basePath | string | The base path (directory) |
relPath | string | The relative path to merge |
- Source
Merged path string
- Type:
- string
(static) normalizeUrl(url) → {string}
Normalize a URL for consistent comparison and storage
- Lowercase scheme
- Remove default ports (:80 for http, :443 for https)
- Remove trailing slash from path (except root)
- Remove empty query strings
| Name | Type | Description |
|---|---|---|
url | string | The URL to normalize |
- Source
Normalized URL string, or empty string if invalid
- Type:
- string
(static) parseUrlComponents(url) → {object}
Parse URL into components
| Name | Type | Description |
|---|---|---|
url | string | The URL to parse |
- Source
Associative array with scheme, authority, host, port, path, query, or invalid
- Type:
- object
(static) reconstructUrl(parts) → {string}
Reconstruct URL from parsed components
| Name | Type | Description |
|---|---|---|
parts | object | Associative array with scheme, authority, path, query |
- Source
Reconstructed URL string
- Type:
- string
(static) removeDotSegments(path) → {string}
Remove dot segments from path per RFC 3986 Section 5.2.4
| Name | Type | Description |
|---|---|---|
path | string | The path to process |
- Source
Path with dot segments removed
- Type:
- string
(static) resolveUrl(baseUrl, reference) → {string}
Resolve a reference URI against a base URI per RFC 3986 Section 5 Note: Only http:// and https:// schemes are supported. Other schemes (mailto:, ftp:, etc.) will be treated as relative paths. The result is automatically normalized (lowercased scheme, default ports removed, trailing slashes stripped, etc.) for consistent comparison and storage.
| Name | Type | Description |
|---|---|---|
baseUrl | string | The base URI (absolute, http/https only) |
reference | string | The reference URI (can be absolute http/https, relative, or protocol-relative) |
- Source
Resolved and normalized absolute URI string, or empty string if resolution fails
- Type:
- string
(static) urlsEqual(url1, url2) → {boolean}
Check if two URLs are equivalent after normalization
| Name | Type | Description |
|---|---|---|
url1 | string | First URL |
url2 | string | Second URL |
- Source
true if URLs are equivalent, false otherwise
- Type:
- boolean