Add embedded web chat client (closes #7) #8

Merged
clawbot merged 22 commits from feature/web-client into main 2026-02-11 03:02:42 +01:00
Showing only changes of commit 16e08c2839 - Show all commits

View File

@@ -87,48 +87,57 @@ Fields:
### API Endpoints ### API Endpoints
All endpoints accept and return `application/json`. All endpoints accept and return `application/json`. Authenticated endpoints
require `Authorization: Bearer <token>` header.
#### Authentication The API follows an IRC-inspired design: one unified message stream for all
message types (channel messages, DMs, server notices), with a simple `to` field
for addressing.
#### Registration
``` ```
POST /api/v1/register — Create account (nick, password) → token POST /api/v1/register — Create account { "nick": "..." } → { id, nick, token }
POST /api/v1/login — Authenticate → token
POST /api/v1/logout — Invalidate token
``` ```
#### Session & Messages #### State
``` ```
GET /api/v1/messagesRetrieve queued messages (long-poll supported) GET /api/v1/state User state: nick, id, and list of joined channels
Query params: ?after=<message-id>&timeout=30 Replaces separate /me and /channels endpoints
POST /api/v1/messages — Send a message or command ```
GET /api/v1/history — Retrieve channel/DM history
Query params: ?target=#channel&before=<id>&limit=50 #### Messages (unified stream)
```
GET /api/v1/messages — Single message stream (long-poll supported)
All message types: channel, DM, notices, events
Query params: ?after=<message-id>&timeout=30
POST /api/v1/messages — Send a message
Body: { "to": "#channel" or "nick", "content": "..." }
```
#### History
```
GET /api/v1/history — Fetch history for a target (channel or DM)
Query params: ?target=#channel&before=<id>&limit=50
For DMs: ?target=nick&before=<id>&limit=50
``` ```
#### Channels #### Channels
``` ```
GET /api/v1/channels — List joined channels GET /api/v1/channels/all — List all server channels
POST /api/v1/channels/join — Join a channel POST /api/v1/channels/join — Join a channel { "channel": "#name" }
POST /api/v1/channels/part — Leave a channel DELETE /api/v1/channels/{name} — Part (leave) a channel
GET /api/v1/channels/{name} — Channel info (topic, members, modes) GET /api/v1/channels/{name}/members — Channel member list
POST /api/v1/channels/{name}/topic — Set channel topic
```
#### Users
```
GET /api/v1/users/me — Current user info
POST /api/v1/users/nick — Change nick
GET /api/v1/users/{nick} — User info (online status, idle time)
``` ```
#### Server Info #### Server Info
``` ```
GET /api/v1/server — Server info (name, version, MOTD, user count) GET /api/v1/server — Server info (name, MOTD)
GET /.well-known/healthcheck.json — Health check GET /.well-known/healthcheck.json — Health check
``` ```
@@ -265,7 +274,8 @@ Per gohttpserver conventions:
## Status ## Status
**Design phase.** This README is the spec. Implementation has not started. **Implementation in progress.** Core API is functional with SQLite storage and
embedded web client.
## License ## License