feat(rust): chat titles, BetterChat group styles, the voice and popups (phase 17)
PLAN.md §33, D134-D143. Protocol 12. - Chat titles (D135-D137): per-server rules (stat, top N, text, colour) that rank the current wipe, and a mode (first | all | up to N). Worked out once in model/titles and read three ways: pushed whole to the game by a new titleSync loop (on change, restart or wipe), and on every leaderboard row as `titles`. Admin: PUT /servers/:id/titles. - Group styles (D138, D139): a site group may carry all twelve BetterChat fields (rust_perm_group_chat). They ride perm.sync with `expect` from the pushed ledger, which gains a value column; a field changed in game is a `chat-field` drift row with the game's value, adopted into the style or put back. A withdrawn style is one `chat-group` retirement, never for `default`, cleared from the ledger only once BetterChat removed it. - The voice (D140): one fleet setting naming a styled group; news and rust.announce chat lines carry its format and the plugin says them with no sender. Admin: GET/PUT /voice. - Popups (D141, D142): rust.announce gains `delivery` (still version 1, from rust.options.delivery); each server gains news_delivery beside the news switch; `popup-unavailable` is not retried. - GET /servers/:id/integrations reads, live, which optional mods a server has loaded. README lists BetterChat and PopupNotifications as optional. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
|
||||
import { ago, clock, count, day, duration, nextWipe, prefab, shortId } from '../src/lib/format.js'
|
||||
import { ago, clock, contrastInk, count, day, duration, nextWipe, prefab, shortId } from '../src/lib/format.js'
|
||||
|
||||
const NOW = Date.parse('2026-09-16T12:00:00Z')
|
||||
|
||||
@@ -107,3 +107,11 @@ test('the next wipe: the reader’s own clock, how far away, and whether it move
|
||||
assert.equal(nextWipe(null, now), null)
|
||||
assert.equal(nextWipe({ at: 'soon', source: 'rule' }, now), null)
|
||||
})
|
||||
|
||||
test('a title chip’s ink is whichever of black and white reads on its colour', () => {
|
||||
assert.equal(contrastInk('#ffff00'), '#000000')
|
||||
assert.equal(contrastInk('#FFAA55'), '#000000')
|
||||
assert.equal(contrastInk('#1a1a8c'), '#ffffff')
|
||||
assert.equal(contrastInk('#ff0000'), '#000000')
|
||||
assert.equal(contrastInk('red'), '#000000', 'not a hex colour: black, on the caller’s fallback')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user