+------------------------------+ +----------------------------------+
| Your phone / laptop browser | Wi-Fi | The e-reader |
| | <------> | |
| plugin.js | | device.json (no code, only |
| - real JavaScript | | declarative JSON config) |
| - any UI, any logic | | - browse a JSON/XML catalog |
| - reaches the internet | | - sign in (device code/password)|
| THROUGH the reader | | - download books/files to SD |
| (/api/relay, /api/fetch) | | - react to events (book closed, |
| - only runs while a browser | | going to sleep...) with HTTP |
| page is open | | requests |
+------------------------------+ +----------------------------------+
^ ^
+-------- they share files on the SD ------+
(config.json, token.json, sidecars)
The most common pattern combines the two: plugin.js is the settings page (enter a server URL, sign in, save a token), and device.json does the daily work on the reader (browse, download, sync). They talk to each other only through files in the plugin folder.