The Frontdoor project is a web-based GUI for managing UCC's dispense server. It is written with nuxt and naive-ui.
Frontdoor allows displaying current data as well as past transactions, which come from two different sources.
Frontdoor communicates with the OpenDispense2 server directly via the same protocol used by its CLI. For transactions, Frontdoor parses the cokelog incrementally at every request, and stores it into its own database.
flowchart TD;
DispenseCLI[Dispense CLI]
OD2[OpenDispense2 Server]
Frontdoor-- TCP -->OD2;
DispenseCLI-- TCP -->OD2;
Frontdoor-- Reads from -->Cokelog
Frontdoor maintains its own database, and some data may not be available in dispense. In particular:
- Frontdoor does not use the slots data returned from OD2, which only returns the coke machine and physical items(psuedo). When you define a slot in Frontdoor, it will fetch the data of that slot from OD2, but the existence of the slot itself is stored in Frontdoor. Notes on slots are only stored in Frontdoor.
- Command log calls are only stored in Frontdoor.
- Frontdoor parses the cokelog as it increments and stores transactions in its own database. When you refund an item via Frontdoor, Frontdoor can trace refund back to the specific purchase. This data is not in OD2.
- Cokelog shows member-member transfers as one transaction. Frontdoor resolves it to two transactions, one in and one out.
Know JavaScript and all the web stuff.
When you run the project you will find that it is kinda slow. That's because nuxtjs is doo doo. It is an issue only if's happening in the built version.
The cokelog is parsed, incrementally, on every single API request, which is surprisingly not that slow. It was able to parse an entire backlog of 8000 lines and put them into the database in 1200ms. You should hence always call ensureSynced() on every endpoint that requires transaction data to be up to date.