Modularize portfolio commands and owner chat

This commit is contained in:
2026-07-27 09:27:57 +09:00
parent 79f2386a24
commit e499ae5adc
3 changed files with 49 additions and 27 deletions
+3 -3
View File
@@ -13,7 +13,7 @@ npm install
npm start
```
The first run creates `data/config.json` from [`config.example.json`](config.example.json). Edit persona, pages, colors, ports, and admin keys, then use `reload` as an admin or restart the server.
The first run creates `data/config.json` from [`config.example.json`](config.example.json). Edit persona, pages, colors, ports, and admin keys, then use `reload` as an admin or restart the server. Pages are content-only; actions are registered in `src/commands.js`, so adding a command does not require changing the SSH transport.
## Authentication model
@@ -23,8 +23,8 @@ Because this is an intentionally open service, run it in a container or restrict
## Owner notifications
Run `npm run notify` on the owner machine (or use `NOTIFICATION_PORT`) to receive chat and announcement notifications over a localhost-only socket. The protocol is newline-delimited JSON, so it is straightforward to replace with a desktop/mobile notification client.
Run `npm run notify` on the owner machine (or use `NOTIFICATION_PORT`) to receive chat and announcement notifications over a localhost-only socket. The protocol is newline-delimited JSON, so it is straightforward to replace with a desktop/mobile notification client. For a separate owner machine, forward the port with `ssh -N -L 7777:127.0.0.1:7777 <server>`.
## Extending
Pages are data-driven in `config.json`; commands live in `src/server.js` and can be split into modules as the portfolio grows. Pong is intentionally left as the next module: it can use the same session registry and owner-online check.
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.