Introduction
This is the development repository of a hybrid SSR (server-side) and frontend HTML webapp that acts as the visible user interface of the PDAC, displayed on the 3.2" touchscreen.
Once built, the exported and minified webapp is copied to pdac app folder1 and launched at startup into Chromium browser with flags such as kiosk mode.
Threads
After launching the webapp creates a thread running the Python backend2 API as well as it's own API for triggering utility scripts in pdac system folder3 like rclone to cloud.
Terminology
Modes
Sessions and exercises have two modes: RECORD
and STAGE
RECORD
the timing and start / stop events are used to trigger recordingsSTAGE
mode the timing and start / stop events are sent externally to websockets port 8765
RECEIVER
mode is accessed from the menu, and will visually display any text and instructions received from port 8765
4Modes and the location of the API must always be set as an environment variable (see package.json).
Training
In either mode Sessions and Exercises can be dynamically updated via a remote instance of Directus - the backend interface allows the director to create, edit and update training exercises. Perfomers are anonymised with a colour (also used as background colour of the GUI) and assigned a miband mac address. A copy of the last version of the database used is available as JSON in directus static backup5.
For demonstations and open source, the default setting is to use static copy of the Director API rather than a live API6.
Notes
1 install app build dependencies with npm install --production
2 see pdac-backend
3 created with spawn
in server.js
4 sockets are client-side only in layout.svelte
5 for use with Directus v8.8.1 (>=9 not supported)
6 to switch from a static example to live API, edit config.js
Status
Many of the API functions used here have gone on to become:
cd /home/pi
git clone pdac-frontend --recursive
cd pdac-frontend
pnpm i
Development
pnpm run dev
Build
pnpm run build
NB: pdac-frontend should be located side-by-side in it's directory see formatting notes