Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ site owner hold every capability on every server in scope.
| Capability | Unlocks | viewer | operator | admin |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------- | ----- |
| View | what is happening on the server: status, players, kills, rotation, who is banned and who holds a reserved slot, analytics, leaderboards, player stats. Every role has it. | ✓ | ✓ | ✓ |
| Chat | broadcast; whisper one player, several, or everyone on a faction; pick from the organisation's saved messages | | ✓ | ✓ |
| Chat | broadcast; whisper one player, several, or everyone on a faction; pick from the organisation's saved messages; read the current map's in-game chat (Season 3) | | ✓ | ✓ |
| Kick | kick a player; the rules that kick or flag players | | ✓ | ✓ |
| Kill | kill a player's character; AFK protection, and a Kill distance watch that kills | | ✓ | ✓ |
| Move | move a player to another team, which kills them so they respawn on it (a move to the side they are on is refused); arrange the teams on the Players tab, which moves without the kill; a Team balance rule | | ✓ | ✓ |
Expand Down Expand Up @@ -505,6 +505,20 @@ their detail, which tells them from another sending of the same text, and a sear
the message finds them. Each server counts as one of the 120 game actions a minute a person or key
may send.

### In-game chat

A server on Season 3 or later serves what its players say, and its **Chat** tab shows it: the
current map's lines, newest last, each with its time, channel, faction, the player's real name
(a link to their dossier) and the anonymised name other players see. The tab reads new lines every
5 seconds while it is open, and starts empty again when the map changes, because that is when the
game server empties its own. Warcon does not store chat: it is read from the game server while
someone has the tab open, and the audit trail keeps no line of it.

Reading chat needs _Chat_, the capability that broadcasts and whispers, so a role with View alone
cannot. Bulkhead gives chat only on terms, which each server accepts once: until then the tab shows
the terms, with **Accept** for those whose role includes _Config & settings_ (the game server saves
the acceptance in its config), and everyone else is told an admin has to accept them.

### Players online

