Files
cabinchat/README.md
T
Pascal SuterandClaude Opus 5.5 863d30eeba Add curl one-liner install and rebuild-before-commit note
README: install straight from git with curl | sh, and a reminder to
rebuild dist/install-cabinchat.sh before every commit. Installer: usage
text no longer depends on reading its own file, so --help works when
piped into sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 11:32:53 +01:00

2.8 KiB

cabinchat

A lightweight, web-based chat application for a small group of people to communicate with each other (e.g. aboard a commercial flight), hosted on OpenWrt devices such as the GL.iNet Beryl 7.

Browser-based group chat for a GL.iNet travel router (or any OpenWrt box). Nothing to install on the phones, no extra packages on the router: it runs on the built-in uhttpd web server with one small shell CGI script.

Install on the router

Straight from git, in an SSH session on the router (ssh root@192.168.8.1):

curl -fsSL https://git.psuter.ch/psuter/cabinchat/raw/branch/main/dist/install-cabinchat.sh | sh

Add options after sh -s --, e.g. ... | sh -s -- -p 8090. If curl is missing, wget -qO- <same URL> | sh works too.

Or copy it over from a checkout:

scp -O dist/install-cabinchat.sh root@192.168.8.1:/tmp/
ssh root@192.168.8.1 sh /tmp/install-cabinchat.sh

Running a newer installer over an existing install upgrades it and keeps messages, photos and the port. Other commands: -p <port>, wipe, uninstall.

Open http://192.168.8.1:8088 (or http://chat.lan:8088) on the router's WiFi.

Project layout

www/index.html      the whole web app (HTML/CSS/JS, no external files)
www/cgi-bin/chat    backend (POSIX sh + busybox); the API is described at its top
www/VERSION         version string, bump it for a new release
data/, www/img/     chat data while developing (created on first use)
installer.sh.in     installer template
build.sh            bundles www/ into dist/install-cabinchat.sh
devserver.py        dev server that behaves like uhttpd (stdlib Python)

Develop on a notebook or in Termux

python3 devserver.py          # Termux: pkg install python
# open http://localhost:8088, or the LAN URL it prints from a phone

Edit www/, reload the browser. Chat data lives in data/ and photos in www/img/ (delete both to start over). Open the page in two browsers (or a normal and a private window) to test private chats and typing notices. When you're happy: bump www/VERSION, run sh build.sh, copy dist/install-cabinchat.sh to the router.

Before every commit, run sh build.sh and commit the rebuilt dist/install-cabinchat.sh together with your changes. The built installer is tracked in git on purpose: the curl one-liner above installs whatever is in dist/ on main, so a stale installer means people get an old version.

Storage

On the router's flash: /www-chat/data/messages (one line per message) and seq, outside the web root; photos in /www-chat/htdocs/img/ with random file names. Messages older than 24 h are dropped on the fly. Photos are refused once they pass 50 MB. Presence, typing notices and the long-poll event token live in RAM under /tmp/cabinchat/. Limits are at the top of www/cgi-bin/chat.