- Reject images over 24 MP before full decode (decodeImageBounded) so a
small PNG declaring huge dimensions cannot OOM the RPi Zero via the
public thumbnail route or the resize handler
- Graceful shutdown on SIGINT/SIGTERM with a 10s drain so the SQLite DB
closes cleanly on deploys
- Set the Secure flag on the csrf cookie (same isHTTPS rule as the
session cookie); csrfToken is now a *Server method
- Add handlers_test.go: auth, login, CSRF, upload serving (traversal +
forced attachment), and decompression-bomb coverage
- Track remaining work (CSP unsafe-inline removal) in plan.md
Co-Authored-By: Claude Fable 5 <[email protected]>
Programmatic short-link creation that shares the same bearer key as the
MCP endpoint. Registered only when [mcp].enabled is true and api_key is
set, so a misconfigured server never exposes the route unauthenticated;
unauthenticated visitors hitting /api/links get a plain 404.
- POST /api/links accepts {"url","slug?"}, returns 201/200 with the
same snake_case payload shape as the MCP create_link tool.
- Constant-time Bearer / X-API-Key auth (reuses mcpAPIKeyAuth helper).
- 4 KB body cap, DisallowUnknownFields, URL auto-scheme, dedupe on URL.
- 13 unit tests cover auth, validation, dedupe, and duplicate-slug.
Sessions were stored in an in-memory map, so every server reboot logged the
admin out. Back the session store with the database instead:
- Add a sessions table (token, expires_at, created_at) created via the existing
migrate() (CREATE TABLE IF NOT EXISTS), backwards-compatible with deployed DBs.
- Add CreateSession / SessionValid / DeleteSession / CleanupSessions; expiry is
checked in SQL against datetime('now') (UTC).
- sessionStore is now a thin DB-backed wrapper with the same Create/Valid/Delete
interface; the hourly cleanup goroutine purges expired rows (plus once at
startup). Login, logout, requireAuth, and isLoggedIn are unchanged.
The session cookie was already persistent (MaxAge), so logins now survive both
browser and server restarts until session_hours expiry.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
- Replace the pastes table with a masonry card grid: each card shows the
paste's first image as a thumbnail, a short plain-text summary, meta badges,
and Copy link / Edit / QR / Delete actions.
- Clicking anywhere on a card (except the action buttons) opens an in-page
preview modal with the rendered paste in an iframe; it can be expanded to the
main content area or closed (Esc/backdrop/button). Keyboard accessible.
- Generate and cache 512px (long side) JPEG thumbnails for uploaded images on
first request (GET /uploads/thumb/{filename}); also generated at upload time
and invalidated on resize/delete. WebP falls back to the original.
- Sync the public paste pages (bin_view, bin_token) to the dark theme so they
match the rest of the app and the preview iframe.
- Relax framing headers to same-origin (X-Frame-Options SAMEORIGIN,
frame-ancestors 'self') so the same-origin preview iframe can load; cross-site
framing stays blocked.
- Document the new thumbnail route in the README routes table.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
The upload handlers called verifyCSRF (which reads a form value, implicitly
triggering ParseMultipartForm) before parsing the multipart body. When a file
exceeded the MaxBytesReader cap, the parse failed, FormValue returned "", and
the request was rejected as "Invalid CSRF token" (403) instead of a proper
413 "File too large". Small images parsed fine, so only large uploads broke.
- handlers.go: parse the multipart form explicitly before the CSRF check in
both handleUpload and handleFileUpload; report oversized bodies as 413 via
errors.As(http.MaxBytesError) instead of a fragile error-string compare.
- upload.js: offer in-browser canvas compression (downscale + JPEG re-encode)
for images over 10 MB before upload; falls back to the original on failure.
- server.go: allow blob: in CSP img-src so the compressor canvas can load the
selected file.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Adds a new POST /admin/upload-file endpoint for uploading any file type
alongside the existing image upload. Files are served with
Content-Disposition: attachment to prevent same-origin XSS via uploaded
HTML/SVG/JS. The display filename embedded in markdown link responses is
sanitized to block markdown injection.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
The JS QR library (qr.min.js) produced unscannable codes. Replaced with
a /admin/qr/{slug} endpoint using the same server-side rsc.io/qr that
already works on the home page.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Rebrand from "urlshort" to "Glimmer" across the entire codebase:
Go module/imports, build targets, HTML templates, deploy scripts
(including renaming service files), config, and README.
Co-Authored-By: Claude Opus 4.6 <[email protected]>