The **Players** page in the header lists everyone on the organisation's servers in one table: each
Expand Down Expand Up @@ -1442,6 +1456,8 @@ game's (a 401 or a 5xx from it becomes a 502), and `error` carries the game's `c
| `broadcast` | Chat | `message` |
| `whisper` | Chat | `steamId`, `message` |
| `whisperMany` | Chat | `message`, and either `faction` or `steamIds` (a list, up to 200) |
| `chat` | Chat | `after` (optional: only the lines numbered above it); the current map's in-game chat, Season 3 builds |
| `chatTerms` | Chat | none (Bulkhead's terms for reading chat, and whether they are accepted) |
| `kick` | Kick | `steamId`, `reason` (optional) |
| `kill` | Kill | `steamId` |
| `changeTeam` | Move | `steamId`, `faction`; the player is killed so they respawn on that side, unless `kill` is `false` (the move alone) |
Expand All @@ -1460,6 +1476,7 @@ game's (a 401 or a 5xx from it becomes a 502), and `error` carries the game's `c
| `settings` | Config & settings | `scoreTick` (1 to 600), `rotationEnabled`, `rotationMode` |
| `config` | Config & settings | none (the config document, credentials as `(hidden)`) |
| `feed` | Config & settings | none (the game's report on its kill feed, Season 2 builds; see [Kill feed](#kill-feed)) |
| `chatTermsAccept` | Config & settings | `version` (the `requiredVersion` that `chatTerms` reads) |
| `configValidate`, `configApply` | Config & settings | `text`; apply also `revision`, `force`, `fullApply` |
| `serverLog` | Audit trail | `limit` (1 to 500, default 50) |
| `raw` | Raw RCON | `method`, `path` (a `/v1` route), `body` |
Expand Down Expand Up @@ -1946,11 +1963,11 @@ GET /api/steam/profiles?ids=a,b GET /api/health

Actions, by the capability each needs: `capabilities status health serverId players maps lightings
experiences alternators catalog rotation bans reserved sponsor` (View) ·
`broadcast whisper whisperMany` (Chat) · `kick` (Kick) · `kill` (Kill) · `changeTeam` (Move) · `endMatch restartMatch
`broadcast whisper whisperMany chat chatTerms` (Chat) · `kick` (Kick) · `kill` (Kill) · `changeTeam` (Move) · `endMatch restartMatch
changeMap setWeather setNextMap` (Match control) · `rotationAdd rotationRemove rotationMove
rotationReorder` (Live rotation) · `ban unban` (Bans) · `reservedAdd reservedRemove` (Reserved
slots) · `rotationSave rotationSettings` (Save rotation) · `config feed settings configValidate configApply` (Config &
settings) · `serverLog` (Audit trail) · `raw` (Raw RCON).
slots) · `rotationSave rotationSettings` (Save rotation) · `config feed chatTermsAccept settings configValidate configApply`
(Config & settings) · `serverLog` (Audit trail) · `raw` (Raw RCON).

## Notes and limits

Expand Down
48 changes: 47 additions & 1 deletion docs/wardogs-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ Warcon, and Warcon's own process talks plain HTTP to the listener.
| GET | `/v1/config` | | `{ revision, writable, text, sections:[{section, appliesWhen, description, allowedKeys[], keyOverrides:[{key, appliesWhen, description, writable, lockedBy}]}], warnings[] }` (+ `ETag`) | Whole `ServerSettings.ini`. **CL-501228** adds `writable` and `lockedBy` per key override: a key pinned by a launch argument (`ServerName` by `-RCON_FixedServerName`, `Port` by `-RCONPort` on the TLR host) comes back `writable:false` with the switch in `lockedBy` and "Pinned by -RCONPort on this server's command line. The value is shown but cannot be changed here." The console shows a "Fixed" badge and disables the input; Warcon does the same (`lockedFor` / `lockedKeys` in `src/lib/config-fields.ts`) and lists pinned keys under the document. CL-499480's schema (mirrored in `mockgame.ts`): `WDGameSession` applied (`ServerImageURL` pending, password and join limits applied on the next session update), `Engine.GameSession` next-restart, `WDGameStateSession` / `KOTH` / `PreMatch` next-match, rotation applied ("rebuilt immediately; used from the next map change"), `WDRCONSettings` and `WDServerFeed` next-restart. |
| POST | `/v1/config/validate` | text/plain ini | apply result | Dry run. |
| PUT | `/v1/config?force=true&fullApply=true` | text/plain ini, `If-Match: "rev"` | `{ ok, revision, outcomes:[{section,state,detail}], shadowed[], stripped[], errors[], changed[], conflict[], warnings[], timingsMs }` | `state` ∈ `applied`, `next-match`, `next-restart`, `pending`. 412 on revision mismatch unless `force`. |
| GET | `/v1/chat?after=N` | | `{ latestSeq, messages:[{seq, sentUtc, channel, faction, steamId, realName, hiddenName, anonymous, text, rawText, ping}], count }` | **New in Season 3 (CL-533689).** The current map's chat, from the server's memory: a map load empties it and `seq` starts again at 1. Empty until the chat terms are accepted. See [Season 3](#season-3-live-build-cl-533689-read-2026-11-12). Warcon action `chat`. |
| GET | `/v1/chat/terms` | | `{ requiredVersion, acceptedVersion, accepted, text }` | **Season 3.** Bulkhead's terms for reading chat. Warcon action `chatTerms`. |
| POST | `/v1/chat/terms` | `{ version }` | `{ ok, pending, message }` | **Season 3.** Accepts the terms; saved as `AcceptedChatTermsVersion`. Warcon action `chatTermsAccept`. |

"Set as next map" is not a route: the console finds (or adds) the selection in the rotation and
moves it into the slot after the `now` entry with repeated `/move` calls. Warcon does the same server-side.
Expand Down Expand Up @@ -125,6 +128,48 @@ player list's fields were not seen (the server was empty). The RCON block's `all
section allows one, so hosts set it outside `ServerSettings.ini`, and no route reports it.
Whispers and broadcasts are capped (see `/v1/broadcast` above).

### Season 3, live build CL-533689 (read 2026-11-12)

Season 3 serves what players say in chat. `GET /v1/capabilities` lists three new routes,
`GET /v1/chat`, `GET /v1/chat/terms` and `POST /v1/chat/terms`. Read on a live server:

```
GET /v1/chat
{ "latestSeq": 7, "count": 6, "messages": [
{ "seq": 7, "sentUtc": "2026-11-12T15:39:29.145Z", "channel": "Global", "faction": "Manticore",
"steamId": "7656119…", "realName": "…", "hiddenName": "Pig", "anonymous": false,
"text": "howdy, and yeah", "rawText": "howdy, and yeah", "ping": false } ] }
```

* `channel` was `Team` or `Global`. `hiddenName` is the anonymised name other players see;
`realName` is the player's own. What `anonymous`, `rawText` (beside `text`) and `ping` mean was
not seen: every line read had `anonymous:false`, `ping:false` and `rawText` the same as `text`.
* `?after=N` answers only the lines with `seq` above N (`after=5` gave 6 and 7). `?limit=n`
answers the **oldest** n, so it is no way to read the newest. `since`, `afterSeq`, `sinceSeq`
and `fromSeq` are ignored.
* The lines are held in the server's memory for the **current map only**. A map load empties
them and `seq` starts again at 1 (after a match restart, seq 1 was a new line). Nothing is kept
for the host by Bulkhead. A reader polling with `after` must notice the numbering going back:
Warcon asks from one before the last line it holds and checks that line comes back
(`mergeChat` in `src/lib/chat.ts`), which also catches a new map that has already passed the
old one's count.
* Reading chat is gated by Bulkhead's terms. `GET /v1/chat/terms` answers
`{ requiredVersion:1, acceptedVersion:0, accepted:false, text }`, the text beginning "Read these
terms before viewing this server's chat." and saying that chat is given only to moderate the
server, is not stored for the host, must not be recorded, stored, exported, published or shared
beyond what moderation needs, and that access may be revoked for misuse.
`POST /v1/chat/terms` with `{ "version": 1 }` answered
`{ ok:true, pending:false, message:"OK: chat terms accepted and saved." }`. Until then
`GET /v1/chat` is empty and `GET /v1/feed` reports `"pausedForTerms": true`. The accepted
version is kept as `AcceptedChatTermsVersion` under `[/Script/WDRCON.WDRCONSettings]`
(`next-restart` in `GET /v1/config`'s sections).

Warcon reads chat with the `chat` action (Chat capability, the one that broadcasts and whispers),
shows it on the server's Chat tab while the tab is open, and stores none of it. The terms are
read with `chatTerms` (Chat) and accepted with `chatTermsAccept` (Config & settings). The demo
server serves the three routes (a line every 8 seconds, emptied at each map change) and
`MOCK_LIVE_BUILD=true` leaves them out.

## ServerSettings.ini keys the server honours

```
Expand All @@ -136,7 +181,8 @@ Whispers and broadcasts are capped (see `/v1/broadcast` above).
[/Script/WDGame.WDGameStateSession] bLockOverpopulatedTeamsConfig, OverpopulatedTeamThresholdConfig
[/Script/WDGame.WDServerMapRotationSettings] bEnabled, RotationMode, +RotationEntries=(Map="",Experience(s)="",Lighting="",ZoneAlternator="")
[/Script/WDRCON.WDRCONSettings] bEnabled, BindAddress, Port, Password, PasswordHash, AllowedOrigins, AllowedHosts (CL-507060;
CL-501228 had bWriteAuditLogFile instead)
CL-501228 had bWriteAuditLogFile instead), AcceptedChatTermsVersion
(Season 3, CL-533689; next-restart; set by POST /v1/chat/terms)
[WDServerFeed] Url, Token (CL-499480: "kill-event feed endpoint and its ingest token")
```

Expand Down
2 changes: 1 addition & 1 deletion src/lib/capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const CAPABILITY_INFO: Record<Capability, CapabilityInfo> = {
},
'chat.send': {
label: 'Chat',
hint: 'Broadcast to everyone; whisper a player, several, or a faction.',
hint: "Broadcast to everyone; whisper a player, several, or a faction; read the current map's in-game chat.",
group: 'play'
},
'players.kick': { label: 'Kick', hint: 'Kick a player off the server.', group: 'play' },
Expand Down
60 changes: 60 additions & 0 deletions src/lib/chat.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { describe, expect, test } from 'bun:test';
import { chatAfter, mergeChat, type ChatMessage } from './chat';

const line = (seq: number, sentUtc = `2026-11-12T15:00:0${seq % 10}.000Z`): ChatMessage => ({
seq,
sentUtc,
channel: 'Team',
faction: 'Valkyra',
steamId: '76561198000000001',
realName: 'Real',
hiddenName: 'Pig',
anonymous: false,
text: `line ${seq}`,
rawText: `line ${seq}`
});

describe('chatAfter', () => {
test('asks from the start with nothing held', () => {
expect(chatAfter([])).toBe(0);
});
test('asks from the line held last, so the answer starts with it again', () => {
expect(chatAfter([line(1)])).toBe(0);
expect(chatAfter([line(4), line(5)])).toBe(4);
});
});

describe('mergeChat', () => {
test('takes the whole answer when nothing is held', () => {
expect(mergeChat([], { latestSeq: 2, messages: [line(1), line(2)] })).toEqual([
line(1),
line(2)
]);
});

test('adds the new lines after the one it already held', () => {
const held = [line(4), line(5)];
const got = mergeChat(held, { latestSeq: 7, messages: [line(5), line(6), line(7)] });
expect(got?.map((m) => m.seq)).toEqual([4, 5, 6, 7]);
});

test('keeps what it held when nothing is new', () => {
const held = [line(4), line(5)];
expect(mergeChat(held, { latestSeq: 5, messages: [line(5)] })).toBe(held);
});

test('a lower latestSeq is a new map: read again from the start', () => {
expect(mergeChat([line(6), line(7)], { latestSeq: 2, messages: [] })).toBeNull();
});

test('a new map that got past the old count is caught by the line held last', () => {
// The tab was hidden through a map change, and the new map reached seq 9 meanwhile.
const held = [line(6), line(7)];
const got = { latestSeq: 9, messages: [line(7, '2026-11-12T16:30:00.000Z'), line(8), line(9)] };
expect(mergeChat(held, got)).toBeNull();
});

test('the line held last missing from the answer is a new map too', () => {
expect(mergeChat([line(3)], { latestSeq: 3, messages: [] })).toBeNull();
});
});
60 changes: 60 additions & 0 deletions src/lib/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,63 @@

/** The longest whisper or broadcast the game takes. */
export const MAX_CHAT = 256;

// What players say, as Season 3 (CL-533689) serves it from GET /v1/chat: the current map's lines
// only, held in the game's memory and numbered from 1 again when a map loads (docs/wardogs-api.md).

/** One line of in-game chat, in the fields the `chat` action keeps. */
export interface ChatMessage {
seq: number;
sentUtc: string;
/** `Team` or `Global` */
channel: string;
faction: string;
steamId: string;
realName: string;
/** the anonymised name other players see */
hiddenName: string;
anonymous: boolean;
text: string;
rawText: string;
}

export interface ChatPage {
latestSeq: number;
messages: ChatMessage[];
}

/** Bulkhead's terms for reading chat, which an admin accepts once per server and version. */
export interface ChatTerms {
requiredVersion: number;
acceptedVersion: number;
accepted: boolean;
text: string;
}

/**
* The `after` to ask for next: one before the last line held, so the answer starts with that line
* again and mergeChat can tell the same map from a new one.
*/
export const chatAfter = (lines: ChatMessage[]): number =>
Math.max(0, (lines.at(-1)?.seq ?? 0) - 1);

/**
* The lines held plus what a read with `after = chatAfter(lines)` brought, or null when the map
* has changed underneath (the numbering went down, or the line held last is not where it was), in
* which case the caller reads again from 0. Checking the line and not only the number also
* catches a new map that got past the old one's count while nobody was looking.
*/
export function mergeChat(lines: ChatMessage[], page: ChatPage): ChatMessage[] | null {
const last = lines.at(-1);
if (!last) return page.messages;
const [anchor, ...rest] = page.messages;
if (
page.latestSeq < last.seq ||
!anchor ||
anchor.seq !== last.seq ||
anchor.sentUtc !== last.sentUtc ||
anchor.steamId !== last.steamId
)
return null;
return rest.length ? [...lines, ...rest] : lines;
}
Loading
Loading