shoutbox, from cmkat.com/materials

the short-message board from the home page. plain html, css and javascript,
with a cloudflare pages function and workers kv storage.

  cbox.html                 example markup
  cbox.css                  the live stylesheet
  cbox.js                   the live browser script
  functions/api/cbox.js     the backend
  lib/message-board.js      storage and spam checks

setup
  1. copy functions/ and lib/ into the root of your pages project. put the
     frontend files in its published static folder. the example includes the
     color variables and panel styles; keep those or use your own.
  2. create a workers kv namespace and bind it as CBOX in the pages project.
  3. add GB_SALT as a secret with a long random value. optionally add GB_ADMIN
     as a secret token for deleting messages. redeploy with pages functions.

if you already use the cmkat guestbook, share lib/message-board.js and the
GB_SALT/GB_ADMIN secrets, but give CBOX its own namespace.

160 characters per message, two line breaks, 32-character names, one post a
minute and thirty a day per visitor. the latest twenty messages refresh once
a minute while the page is visible. names are remembered in the visitor's
browser. messages use text nodes, never html. ips are hashed, never stored.

spam checks also include a hidden honeypot, a three-second wait before the
first post, no links and no exact repeats within a day. optional captcha:
add TURNSTILE_SITEKEY and TURNSTILE_SECRET to the project.

delete a message using its id from /api/cbox:
  curl -X DELETE -H "Authorization: Bearer YOUR_GB_ADMIN" "https://yoursite/api/cbox?id=ENTRY_ID"

free for personal, non-commercial sites.
