Connect as the other LLeMbas clients do: address, identity, refused token, streams, words

- One address rule (api/Address.kt): scheme in any case, host lower-cased, path, query and
  fragment dropped; an http:// address is answered at the address step (this app needs https).
- User-Agent llembas-android/<version> on every request, and the same string as the device
  code's client_id (the server only stores and shows it).
- A 401 of the instance's own (WWW-Authenticate: Bearer realm="lembas") marks the instance
  whose token it was as signed out: nothing more is asked with it, its pages stay underneath a
  page that offers the sign-in in one step, and nothing else is forgotten. A 403 stays the
  server's sentence; a 401 passed on from a provider behind /v1 signs nobody out.
- Streams: 45 s of silence is a broken connection (the server's keepalive is every 15 s on all
  three routes); reconnect 1 s doubling to 60 s, jittered ±20 %, short again only after 30 s of
  health; a 429 waits for Retry-After.
- A sentence for each failure: unreachable, timeout, certificate not trusted, not LLeMbas,
  "the server answered N", too old, too new. Sign-in polls end by their real reason and survive
  a dropped network or a restarting server.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
HomerandClaude Fable 5.2 committed 2026-12-01 19:22:40 +00:00
1 parent cf092ef1a1
commit 71b2e847cf
25 files changed
+1256 -96

No files matched your search

+13
View File
@@ -25,6 +25,19 @@ STRINGS: dict[str, str] = {
"signin_expired": "The code expired before it was approved. Try again.",
"signin_too_old": "This instance runs an older LLeMbas. This app needs LLeMbas 2.0 or newer.",
"signin_too_new": "This instance speaks a newer app API than this app. Update the app.",
# What went wrong on the way to an instance, one sentence for each kind, and the way back in
# when an instance signed this phone out.
"signin_not_lembas": "There is no LLeMbas instance at that address.",
"signin_failed": "The sign-in could not be completed (%1$s). Try again.",
"address_needs_https": "This app needs an https:// address: plain http is not supported.",
"address_unreadable": "That is not an address this app can use. Type the instance's address, like llm.example.org.",
"server_answered": "The server answered %1$s.",
"timed_out": "The instance did not answer in time.",
"not_trusted": "This phone does not trust the instance's certificate: install its CA certificate among Android's user certificates (Settings, Security, Encryption & credentials, Install a certificate).",
"signed_out": "%1$s signed this phone out. Sign in again to go on: your chats and what you set up here are kept.",
"signed_out_again": "Sign in again",
"signed_out_use": "Use %1$s",
"signed_out_remove": "Remove this instance",
# Chats
"new_chat": "New chat",
"empty_chats": "No chats yet. Not all those who wander are lost — start one.",