diff --git a/crates/voelin-gateway/tsgw.example.toml b/crates/voelin-gateway/tsgw.example.toml index 31ed2a9..4f355a3 100644 --- a/crates/voelin-gateway/tsgw.example.toml +++ b/crates/voelin-gateway/tsgw.example.toml @@ -1,15 +1,25 @@ # tsgw: companion gateway for invisible presence and channel chat. # Copy to tsgw.toml and adjust. See docs/gateway-admin.md. +# +# Two kinds of keys: +# - BOOTSTRAP keys (query login, addresses, database path) are read at start +# from this file, TSGW_ environment variables or `--set key=value`. +# Changing them needs a restart. +# - Everything else is a SEED: the value used unless an admin changes it at +# runtime (Voelin's admin screen / config_set). Values set at runtime are +# stored in the database and win over this file; `config_reset` goes back +# to it. Reload with SIGHUP (or just save: the file is checked every 5 s). +# Precedence: runtime (database) > --set > environment > this file > default. -# Signed into every login challenge. Defaults to listen.public_url. +# BOOTSTRAP. Signed into every login challenge. Defaults to listen.public_url. # gateway_id = "wss://gw.example.org/v1" [server] -# Voice port of the virtual server this gateway serves. +# BOOTSTRAP. Voice port of the virtual server this gateway serves. voice_port = 9987 [query] -# "ssh" (TeamSpeak 3 and 6) or "raw" (TeamSpeak 3 only). +# BOOTSTRAP. "ssh" (TeamSpeak 3 and 6) or "raw" (TeamSpeak 3 only). transport = "ssh" addr = "127.0.0.1:10022" user = "serveradmin" @@ -19,6 +29,7 @@ user = "serveradmin" allowlisted = false [listen] +# BOOTSTRAP. bind = "0.0.0.0:7788" # public_url = "wss://gw.example.org/v1" @@ -33,11 +44,61 @@ token_ttl_hours = 720 nickname = "Chat Relay" format = "[{nick}] {text}" idle_teardown_secs = 120 +# Each relay is one query connection; stay below the server's per-IP limit. max_channel_relays = 6 # Channels relayed all the time, so their history is complete. pinned_channels = [] [history] -enabled = true +# BOOTSTRAP: the database also holds tokens and runtime settings. path = "tsgw.db" -retention_days = 30 +enabled = true +# 0 keeps messages forever (pinned messages are always kept). +retention_days = 0 + +# Optional features; Voelin hides what is off. +[features] +pins = true +reactions = true +topics = true +events = true +streams = true +activity = true + +[topics] +# How topic posts appear in TeamSpeak; TeamSpeak posts in this form join the topic. +relay_format = "[#{topic}] {text}" + +[events] +# Remind subscribers this many minutes before an event (0: when it starts). +reminder_minutes = [15, 0] +stream_link_minutes = 60 + +[activity] +retention_days = 0 + +[limits] +# Per connection; 0 turns a limit off. +posts_per_window = 5 +post_window_secs = 5 +actions_per_window = 30 +action_window_secs = 10 + +# Quotas: 0 means none. +[quota] +history_page = 0 +pins_per_channel = 0 +topics_per_channel = 0 +events_per_user = 0 +reactions_per_message = 0 +reaction_bytes = 64 +message_bytes = 0 +streams_per_user = 0 + +# Who may do what, by TeamSpeak server group or channel group ids. Without +# a rule an action has its default (see docs/gateway-admin.md). +[perm] +# pin = { server_groups = [6], channel_groups = [5] } +# create_event = { server_groups = [6, 7] } +# admin = { server_groups = [6] } +# react = { everyone = true } diff --git a/docs/gateway-admin.md b/docs/gateway-admin.md index 9672a08..d127964 100644 --- a/docs/gateway-admin.md +++ b/docs/gateway-admin.md @@ -3,7 +3,12 @@ `tsgw` lets users of Voelin see who is in which channel and read and write channel chat **without joining voice**, on a server you administer. It holds ServerQuery sessions (invisible to normal users of the official clients) -and serves users over a WebSocket (`tsgw.v1+json`, see `crates/voelin-gateway-proto`). +and serves users over a WebSocket (`tsgw.v1+json`, see +[gateway-protocol.md](gateway-protocol.md)). It also adds what TeamSpeak does +not have: pinned messages, reactions, topics, scheduled events, a directory +of running streams and an activity feed. Voelin shows these only on servers +with a gateway; official TeamSpeak clients do not see them (topic posts +appear in the channel as `[#topic] text`). ## What users get @@ -12,14 +17,22 @@ and serves users over a WebSocket (`tsgw.v1+json`, see `crates/voelin-gateway-pr | Presence | One query session watches the server; each user sees the channels their `i_channel_subscribe_power` allows, without query clients | | Channel chat | A relay query session is moved into each channel someone opened; it forwards what is said and posts users' messages as `[Nick] text` | | Server chat | Read by the watcher, posted by the gateway's lookup session | -| History | Relayed messages are stored (SQLite) and can be paged | +| History | Relayed messages are stored (SQLite) with stable ids; pages by id or time in both directions, without a size limit unless you set one; `sync` returns what changed since a revision | +| Pins | Pinned messages per chat, kept even when older messages are pruned | +| Reactions | Any emoji on any stored message, with counts and who reacted | +| Topics | Threads in a chat, started from a message or standalone; posts are relayed as `[#Title] text`, and TeamSpeak posts in that form join the topic | +| Events | Scheduled events per server or channel, with RSVP (going / maybe / not going) and reminders; stream events show when the host goes live | +| Stream directory | Voelin streamers register running TeamSpeak 6 streams, so viewers who join later can find them; entries go when the streamer leaves or stops, and clients that stream without registering are listed as detected (without a stream id) | +| Activity feed | Streams started and stopped, events scheduled, starting or cancelled, topics started, messages pinned | The nickname in relayed posts is the one the server has on record for the user's identity (from `clientdbinfo`), not something the user can choose. +Each feature can be turned off (`features.*`); pins, reactions and topics +need `history.enabled`. ## Authentication and authorization -Users log in by signing a challenge with their TeamSpeak identity key. The +Users log in by signing a challenge with their TeamSpeak identity. The gateway derives the unique id (SHA-1 of the public key on TeamSpeak 3, SHA-256 on TeamSpeak 6) and looks it up with `clientdbfind`, so **an identity must have connected to the server with voice once** before it can use the gateway. @@ -35,11 +48,18 @@ Checks, mirroring what the user could do with a real connection `b_channel_join_ignore_password` - post in a channel: the above plus `b_client_channel_textmessage_send` - post in server chat: `b_client_server_textmessage_send` -- see a channel in presence: `i_channel_subscribe_power` (server level) ≥ the - channel's `channel_needed_subscribe_power` +- see a channel in presence (and its events, streams and activity): + `i_channel_subscribe_power` (server level) ≥ the channel's + `channel_needed_subscribe_power` -Posts are limited to 5 per 5 seconds per connection, and every login and post -is written to the audit table. +Pins, reactions and topics also need read (reactions, pins) or post (topics) +access to the chat. On top of that, each action has a permission rule, see +[Permission rules](#permission-rules). + +Posts are limited to `limits.posts_per_window` per `limits.post_window_secs` +per connection (5 per 5 s by default), other changes to +`limits.actions_per_window` per `limits.action_window_secs` (30 per 10 s). +Every login, post and settings change is written to the audit table. ## Setup @@ -47,8 +67,9 @@ is written to the audit table. `TSSERVER_QUERY_SSH_ENABLED=1` (the gateway needs events, so SSH, not HTTP). TeamSpeak 3: raw (10011) or SSH (10022). 2. Use a query login with enough rights for `clientdbfind`, `clientdbinfo`, - `permoverview`, `banlist`, `clientmove` and `sendtextmessage`, e.g. a - dedicated login in the Server Admin group. + `permoverview`, `banlist`, `clientmove`, `sendtextmessage`, + `servergroupsbyclientid` and `channelgroupclientlist`, e.g. a dedicated + login in the Server Admin group. 3. Put the gateway's IP into `query_ip_allowlist.txt` and set `query.allowlisted = true`. Otherwise the server's flood protection (10 commands / 3 s) applies and bans the gateway under load. @@ -85,7 +106,7 @@ sudo systemctl enable --now tsgw journalctl -u tsgw -f ``` -The audit database (`path = "tsgw.db"`) ends up in `/var/lib/tsgw`. The unit +The database (`history.path = "tsgw.db"`) ends up in `/var/lib/tsgw`. The unit (`packaging/linux/tsgw.service`) runs tsgw sandboxed: no write access outside that directory, network only. @@ -111,3 +132,138 @@ needed view power (100 by default). Server Admins, and third-party clients that ignore the rule, see the gateway's sessions. Relayed channels show the relay's posts under its own nickname (`Chat Relay `), so people in the channel can tell the messages come through the gateway. + +## Configuration + +`tsgw.toml` holds two kinds of keys (the example marks them): + +- **Bootstrap** keys are needed before the database opens: `gateway_id`, + `server.voice_port`, `query.*` (transport, address, login, password, + `allowlisted`), `listen.bind`, `listen.public_url` and `history.path`. + They come from the file, the environment or the command line and apply + at start; changing them needs a restart. +- Everything else (history, relays, features, permission rules, quotas, + limits, reminders) is a **seed**: the value in use unless an admin changes + it at runtime. Runtime changes are stored in the gateway's database and + apply at once, without a restart. + +Where a value comes from, highest first: + +| Source | How | +|---|---| +| `db` | set at runtime (`config_set`, `perm_set`), stored in the database | +| `cli` | `tsgw --set history.retention_days=90` (repeatable) | +| `env` | `TSGW_`: upper case, dots become `_`, e.g. `TSGW_HISTORY_RETENTION_DAYS=90`, `TSGW_QUERY_PASSWORD=…`; lists as `1,2,3` or JSON, rules as JSON | +| `file` | `tsgw.toml` | +| `default` | built in | + +**Reload.** `SIGHUP` (`systemctl reload tsgw`), a changed file (checked every +5 s) or the `config_reload` admin command reads the file again. Values set at +runtime keep winning; the log names every key where the file now says +something else ("file differs from the value set at runtime"). Bootstrap keys +changed in the file are logged as needing a restart. A file that does not +parse changes nothing. `config_reset` drops a runtime value, so the key falls +back to the command line, environment, file or default. + +Changes apply live: relays pick up a new `relay.nickname` (the relay +sessions are replaced; channel chat keeps flowing), newly pinned channels +open, retention prunes at once, reminder times and quotas apply to the next +request, and connected apps get the new list of features. + +### Keys + +Numbers are non-negative; quotas and limits of 0 mean none. There are no +built-in caps on history pages, pins, topics, events or reactions: only what +you set here. + +| Key | Default | | +|---|---|---| +| `auth.require_server_groups` | `[]` | If not empty, users need one of these server groups | +| `auth.deny_uids` | `[]` | Unique ids that may never use the gateway | +| `auth.min_security_level` | `0` | On top of the server's own requirement | +| `auth.token_ttl_hours` | `720` | Lifetime of login tokens | +| `relay.nickname` | `"Chat Relay"` | Relay sessions are named ` `, the lookup session ` Gateway` | +| `relay.format` | `"[{nick}] {text}"` | How posts appear in TeamSpeak | +| `relay.idle_teardown_secs` | `120` | Close a relay this long after its last reader left | +| `relay.max_channel_relays` | `6` | Concurrent relays (0: no limit) | +| `relay.pinned_channels` | `[]` | Always relayed, so their history is complete | +| `history.enabled` | `true` | Store messages; pins, reactions and topics need it | +| `history.retention_days` | `0` | Delete older messages (0: keep forever; pinned messages are kept) | +| `features.pins`, `.reactions`, `.topics`, `.events`, `.streams`, `.activity` | `true` | Turn features off; apps hide them | +| `topics.relay_format` | `"[#{topic}] {text}"` | How topic posts appear in TeamSpeak; TeamSpeak posts in this form join the topic | +| `events.reminder_minutes` | `[15, 0]` | Remind event subscribers this many minutes before the start (0: when it starts) | +| `events.stream_link_minutes` | `60` | A stream by the host links to a stream event from this long before its start until this long after its end | +| `activity.retention_days` | `0` | Delete older activity (0: keep forever) | +| `limits.posts_per_window` / `limits.post_window_secs` | `5` / `5` | Chat posts per connection | +| `limits.actions_per_window` / `limits.action_window_secs` | `30` / `10` | Pins, reactions, topics, events, streams per connection | +| `quota.history_page` | `0` | Most messages per history page | +| `quota.pins_per_channel` | `0` | Pins per chat | +| `quota.topics_per_channel` | `0` | Open topics per chat | +| `quota.events_per_user` | `0` | Upcoming events per creator | +| `quota.reactions_per_message` | `0` | Different emoji per message | +| `quota.reaction_bytes` | `64` | Longest reaction | +| `quota.message_bytes` | `0` | Longest post (TeamSpeak splits long ones anyway) | +| `quota.streams_per_user` | `0` | Directory entries per user | +| `perm.` | unset | Permission rules, below | + +Before this version history was pruned after 30 days by default; now the +default keeps it. Set `history.retention_days = 30` to keep the old behaviour. + +### Admin commands + +Users with the `admin` permission see the `admin` capability and can send +(see [gateway-protocol.md](gateway-protocol.md#administration)): + +| Command | Does | +|---|---| +| `config_list` | Every key with value, source (`db`, `cli`, `env`, `file`, `default`), default, type, description and whether it is bootstrap; the query password is shown as `***` | +| `config_get {key}` | One key | +| `config_set {key, value}` | Store a value at runtime (JSON of the key's type); applies at once | +| `config_reset {key}` | Drop the runtime value | +| `config_reload` | Read the file again, like `SIGHUP` | +| `perm_list` | The rule of every action, its source and what the default allows | +| `perm_set {action, rule}` | Set a rule (same as `config_set perm.`) | +| `perm_reset {action}` | Back to the file's rule or the default | + +## Permission rules + +Each action has a rule: who may do it, by TeamSpeak server group ids and/or +channel group ids (in the channel concerned), or everyone: + +```toml +[perm] +pin = { server_groups = [6], channel_groups = [5] } # Server Admin, Channel Admin +create_event = { server_groups = [6, 7] } +react = { everyone = true } +``` + +A rule replaces the action's default; `{}` allows nobody. Users with `admin` +may do everything, and whoever may `moderate` a channel may also pin there. +Access to the chat itself (read, or post for topics) is always required. +Groups come from presence for users who are online and from +`servergroupsbyclientid` / `channelgroupclientlist` (cached 60 s) otherwise. + +| Action | Default without a rule | +|---|---| +| `react` | everyone who can read the chat | +| `pin` | moderators and admins | +| `create_topic` | everyone who can post in the chat | +| `create_event` | everyone who can post in the event's channel (server chat for server-wide events) | +| `rsvp` | everyone | +| `stream` | everyone (their own streams) | +| `moderate` | `b_channel_modify_name` in the channel (Channel Admin): edit or delete others' topics, events, streams and pins | +| `admin` | `b_virtualserver_modify_name` (Server Admin): settings and rules | + +Creators may always edit and delete their own topics, events and stream +entries. + +## Data + +The database (`history.path`, SQLite in WAL mode) holds login tokens, chat +messages with pins, reactions and topics, events and RSVPs, the stream +directory (so it survives a restart; entries whose client is gone are dropped +once the gateway sees the server), the activity feed, settings changed at +runtime and the audit log. The schema is versioned (`PRAGMA user_version`) +and migrated in place at start, keeping existing messages and their ids. +Message ids are never reused, even after pruning, so apps can merge history +with what they store locally. diff --git a/docs/gateway-protocol.md b/docs/gateway-protocol.md new file mode 100644 index 0000000..d55259b --- /dev/null +++ b/docs/gateway-protocol.md @@ -0,0 +1,183 @@ +# Gateway protocol (`tsgw.v1+json`) + +How Voelin talks to `tsgw` ([gateway-admin.md](gateway-admin.md)). The types +are in `crates/voelin-gateway-proto` (`messages.rs`, `types.rs`); its +`client` feature is a typed client (one async method per request, pushes as +`Push`), which the app uses through `voelin_core::gateway`. + +## Transport + +WebSocket to `…/v1`, subprotocol `tsgw.v1+json`, one JSON envelope per text +frame: + +```json +{"v":1,"id":7,"type":"send_chat","data":{"target":{"kind":"channel","id":5},"text":"hi"}} +``` + +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 +not know with `error` / `unknown_type` (and a malformed message with +`bad_request`), with the request's `id`, and keeps the connection. + +Older clients never receive a type they do not know: the newer pushes only go +to clients that asked for them (`enable`, `subscribe_*`), and newer error +codes only answer newer requests. Enums that may grow (`ErrorCode`, +`EventKind`, `RsvpStatus`, `Action`, `StreamSource`, `ConfigSource`) have an +`unknown` fallback in the Rust types; activity kinds are plain strings. + +## Login and capabilities + +1. Gateway: `hello {gateway_id, server_uid, server_name, nonce, capabilities}`. +2. Client: `auth {omega, key_offset, ts, signature, nickname}`, an ECDSA + signature with the TeamSpeak identity over + `tsgw-auth-v1\n{gateway_id}\n{server_uid}\n{nonce}\n{ts}`, or + `resume {token, nickname}`. +3. Gateway: `auth_ok {uid, token, token_expires, capabilities}` or `error`. + +`capabilities` in `hello` lists the features enabled on the gateway; +`auth_ok` repeats them for this user and adds `admin` when the user may +administer the gateway. A `capabilities {capabilities}` push follows when an +admin turns a feature on or off (to clients that sent `enable` or subscribed +to something). Clients hide what is missing. + +| Capability | Meaning | +|---|---| +| `presence` | `subscribe_presence` | +| `relay` | channel and server chat | +| `history` | stored messages: `history`, `query_history`, `sync` | +| `pins`, `reactions`, `topics` | on stored messages | +| `events` | scheduled events | +| `streams` | stream directory | +| `activity` | activity feed | +| `admin` | configuration and permission rules (only in `auth_ok`) | + +## Original messages + +| Client → gateway | Answer | +|---|---| +| `subscribe_presence` / `unsubscribe_presence` | `presence_snapshot {seq, snapshot}`, then `presence_delta {seq, delta}` pushes / `ok` | +| `open_chat {target}` / `close_chat {target}` | `ok`; chat arrives as `chat_event {id, message}` (or `message`, below) | +| `send_chat {target, text}` | `ok` | +| `history {target, before?, limit}` | `history {messages}`, oldest first | +| `ping` | `pong` | + +`history` entries now also carry `topic_id`, `reactions`, `pinned` and +`rev` (all omitted when empty); `limit` is no longer capped at 200, only by +`quota.history_page` if an admin sets it. + +## Chat extensions + +**`enable {features}`** → `enabled {features}`. After it, messages in open +chats arrive as `message {entry}` instead of `chat_event`, with the pushes +of the listed features (`pins`, `reactions`, `topics`; empty: all). Clients +that do not send it see topic posts in `chat_event` with the topic prefix. + +A stored message (`HistoryEntry`): + +```json +{"id":42,"message":{"target":{"kind":"channel","id":5},"author_name":"Bob","author_uid":"…", + "text":"hi","ts_ms":1700000000123,"via_relay":true}, + "topic_id":3,"reactions":[{"emoji":"🦀","count":2,"me":true}],"pinned":true,"rev":1700000000200001} +``` + +`id` is stable and never reused; `ts_ms` is when the gateway saw it; `rev` +increases with every change to the message (post, pin, reaction), across +restarts. + +| Request | Answer | Notes | +|---|---|---| +| `query_history {target, before?, after?, before_ms?, after_ms?, limit?, topic?, exclude_topics?}` | `history_page {target, topic?, messages, has_more}` | Oldest first. No cursor: the latest `limit`. `before`: the `limit` right before it. `after`: the `limit` right after it. Both: the range from `after`. `*_ms` are times (Unix ms). No `limit`: everything in range. `has_more`: more beyond the page in the paging direction | +| `sync {target, since_rev, limit?}` | `sync_page {target, messages, rev, has_more}` | New and changed messages by revision; pass `rev` next time | +| `post {target, text, topic?}` | `posted {entry}` | Like `send_chat`, returns the stored message; into a topic, TeamSpeak sees `[#Title] text` | +| `pin {message_id}` / `unpin {message_id}` | `ok` | Pushes `pinned {target, pin}` / `unpinned {target, message_id, by}` | +| `list_pins {target}` | `pins {target, pins}` | Newest first; `pin` is `{entry, by, ts_ms}` | +| `react {message_id, emoji}` / `unreact {…}` | `ok` | Any string without spaces. Push `reaction {target, message_id, emoji, user, added, count}` | +| `reactors {message_id, emoji}` | `reactors {message_id, emoji, users}` | | +| `create_topic {target, title, message_id?}` | `topic {topic}` | Push `topic_updated {topic}` (also on renames, archiving and new posts) | +| `update_topic {topic_id, title?, archived?}` | `topic {topic}` | Creator or moderator; archived topics take no posts | +| `list_topics {target, include_archived}` | `topics {target, topics}` | Most recently active first; `topic` has `message_count`, `last_activity_ms`, `root_message_id` | +| `permissions {channel?}` | `permissions {channel, actions}` | Actions the user may take (to hide buttons) | + +`user`, `by` and `creator` are `{uid, name}`. + +## Events + +| Request | Answer | +|---|---| +| `create_event {event: EventSpec}` | `event {event}` | +| `update_event {id, event: EventSpec}` | `event {event}` (creator or moderator) | +| `delete_event {id}` | `ok` | +| `get_event {id}` | `event {event}` with `attendees` | +| `list_events {from_ms?, to_ms?, channel?, limit?}` | `events {events}` by start; default from now, including running events | +| `rsvp {event_id, status}` | `event {event}`; `status` `going`, `maybe`, `not_going` or `null` to withdraw | +| `subscribe_events` / `unsubscribe_events` | `ok` | + +`EventSpec`: `{title, description, start_ms, end_ms?, channel?, kind: +"general"|"stream", stream_title?, stream_game?, host_uid?}`. An event adds +`id, creator, created_ms, updated_ms, going, maybe, not_going, my_rsvp?, +attendees?, live_stream?`. When the host of a stream event registers a stream +around its time, `live_stream` is the directory id until the stream ends. + +Pushes to subscribers (only for events in channels they can see): +`event_updated {event}` (created, changed, RSVP counts, live), +`event_deleted {id}`, `event_reminder {event, starts_in_ms}` at the times in +`events.reminder_minutes`. + +## Stream directory + +| Request | Answer | +|---|---| +| `register_stream {stream_id, client_id?, channel?, title, kind, viewers?}` | `stream {stream}` | +| `update_stream {stream_id, title?, viewers?}` | `stream {stream}` | +| `unregister_stream {stream_id}` | `ok` | +| `list_streams` | `streams {streams}` | +| `subscribe_streams` / `unsubscribe_streams` | `streams {streams}` / `ok` | + +An entry: `{id, stream_id?, streamer, client_id?, channel?, title, kind, +started_ms, viewers?, source: "registered"|"detected", event_id?}`. `id` is +the stream id, or `client/` for detected streams (a client with +`client_is_streaming` but no registration; its stream id is unknown). +`client_id` must be the registering user's own voice client; with it the +gateway drops the entry when that client leaves or stops streaming and +follows it to other channels. Entries without a `client_id` end with the +registering connection. Pushes to subscribers: `stream_started {stream}`, +`stream_updated {stream}`, `stream_ended {id, reason}`. + +## Activity feed + +`list_activity {before?, limit?}` → `activity {entries, has_more}`, newest +first; `subscribe_activity` / `unsubscribe_activity` → `ok`, then +`activity_added {entry}` pushes. An entry: `{id, ts_ms, kind, actor?, +channel?, ref_id?, text, data}`; `text` is a readable summary for kinds the +client does not know. Kinds so far: `stream_started`, `stream_ended`, +`event_created`, `event_cancelled`, `event_starting`, `topic_created`, +`pinned`. + +## Administration + +Needs the `admin` capability; see [gateway-admin.md](gateway-admin.md#admin-commands). + +| Request | Answer | +|---|---| +| `config_list` | `config {entries}` | +| `config_get {key}` | `config_value {entry}` | +| `config_set {key, value}` | `config_value {entry}` | +| `config_reset {key}` | `config_value {entry}` | +| `config_reload` | `config {entries}` | +| `perm_list` | `perm_rules {rules}` | +| `perm_set {action, rule: {everyone?, server_groups?, channel_groups?}}` | `perm_rules {rules}` | +| `perm_reset {action}` | `perm_rules {rules}` | + +`entry`: `{key, value, source: "db"|"cli"|"env"|"file"|"default", default, +type, description, bootstrap?}`. `rules`: `{action, rule?, source, default}` +for `react`, `pin`, `create_topic`, `create_event`, `rsvp`, `stream`, +`moderate`, `admin`. + +## Errors + +`error {code, message}` with `code`: `bad_request`, `auth_failed`, +`unknown_identity`, `level_too_low`, `banned`, `forbidden`, +`not_authenticated`, `unavailable`, `internal`, and for the extensions +`unknown_type`, `not_found`, `quota_exceeded`, `rate_limited`, +`feature_disabled`. diff --git a/packaging/linux/tsgw.service b/packaging/linux/tsgw.service index 00eded6..bc795e6 100644 --- a/packaging/linux/tsgw.service +++ b/packaging/linux/tsgw.service @@ -12,6 +12,8 @@ ConditionPathExists=/etc/tsgw/tsgw.toml [Service] ExecStart=/usr/bin/tsgw --config /etc/tsgw/tsgw.toml +# Re-reads tsgw.toml; values set at runtime keep winning. +ExecReload=/bin/kill -HUP $MAINPID # Read by systemd before dropping privileges, so it can stay root-only. EnvironmentFile=-/etc/tsgw/tsgw.env DynamicUser=yes