No description
Find a file
neil f4232ef9b5 Pastebin limits: 5 MB per paste, 10 per IP and 1000 site-wide per 24 h
Creations are logged in SQLite (IP as an HMAC with a per-install key, kept
24 h), so limits survive restarts and deleting a paste doesn't refund it.
The site-wide cap also bounds storage (~5 GB worst case), replacing the
live-storage cap. Adds an Open file button to the paste page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 23:51:19 -08:00
app Pastebin limits: 5 MB per paste, 10 per IP and 1000 site-wide per 24 h 2026-11-01 23:51:19 -08:00
tests Tools site: Markdown editor, JSON editor, 24-hour pastebin 2026-11-01 23:32:22 -08:00
.gitignore Tools site: Markdown editor, JSON editor, 24-hour pastebin 2026-11-01 23:32:22 -08:00
CLAUDE.md Tools site: Markdown editor, JSON editor, 24-hour pastebin 2026-11-01 23:32:22 -08:00
compose.yml Tools site: Markdown editor, JSON editor, 24-hour pastebin 2026-11-01 23:32:22 -08:00
deploy.sh deploy.sh: extract as root, not the local uid 2026-11-01 23:33:35 -08:00
README.md Pastebin limits: 5 MB per paste, 10 per IP and 1000 site-wide per 24 h 2026-11-01 23:51:19 -08:00

tools

Small browser tools at https://tools.neilbantoc.dev:

Tool Path Runs
Markdown: edit, side by side, or full-page preview /markdown in the browser
JSON editor: validate, format, compact, sort keys, editable live tree /json in the browser
Pastebin with 24-hour expiry /paste, /paste/<id>, /raw/<id> server (SQLite)

Drafts (Markdown, JSON, an unsent paste) are saved in the browser's localStorage. /markdown?paste=<id> and /json?paste=<id> open a paste in those tools without overwriting the local draft; Markdown's Share button makes such a link.

Layout

app/
  main.py            FastAPI: mounts every tools/*.py router, serves the single-page app
  tools/paste.py     pastebin API (+ startup/shutdown hooks for its expiry sweep)
  static/
    index.html       app shell
    js/registry.js   the tool list (sidebar, home page and routing all read it)
    js/app.js        router, nav, theme
    js/ui.js         shared helpers (el, toast, copy/download, store, segmented, …)
    js/tools/*.js    one module per tool
    vendor/          marked 18.1.2, DOMPurify 3.4.17 (vendored, no CDN)
compose.yml          production container (host network, 127.0.0.1:8090)
deploy.sh            tests, copies to /opt/tools on the server, rebuilds, waits for healthy
tests/               node --test tests/   (JSON parser/printer)

No build step: the browser loads the ES modules directly.

Run locally

docker build -t tools:dev app
docker run --rm --network host -e PORT=18090 -v "$PWD/data:/data" tools:dev
# http://127.0.0.1:18090

data/ must be writable by uid 10001 (sudo chown 10001 data or chmod 777 data locally).

Deploy

./deploy.sh                       # HOST=root@<server>
HOST=root@<other> ./deploy.sh

On the server: /opt/tools/{compose.yml,app/,data/}, container tools, listening on 127.0.0.1:8090 only. Put a reverse proxy or tunnel connector on the same host in front of it.

Pastebin limits

5 MB per paste, 10 new pastes per IP and 1000 for the whole site per rolling 24 hours (logged in the DB with the IP as a keyed hash, so limits survive restarts and deleting a paste doesn't refund it). Expired pastes stop being served immediately and are deleted every 5 minutes. /raw/<id> is served as text/plain with a sandboxing CSP, so a paste can never run as a page on this origin. Each paste gets a delete token, kept in the creating browser's localStorage.