feat: host the BM chat context

When golem15.chat is active, Boot registers the context alias bm (id 1)
on its registry. Membership is the user group jz.bm.chat.group (default
studenci); CanOverseeChats is always false, so nobody reads other
people's DMs or edits their messages; the broadcast channel is
chat:context:1, never empty.

GET /_bm/api/v1/chat answers the caller's membership behind jwt.auth and
the per-user bucket jz.bm.chat (240 a minute). The chat config block
(group, moderator_group, max_upload_bytes, max_embeds) is added. jz.bm
still Requires only golem15.user; all chat wiring is gated by HasPlugin.
This commit is contained in:
2026-10-26 15:40:44 +01:00
parent 67806f49a7
commit 64601f6817
9 changed files with 482 additions and 5 deletions

View File

@@ -69,14 +69,18 @@ func (p *Plugin) Register(app *backpack.App) error {
// Boot keeps the application, so route handlers and commands can reach its
// services, such as the database, when they run, and wires the realtime
// service. The management API uses the shared user.api_token middleware
// owned by golem15.user.
// service and, when golem15.chat is active, the BM chat context. The
// management API uses the shared user.api_token middleware owned by
// golem15.user.
func (p *Plugin) Boot(app *backpack.App) error {
p.app = app
if app != nil {
if err := p.wireRealtime(app); err != nil {
return err
}
if err := p.registerChat(app); err != nil {
return err
}
}
return nil
}