- accounts with name + password (salted sha256), one account on several devices at once, profile menu: change password, profile picture, link another device (QR code + one-time link), logout, delete account - @mentions with picker and highlighting - https by default with the router web admin's certificate; --http, --cert/--key installer options - logo/favicon, app manifest, service worker (installable PWA) - browser notifications via the service worker, no internet needed - devserver: https option, ignore connections reset by the browser Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.3 KiB
Bash
Executable File
43 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
# Bundle www/ into one self-contained installer: dist/install-cabinchat.sh
|
|
# Works on Linux, macOS and Termux. Usage: sh build.sh
|
|
set -e
|
|
cd "$(dirname "$0")"
|
|
|
|
VERSION=$(tr -d ' \r\n' < www/VERSION)
|
|
OUT=dist/install-cabinchat.sh
|
|
DELIM=__CABINCHAT_EOF__
|
|
PAYLOAD=dist/.payload
|
|
|
|
mkdir -p dist
|
|
(cd www && find . -type f ! -path './img/*' ! -name '.*' | sort) | while IFS= read -r f; do
|
|
f=${f#./}
|
|
dir=$(dirname "$f")
|
|
[ "$dir" = . ] || echo " mkdir -p \"\$STAGE/$dir\""
|
|
case $f in *.png|*.jpg|*.ico)
|
|
# binary: octal escapes for the shell's printf builtin, 16 bytes per line
|
|
echo " {"
|
|
od -An -v -to1 "www/$f" | awk 'NF { s = ""; for (i = 1; i <= NF; i++) s = s "\\" $i; print "\tprintf '\''" s "'\''" }'
|
|
echo " } > \"\$STAGE/$f\""
|
|
continue ;;
|
|
esac
|
|
if grep -q "^$DELIM\$" "www/$f"; then
|
|
echo "build: $f contains the line $DELIM - cannot embed it" >&2
|
|
exit 1
|
|
fi
|
|
echo " cat > \"\$STAGE/$f\" <<'$DELIM'"
|
|
cat "www/$f"
|
|
[ -z "$(tail -c 1 "www/$f")" ] || echo
|
|
echo "$DELIM"
|
|
done > "$PAYLOAD"
|
|
|
|
awk -v v="$VERSION" -v p="$PAYLOAD" '
|
|
$0 == "@@PAYLOAD@@" { while ((getline l < p) > 0) print l; next }
|
|
{ gsub(/@@VERSION@@/, v); print }
|
|
' installer.sh.in > "$OUT"
|
|
rm -f "$PAYLOAD"
|
|
chmod 755 "$OUT"
|
|
sh -n "$OUT"
|
|
|
|
echo "built $OUT (Cabin Chat $VERSION, $(wc -c < "$OUT" | tr -d ' ') bytes)"
|