Merge the development branch: add a server by its address, TSDNS, gateway DNS

Both sides kept. From the development branch: the add-server dialog
asks for the address and an optional password (the rest under Advanced
when editing), servers are found through TSDNS and their gateways in
DNS, wss:// gateways, the official client's identities imported on
every start, and a bookmark built from the form over the old one.

The dialog keeps this wave's join mode for Home's "Join a Server": its
title says so, the button reads Join and connects once saved; adding
and editing read as on the development branch. Saving takes the
development branch's bookmark_from_form, which keeps the bookmark's
identity as this wave's code did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-04 04:29:59 +03:00
commit 356bb0c6ac
21 files changed
+1294 -283

No files matched your search

+59 -1
View File
@@ -80,7 +80,65 @@ Every login, post and settings change is written to the audit table.
5. Install tsgw ([below](#install)), copy the example config to
`/etc/tsgw/tsgw.toml` and set the query address and credentials
(`TSGW_QUERY_PASSWORD` or `password_file`).
6. Run it behind TLS (Caddy, nginx) and give users the `wss://…/v1` URL.
6. Run it behind TLS (Caddy, nginx) and publish it in DNS
([below](#letting-voelin-find-the-gateway)), so users only add the
server's address; or give them the `wss://…/v1` URL.
## Letting Voelin find the gateway
When a user adds a server by its address (`ts.example.org`), Voelin looks
for its gateway the way TeamSpeak looks for the voice server (SRV
`_ts3._udp`, then TSDNS), and uses what it finds as if the user had typed
the URL (the field stays editable under *Advanced*). It asks at the
server's host name and then at each parent domain down to the registered
domain, the most specific name first; for `ts.example.org` that is
`ts.example.org`, then `example.org`. It looks again when the server is
saved with an empty gateway URL and when it connects with voice.
**DNS records** (preferred). An SRV record names the gateway's host and
port, the service name says whether it speaks TLS:
| Record | Gives |
|---|---|
| `_tsgws._tcp.<name> SRV <prio> <weight> <port> <host>` | `wss://<host>:<port>/v1` (TLS, e.g. behind Caddy or nginx) |
| `_tsgw._tcp.<name> SRV <prio> <weight> <port> <host>` | `ws://<host>:<port>/v1` (plain, e.g. tsgw itself on 7788) |
| `_tsgws._tcp.<name> TXT "path=/<path>"` (optional, same for `_tsgw`) | another path than `/v1`, e.g. behind a reverse proxy |
At the same name TLS wins; among several records of one name the lowest
priority. A target of `.` means "no gateway here" and the search goes on at
the parent domain. Examples (zone of `example.org`):
```dns
; Behind a TLS proxy at gw.example.org that forwards /tsgw/v1 to tsgw:
_tsgws._tcp.example.org. 3600 IN SRV 0 0 443 gw.example.org.
_tsgws._tcp.example.org. 3600 IN TXT "path=/tsgw/v1"
; -> wss://gw.example.org:443/tsgw/v1 for ts.example.org, voice.example.org, …
; tsgw itself, without TLS, next to the server ts.example.org:
_tsgw._tcp.ts.example.org. 3600 IN SRV 0 0 7788 ts.example.org.
; -> ws://ts.example.org:7788/v1, only for ts.example.org
```
One domain with several servers and several gateways: publish one record
per server host (`_tsgws._tcp.ts1.example.org`, `_tsgws._tcp.ts2.example.org`);
a record at the domain itself applies to every host below it that has none
of its own.
**Without DNS records** (like TSDNS on port 41144): Voelin asks
`http://<name>:7788/.well-known/tsgw` at the same names (and at an IP
address the server was added by). tsgw answers there with its URL,
`{"url": "…"}`: `listen.public_url` if set, else the address the request
came in on (`ws://<host>:7788/v1`). So a tsgw that listens on the default
port on the server's host is found with no setup at all; behind a proxy,
set `listen.public_url` so the answer points at the proxy.
Discovery is as trustworthy as DNS and the network, like TSDNS: prefer a
`_tsgws` record, so TLS proves the gateway is yours. Voelin checks a
`wss://` gateway's certificate against the system's certificate store, so
use one from a public CA (Caddy's automatic Let's Encrypt certificates
work); the Android app cannot reach `wss://` gateways yet (it has no
system store to read). A user logs in with
their own identity, and only when they choose to observe the server.
## Install
+5
View File
@@ -19,6 +19,11 @@ frame:
{"v":1,"id":7,"type":"send_chat","data":{"target":{"kind":"channel","id":5},"text":"hi"}}
```
Next to it, `GET /.well-known/tsgw` answers `{"url": "…"}`, the URL apps
should use (`listen.public_url`, else the one the request came in on); apps
that find no DNS record ask there ([gateway-admin.md](gateway-admin.md#letting-voelin-find-the-gateway),
`voelin_core::discover`).
The client picks `id` for requests; the answer carries the same `id`.
Pushes have no `id`. Version 1 only grows: new message types and optional
fields. Both sides ignore unknown fields. The gateway answers a type it does
+13 -1
View File
@@ -92,7 +92,7 @@ field carries the body. **Type 1, payload field 17, is an identity:**
| 4 | bytes | empty in every row seen |
| 5 | varint | 1 on exactly one identity: the selected one |
Voelin reads field 1 and field 2 and ignores the rest. The other item types
Voelin reads fields 1, 2 and 5 and ignores the rest. The other item types
(0, 2, 3, 4, 5 — connection profiles, bookmarks, server lists and such) are
**not** decoded; they are skipped by their type, not by guessing at their
contents.
@@ -168,6 +168,18 @@ voelinctl identity export <id> <path> [--store <db>]
`--store` defaults to the desktop app's client database,
`<data dir>/voelin/client.db`, so the CLI and the app share identities.
**On every start** the app does the same as `import --auto`
(`voelin_core::identity::import_new`): identities found in the default
locations that the client database does not have yet are added, the files
are only read. The identity the official client uses by default (field 5 of
its payload, below) goes in first, so when Voelin has no identity of its own
yet, that one becomes Voelin's default (the first identity) and servers see
the same unique id; otherwise Voelin's default stays. What was imported is
shown once, in the status line (the toast on desktop), by nickname. The
runtime setting `identity.import_from_teamspeak` (default on) turns it off,
e.g. `--set identity.import_from_teamspeak=false`. The sample data of
`VOELIN_DEMO_UI` never imports.
- **Import** prints what it found as nickname, unique id and security level —
all three are public, everything else in an identity is the private key —
and stores each one through `voelin-store` under its nickname. An identity
Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

+18 -1
View File
@@ -200,6 +200,22 @@ goes to the running capture at once (`Capture::follow_audio`, which calls
to add sources to. With sample data `share:live` shares the test pattern
with the sample studio's sources, live at once with sample viewers.
## Adding a server
The add-server dialog (`BookmarkDialog` in `screens/dialogs.slint`, logic in
`servers.rs`) asks for the address (host, host:port, IP or server
nickname; the resolver finds the port through SRV records and TSDNS) and
an optional server password. *Advanced* (open when editing) has the rest,
and empty fields there are filled in: the name is the address until the
first connection, then the server's own name (`adopt_server_name`); the
nickname is the default identity's (one imported from TeamSpeak keeps its
nickname there), else the system user's, else "Voelin user"; the identity is the default one,
there is no default channel; the gateway is looked up in DNS when the
server is saved without one and when it connects
([gateway-admin.md](gateway-admin.md#letting-voelin-find-the-gateway)),
and one found is stored as if typed. `bookmark` and `bookmark:edit` open
it (below).
## Adding a screen
1. Write the screen in `ui/screens/<name>.slint` from the components
@@ -262,7 +278,7 @@ Environment variables (see `src/dev.rs`):
- `VOELIN_DEMO_UI=1`: sample servers, channels, members, chat with emoji and
a stream, without a server (nothing is stored).
- `VOELIN_OPEN=<what>[,<what>...]`: `home`, `server`, `settings[:voice|keybinds|streaming|privacy|appearance]`,
`about`, `share[:live]`, `bookmark`, `emoji`, `client`, `panel`, `no-panel`,
`about`, `share[:live]`, `bookmark[:edit]`, `emoji`, `client`, `panel`, `no-panel`,
`voice`, `pins`, `topics`, `topic:<id>`, `member`, `watch`, `popout`
(the server page, above), `tab:<home|servers|chat|activity|you>` (phone
layout). With sample data, `watch` plays the local test pattern in the
@@ -322,6 +338,7 @@ the window's size so the pointer is not over the window, and passes
|---|---|---|---|---|
| ![chat](screenshots/mobile-chat.png) | ![servers](screenshots/mobile-servers.png) | ![home](screenshots/mobile-home.png) | ![you](screenshots/mobile-you.png) | ![settings](screenshots/mobile-settings.png) |
| ![voice channel](screenshots/mobile-voice.png) | ![activity](screenshots/mobile-activity.png) | ![studio](screenshots/mobile-studio.png) | ![share](screenshots/mobile-share.png) | ![sharing](screenshots/mobile-share-live.png) |
| ![add server](screenshots/mobile-add-server.png) | | | | |
## Limits