Add modular menu framework, migrate Sites & Page Timing onto it

Start of pulling the menu system out of the 12k-line single-file
installer so individual menus can change without risking the rest of
the script (network, VNC, addons, etc). This is groundwork for the
planned web-based management UI, which will share the same lib/config.sh
read/write layer instead of duplicating it.

- lib/menu.sh: generic numbered-menu framework (auto-numbered entries,
  "0" always exits/returns) plus the validated input helpers menus need.
- lib/config.sh: single load/save for config.json. Fixes a latent bug
  where the old Sites menu wrote config.json without first loading
  swipe/navigation/lockout settings, silently resetting them to
  defaults on save.
- menus/sites.sh: Sites & Page Timing fully migrated - add/edit/delete/
  reorder pages, set duration (auto-rotate/manual/hidden) and home page.
  Also fixes an off-by-one in the ported reorder logic (moving an item
  landed one slot short of the requested position) caught by testing.
- install.sh: new entry point for managing an already-installed kiosk
  via `git clone` + `./install.sh`, wired to the Sites menu. Does not
  yet replace first-time provisioning, which still uses the existing
  single-file installer.

All new site CRUD/reorder/home-page paths were exercised against a
scratch config.json (add with/without basic auth, edit duration, set
home + timeout, 2- and 3-item reorders in both directions, delete) to
confirm the resulting config.json matches expectations.
This commit is contained in:
Claude
2026-08-18 15:26:16 +00:00
parent ccf73d41bd
commit 21a0768c8c
5 changed files with 916 additions and 0 deletions
+34
View File
@@ -1168,6 +1168,40 @@ See the LICENSE file in the repository for full terms.
---
## Modular Management (new, in progress)
The 12,000+ line single-file installer works, but every menu lives in the
same file as everything else, which makes small changes risky. We're
pulling the *menu system* out into small, independently editable files as
groundwork for the planned web-based GUI (same modules will back both the
terminal menu and the web UI, so they can't drift apart).
**What's here so far:**
- `lib/menu.sh` — a generic numbered-menu framework (auto-numbers entries,
always offers `0` to exit/return, validated input helpers). Menu files
just declare their labels and handler functions; they don't hand-roll
`echo`/`case` loops.
- `lib/config.sh` — the single place that reads/writes `config.json`.
- `menus/sites.sh`**Sites & Page Timing**, fully migrated: add, edit,
delete, and reorder pages, and set the duration/timing mode
(auto-rotate / manual / hidden) and home page — as a working proof of
concept for this approach.
- `install.sh` — entry point for the modular tool. Run it against an
*already-installed* kiosk:
```bash
git clone https://github.com/outis1one/ubuntu-based-kiosk/
cd ubuntu-based-kiosk
./install.sh
```
This does **not** yet replace first-time installation — that's still the
single-file script above (`Quick Install`). The rest of Core
Settings/Addons/Advanced will move into `menus/*.sh` the same way, one
menu at a time, and `install.sh` will eventually take over the whole
`show_main_menu` from the legacy script.
---
## Project Status & Future Plans
**Current Version:** 1.0.3