Fix security, robustness, and config-drift issues

- Close printer handles (contextlib.closing) in CLI and TUI
- Whitelist 4chan image extensions + numeric tim (path traversal)
- Cap downloads at 16 MB
- clean: unlink instead of rmtree, cover legacy dir, add -y flag
- TUI: escape captured output as rich Text; propagate failure exit code
- Pass --ip/--port through to connect_receipt.sh via env
- Fix double-space textln calls
- CI matrix 3.10/3.12/3.13
- pytest pythonpath so tests run without editable install
- Print retry narrowed to OSError/escpos errors

Co-Authored-By: Claude Code <[email protected]>
This commit is contained in:
2026-09-22 22:20:51 +01:00
co-authored by Claude Code
parent 71686e8ad4
commit e333d6729f
7 changed files with 110 additions and 41 deletions
+5 -3
View File
@@ -2,9 +2,11 @@
# Bring up the network interface for the Epson TM-T20II and verify it is reachable.
set -euo pipefail
PRINTER_IP="192.168.192.168"
PRINTER_PORT=9100
HOST_ADDR="192.168.192.10/24"
# Overridable by the CLI, which exports these to match --ip/--port.
PRINTER_IP="${RECEIPT_PRINTER_IP:-192.168.192.168}"
PRINTER_PORT="${RECEIPT_PRINTER_PORT:-9100}"
# Our address on the printer's /24, host part .10
HOST_ADDR="${PRINTER_IP%.*}.10/24"
# Prefer a USB Ethernet interface; fall back to eth0
iface=$(ip -o link | awk -F': ' '/enx|enp.*u/{print $2}' | head -n 1)