From 80ea7b675e918b930af01b82b60583d474bc0105 Mon Sep 17 00:00:00 2001 From: Elvis Claros Castro Date: Sat, 3 Oct 2026 23:29:44 -0300 Subject: Share and export a session's images with --images --- server/README.md | 6 +++-- server/home.html | 2 ++ server/main.go | 4 +-- server/render.go | 72 +++++++++++++++++++++++++++++++++++++++++++++++---- server/server_test.go | 30 +++++++++++++++++++++ 5 files changed, 105 insertions(+), 9 deletions(-) (limited to 'server') diff --git a/server/README.md b/server/README.md index 8e2de37..a74cb5c 100644 --- a/server/README.md +++ b/server/README.md @@ -26,6 +26,8 @@ creation can replace or delete it. The server keeps only the secret's SHA-256. two inline scripts by hash: no inline handlers, no external anything. - Share ids are 10 base62 characters from `crypto/rand`; pages carry `X-Robots-Tag: noindex` and `Referrer-Policy: no-referrer`. +- Images (`--images`) are accepted only as base64 `data:` URLs of PNG, JPEG, + GIF or WebP whose bytes match the format they claim; SVG never. - Limits: request body (`MAX_BYTES`), sessions per share (`MAX_SESSIONS`), and a token bucket per client IP for creations and for updates/deletes. - `X-Forwarded-For` is believed only when the connection comes from @@ -41,7 +43,7 @@ Content is **not encrypted**: whoever runs the server can read the shares. | `ADDR` | `-addr` | `:8181` | | `DATA_DIR` | `-data` | `/data` | | `PUBLIC_URL` | `-public-url` | `https://claude-logbook.all.ar` | -| `MAX_BYTES` | `-max-bytes` | `10485760` (10 MB) | +| `MAX_BYTES` | `-max-bytes` | `20971520` (20 MB) | | `MAX_SESSIONS` | `-max-sessions` | `1` | | `TRUSTED_PROXY` | `-trusted-proxy` | empty: trust no proxy (IPs or CIDRs, comma separated) | | `CREATES_PER_HOUR` | `-creates-per-hour` | `10` per IP | @@ -93,7 +95,7 @@ certificate (Let's Encrypt) and *Force SSL*. Add this under *Advanced* so uploads up to `MAX_BYTES` get through: ```nginx -client_max_body_size 10m; +client_max_body_size 20m; ``` `TRUSTED_PROXY` must be the address the connections from NPM arrive from. diff --git a/server/home.html b/server/home.html index 6ae6ad1..ffc559e 100644 --- a/server/home.html +++ b/server/home.html @@ -59,6 +59,7 @@ claude-logbook # table of every session

Pick a session by its number in the table or by a prefix of its UUID, then share it:

claude-logbook -s 3 --share                # asks before uploading
 claude-logbook -s 5d10f1ee --share --expire 7d
+claude-logbook -s 3 --share --images       # with its images
 claude-logbook --shares                    # what you have shared
 claude-logbook --unshare 5d10f1ee          # take it down

Sharing the same session again updates it in place: the link stays the same.

@@ -78,6 +79,7 @@ claude-logbook --unshare 5d10f1ee # take it down