orbit-client-docs/docs/config.md

68 lines
4.4 KiB
Markdown

Section: Configuration
Order: 100
# config.json reference
Orbit is configured at **runtime** by `config.json`. It is fetched on startup, deep-merged over the
built-in defaults, then the app renders — so you can re-point or rebrand **without rebuilding**.
- **Source of truth:** `public/config.json` (copied into the build).
- **Served at:** `/app/config.json`.
- **Edit live:** the service worker serves it *network-first*, so editing the deployed file takes
effect on the next reload — no rebuild.
Merge rules: objects merge key-by-key; **arrays and scalars replace** wholesale.
## Options
| Key | Type | What it does |
|-----|------|--------------|
| `server.url` | string | WebSocket URL of the IRCv3 server. |
| `server.guestIdent` | string | Ident for **guests** (not logged in) — e.g. `Foo!Invité@…`. Folded to ASCII (IRC idents are `[A-Za-z0-9._-]`, so `Invité``Invite`). Logged-in members use their own nick as the ident. |
| `startup.channels` | string[] | Channels auto-joined (first = active). A `?channel=` URL param overrides. |
| `branding.name` | string | App/network name — UI, tab title, **notifications**, **PWA install prompt**, and CTCP VERSION. |
| `branding.icon` | string | Logo/icon — connect screen, **browser favicon**, desktop + push notifications, PWA. |
| `branding.url` | string | Homepage (used in CTCP VERSION/SOURCE). |
| `branding.tagline` / `taglineEm` / `subtitle` | string | Connect-screen copy. |
| `branding.projectUrl` | string | Orbit project/source link (Settings → About). |
| `branding.links` | array | Extra `{label, url}` rows added to Settings → About. |
| `branding.accent` | string | Overrides the `--accent` CSS colour (e.g. `#ff6b00`); empty keeps the theme default. |
| `turnstile.enabled` | bool | Render the anti-bot challenge inline (Cloudflare Turnstile). `false` = show the server's verification step as a link, no Cloudflare script. Whether a challenge is *required* is decided server-side. |
| `turnstile.sitekey` | string | Public Turnstile site key. |
| `report.service` | string | Services pseudo-client that receives reports (e.g. `ReportServ`) — not blocked by a `+n` staff channel. Empty = fall back to `report.target`. |
| `report.target` | string | Channel that reports are sent to when `report.service` is empty. |
| `defaults.theme` | string | `light` · `dark` · `yomirc` · `yomirc-dark`. |
| `defaults.compact` / `sound` / `hideJoinQuit` / `clock24` | bool | Preset new-user prefs. |
| `defaults.lang` | string | Force the UI language (`en`, `fr`, `de`, `es`, `it`, `tr`, `ru`, `ne`, `pt-BR`, `pt-PT`). Empty = auto-detect from the browser. |
| `features.push` | bool | Web Push notifications — the Settings row **and** the re-subscribe-on-connect. |
| `features.imageUpload` | bool | Composer image button **and** paste / drag-drop upload. |
| `features.register` | bool | Account self-service: the "Create account" button, the "Forgot password" link, and their FAQ entries. |
| `plugins` | string[] | Plugin script URLs loaded at startup — a bare URL runs in-page, or `{url, sandbox: true, permissions: […]}` runs isolated. See [Plugins](https://orbit.tchatou.fr/docs/plugins/). |
| `builtins` | string[] | Built-in **sandboxed** features to enable by name (opt-in; default `[]`). Currently `"dice"`. See [The sandbox](https://orbit.tchatou.fr/docs/sandbox/). |
> `defaults.*` only seed a user's preferences the **first** time — once someone changes a setting,
> it's stored in their browser and the config no longer overrides it.
## Languages
The UI ships fully translated in **10 languages** — English, French, German, Spanish,
Italian, Turkish, Russian, Nepali, and Brazilian + European Portuguese. Orbit
auto-detects the visitor's browser language; pin a default with `defaults.lang` (users
can still switch in **Settings**). The bundled plugins are localized too — see
[Plugins](https://orbit.tchatou.fr/docs/plugins/).
## Example
```json
{
"server": { "url": "wss://irc.example.org/ws/", "guestIdent": "Guest" },
"startup": { "channels": ["#lobby", "#help"] },
"branding": { "name": "ExampleChat", "icon": "https://example.org/logo.svg", "tagline": "Chat with", "taglineEm": "everyone." },
"turnstile":{ "enabled": false, "sitekey": "" },
"report": { "service": "ReportServ", "target": "#staff" },
"defaults": { "theme": "dark", "compact": true, "lang": "" },
"features": { "push": true, "imageUpload": true, "register": false },
"plugins": [],
"builtins": []
}
```