Skip to content

feat(server): support multiple endpoints with health checks and failover - #1355

Merged
everpcpc merged 1 commit into
mainfrom
feat/server-endpoints
Nov 28, 2026
Merged

everpcpc merged 1 commit into
mainfrom
feat/server-endpoints

Conversation

@everpcpc

Copy link
Copy Markdown
Member

What

  • Allow a single Komga instance to store an ordered list of server addresses (e.g. public URL, LAN IP, Tailscale), each with an optional label.
  • Probe every address with an authenticated /api/v2/users/me check and show live reachability and latency badges in Settings, the Server page, the server switcher, and Edit Server.
  • Switch between addresses of the active instance in place: establish a fresh session on the target host, update the active base URL, and reconnect SSE without logging out, reloading libraries, or interrupting an open reader.
  • Automatically fail over to the first reachable address in priority order on launch, reconnect, and before entering auto-offline mode; enter offline mode only when all addresses are unreachable. Late responses or failures from a previous address are ignored so they cannot overwrite the new session or trigger a false offline transition.
  • Allow editing the currently active server so backup addresses can be added without switching away first.

Why

Users often reach the same Komga server through different routes depending on where they are (e.g. public domain vs. Tailscale). Previously they had to edit the single server URL (triggering a full logout/re-login) or add duplicate instances with separate local caches and offline downloads.

Closes #1344

Validation

  • make format
  • make build (iOS, macOS, tvOS — all succeeded)
  • make localize and ./misc/translate.py list (no missing translations across all 10 languages)
  • iOS simulator end-to-end checks against a live Komga server:
    • Live latency badges on the Settings server card, server list, and Edit Server.
    • Unreachable backup addresses can be saved; tapping one shows Server unreachable while keeping the healthy address active.
    • A fake 200 text/html endpoint is reported Unreachable rather than healthy.
    • Local reverse proxy failover: killing the active proxy on relaunch and during staggered concurrent dashboard requests automatically switches to the healthy backup (Connected via …), including late failures from the old address arriving 11s after the switch without triggering offline mode.
    • Renaming the active server updates the displayed name immediately; duplicate URLs show an inline warning and block saving.

Includes make bump to build 693.

@everpcpc
everpcpc force-pushed the feat/server-endpoints branch from f259e16 to e70999e Compare November 28, 2026 11:48
A saved server can now hold multiple addresses (e.g. public URL, LAN, or Tailscale) with optional labels and failover priority, so switching networks no longer requires editing the URL or maintaining duplicate instances with separate local caches and downloads.

- Settings, the Server page, the server switcher, and Edit Server show live reachability and latency for each address inline (`● host · 32 ms`), omitting the URL scheme in display text.
- Switching addresses on the active server establishes a fresh session on the target host and reconnects SSE without logging out, reloading libraries, or interrupting an open reader.
- When the active address becomes unreachable at launch, during requests, or while recovering from auto-offline mode, KMReader automatically tries the remaining addresses in priority order and enters offline mode only if all of them are unreachable. Late responses or failures from a previous address are ignored so they cannot overwrite the new session or trigger a false offline transition.
- The currently active server can now be edited in place (deletion remains limited to inactive servers), and backup addresses can be added even while temporarily unreachable.

Side effects:
- Adds GRDB migration `00015_add_instance_endpoints` (`komga_instances.endpoints_raw`).
- Adds localized server-address and endpoint-status strings across all 10 supported languages.
- Removes two unused `pageIndex` locals in the EPUB scroll wrappers that emitted compiler warnings.
- Includes `make bump` to build 693.
@everpcpc
everpcpc force-pushed the feat/server-endpoints branch from e70999e to fd622e4 Compare November 28, 2026 12:00
@everpcpc
everpcpc merged commit da88932 into main Nov 28, 2026
3 checks passed
@everpcpc
everpcpc deleted the feat/server-endpoints branch November 28, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

备用服务器地址

1 participant