Skip to content

Commit a916141

Browse files
committed
docs(selkies): Document the session token in the fragment and the /api/tokens endpoint
Selkies after 2.0.0 takes the session token from the URL fragment as well as the query, and offers a fragment token on the data WebSocket as the subprotocol selkies.token.<base64url> beside selkies, so it never reaches a request line. Selkies 2.0.0 already serves the token table on its own port at /api/tokens and has no 8083 control port, and the v2 images' Nginx hands Selkies everything under api/ through one location, where the pages still had the websocket and files locations of the v1 images.
1 parent 852e569 commit a916141

5 files changed

Lines changed: 8 additions & 11 deletions

File tree

‎docs/selkies/components/sealskin.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ GPU allocation is automatic: the server detects render nodes and drivers at star
4848

4949
## Features beyond launching
5050

51-
- **Collaboration rooms:** launch a session in room mode and invite participants with links, full control, read only, or gamepad player slots, with A/V chat signalling and up to four physical gamepads passed through. Built on the Selkies token control plane (port 8083 inside the container).
51+
- **Collaboration rooms:** launch a session in room mode and invite participants with links, full control, read only, or gamepad player slots, with A/V chat signalling and up to four physical gamepads passed through. Built on the Selkies secure mode token API (`/api/tokens`, behind the container's Nginx).
5252
- **File manager:** browse, upload, and download files in your server side homes from the extension, with chunked transfers for large files.
5353
- **Public shares:** password protectable, expiring public download links for files in your storage.
5454
- **App Lab (meta apps):** launch a base app in customize mode, install software and tweak settings interactively, then commit the home directory as a golden template. New "meta apps" launch from copies of that template, no Docker knowledge required.

‎docs/selkies/components/selkies.md‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Selkies is the heart of the platform: a ground up, web native remote desktop pro
1515
- **Clipboard**: bidirectional sync via `wl-clipboard` on Wayland or `xclip` on X11, with optional binary (image) clipboard support and chunked transfer for large payloads.
1616
- **Files**: receives chunked uploads over the socket into the session; downloads are served by the container's Nginx file index.
1717
- **Settings and stats**: pushes the sanitized settings schema to the client (this is what builds the sidebar UI, including which controls are locked), and streams CPU, GPU, memory, and network stats.
18-
- **Sharing and roles**: manages primary, collaborator, view only, and player 2 to 4 roles, either via URL fragments (`#shared`, `#collab`, `#player2`) or, in secure deployments, via a token control plane on an internal port (`POST /tokens` authorized by `SELKIES_MASTER_TOKEN`), which is what [SealSkin](sealskin.md) uses for its collaboration rooms.
18+
- **Sharing and roles**: manages primary, collaborator, view only, and player 2 to 4 roles, either via URL fragments (`#shared`, `#collab`, `#player2`) or, in secure deployments, via session tokens registered through the token API (`POST /api/tokens` authorized by `SELKIES_MASTER_TOKEN`), which is what [SealSkin](sealskin.md) uses for its collaboration rooms.
1919

2020
Configuration is uniform: every setting is simultaneously a CLI flag (`--framerate`) and an environment variable (`SELKIES_FRAMERATE`), with the value syntax (ranges, enums, `|locked`) described in the [Configuration Reference](../user-guide/configuration.md). The protocol itself is documented in [The Streaming Protocol](../developer-guide/protocol.md).
2121

@@ -40,8 +40,7 @@ Both are preloaded automatically in the baseimages, and `NO_GAMEPAD=true` turns
4040

4141
| Port | What |
4242
| --- | --- |
43-
| 8082 | The Selkies server (`SELKIES_PORT`, upstream default is 8080, the baseimages set 8082 via `CUSTOM_WS_PORT`). Nginx proxies everything under `/api` to it: the data WebSocket at `/api/websockets`, WebRTC signaling at `/api/webrtc/signaling`, the transport switch, and the file browser at `/api/files/` |
44-
| 8083 | Token control plane for secure sharing mode, never expose it |
43+
| 8082 | The Selkies server (`SELKIES_PORT`, upstream default is 8080, the baseimages set 8082 via `CUSTOM_WS_PORT`). Nginx proxies everything under `/api` to it: the data WebSocket at `/api/websockets`, WebRTC signaling at `/api/webrtc/signaling`, the transport switch, the secure mode token API at `/api/tokens` (master token only), and the file browser at `/api/files/` |
4544
| 3000 / 3001 | Nginx HTTP and HTTPS in front of everything ([baseimage](baseimages.md) territory) |
4645

4746
## Relationship to the rest of the stack

‎docs/selkies/developer-guide/architecture.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Nginx inside the container is the single front door: it serves the static client
6969

7070
## Sharing and multi user
7171

72-
One session, many sockets. Every connected client gets the same broadcast frames; roles (primary, collab, view only, player N) gate which input messages are honored. In secure mode (used by SealSkin), access requires per user tokens registered through a control plane endpoint on an internal port, and roles can be re assigned live, this is what powers collaboration rooms with granular permissions.
72+
One session, many sockets. Every connected client gets the same broadcast frames; roles (primary, collab, view only, player N) gate which input messages are honored. In secure mode (used by SealSkin), access requires per user tokens registered through the token API (`POST /api/tokens`, gated by the master token), and roles can be re assigned live, this is what powers collaboration rooms with granular permissions.
7373

7474
## Where the orchestration layer plugs in
7575

‎docs/selkies/developer-guide/baseimage-internals.md‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,18 @@ One config, two identical server blocks (HTTP 3000, HTTPS 3001):
6868
| Location | Purpose |
6969
| --- | --- |
7070
| `SUBFOLDER` (default `/`) | The web client static files from `/usr/share/selkies/web/` |
71-
| `SUBFOLDERwebsocket` | Proxy to the Selkies data WebSocket on 127.0.0.1:8082 |
72-
| `SUBFOLDERfiles` | fancyindex download listing of `FILE_MANAGER_PATH` (default `/config/Desktop`), removed entirely when downloads are disabled or `HARDEN_DESKTOP` is on |
71+
| `SUBFOLDERapi` | Proxy to the Selkies server on 127.0.0.1:8082: the data WebSocket, WebRTC signaling, the secure mode token API, and the file browser at `api/files/`, refused when `SELKIES_FILE_TRANSFERS` leaves out downloads (`HARDEN_DESKTOP` empties it unless it is set) |
7372
| `SUBFOLDERpelorus/` | Proxy to the Pelorus API on 127.0.0.1:5100 |
7473
| `/devmode` | Proxy to a Vite dev server, see [Development Environment](development.md) |
7574

76-
All proxy locations use hour long timeouts, no buffering, and a 10MB body cap. Because substitution is plain `sed`, exotic characters in `PASSWORD` or `SUBFOLDER` can break the config, keep them simple.
75+
All proxy locations use hour long timeouts and no buffering; `api` passes request bodies of any size, unbuffered, and the others cap them at 10MB. Because substitution is plain `sed`, exotic characters in `PASSWORD` or `SUBFOLDER` can break the config, keep them simple.
7776

7877
## Internal port map
7978

8079
| Port | Owner | Exposure |
8180
| --- | --- | --- |
8281
| 3000, 3001 | Nginx | Published, everything user facing |
8382
| 8082 | Selkies WebSocket | localhost only, via Nginx |
84-
| 8083 | Selkies token control plane | localhost only, orchestrators call it, never expose |
8583
| 5100 | Pelorus API | localhost only, via Nginx at `/pelorus/` |
8684
| 5000 | pixelflux Computer Use API | localhost only |
8785
| 5173 | Vite dev server | localhost only, via `/devmode` |

‎docs/selkies/developer-guide/protocol.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ The wire protocol between the Selkies server and the web client, for anyone impl
44

55
## Connection and roles
66

7-
The client connects to `wss://host/<subfolder>websocket`. Role assignment happens one of two ways:
7+
The client connects to `wss://host/<subfolder>api/websockets`. Role assignment happens one of two ways:
88

99
- **Fragment mode** (default): the URL fragment the page was opened with decides the role, `#shared` (view only), `#collab` (full control), `#player2` through `#player4` (gamepad slot only), `#display2-right` and friends (second monitor surface). No fragment means primary.
10-
- **Token mode** (when the server was started with `SELKIES_MASTER_TOKEN`): the client must present `?token=<token>` in the WebSocket URL. Tokens and their roles are registered by the orchestrator via `POST /tokens` on the internal control port with the master token as a bearer credential. Close codes: `4001` invalid token, `4002` revoked, `4029` reconnecting too fast.
10+
- **Token mode** (when the server was started with `SELKIES_MASTER_TOKEN`): the page is opened with the session token in the fragment, `#token=<token>` (after a role or display fragment: `#display2-right&token=<token>`), or in the query, `?token=<token>`. A fragment token never reaches a request line: the client offers it on the WebSocket as the subprotocol `selkies.token.<token, base64url without padding>` beside `selkies`, which the server selects, while a query token rides the WebSocket URL as `?token=<token>`. Tokens and their roles are registered by the orchestrator via `POST /api/tokens` with the master token as a bearer credential (`Authorization`, or `Selkies-Authorization` beside a Basic login). Close codes: `4001` invalid token, `4002` revoked, `4029` reconnecting too fast.
1111

1212
On success the server sends `MODE websockets`, an auth confirmation with the assigned role, and a `server_settings` JSON message containing every tunable setting with its value, allowed range or enum, and locked flag, this single message is what renders the sidebar UI, which is why locking a setting server side removes the control everywhere.
1313

0 commit comments

Comments
 (0)