Split pages and commands into editable modules

This commit is contained in:
2026-07-27 09:44:56 +09:00
parent ae0f6bc970
commit eac572dcaf
18 changed files with 112 additions and 37 deletions
+8 -1
View File
@@ -27,4 +27,11 @@ Run `npm run notify` on the owner machine (or use `NOTIFICATION_PORT`) to receiv
## Extending
Pages are data-driven in `config.json`; commands are isolated in `src/commands.js`. Pong is intentionally left as the next module: it can use the same session registry and owner-online check.
Pages and commands are source modules:
- `src/pages/home.js`, `about.js`, `projects.js`, and `links.js` are the premade editable pages.
- `src/pages/index.js` is the page registry. Add an import and registry entry when creating a new page; its filename becomes the SSH command.
- `src/commands/` contains the premade command modules (`chat`, `contact`, `announce`, and so on).
- `src/commands.js` is the command registry. Add an import there to expose a new command.
Each page exports `name`, `title`, and `render({ config, ctx, api })`. The renderer returns terminal text, so you can build extensive custom pages while inheriting the shared header, theme, and prompt. Pong is intentionally left as the next module: it can use the same session registry and owner-online check.