-
Notifications
You must be signed in to change notification settings - Fork 1
API Reference
This document describes the HTTP APIs exposed by the Flask backend (app.py) and how they are used by the web frontend (index.html).
The application provides a local web dashboard for managing the Sinden Lightgun services, configuration, profiles, backups, logs, firmware, and software updates.
- Backend: Python 3 + Flask
- Frontend: Single-page HTML/CSS/JavaScript (served statically)
- Transport: JSON over HTTP
- Auth: None (assumes trusted local network / device)
-
Base URL:
http://<host>
All API endpoints are prefixed with /api/ unless otherwise stated.
Simple health check endpoint.
{ "ok": true }Returns installed SindenPS platform version.
{
"ok": true,
"sindenps_version": "1.2.3"
}Returns the current status of managed services.
{
"lightgun.service": "active",
"lightgun-monitor.service": "inactive"
}Start, stop, or restart a service.
-
service:
lightgun.service|lightgun-monitor.service -
action:
start|stop|restart
{
"success": true,
"status": "active"
}Returns systemctl status output for the given service.
{
"logs": "<systemd output>"
}Reports the currently active platform mode.
- Determined from
/run/lightgun/sinden_mode
{
"ok": true,
"platform": "ps1 | ps2"
}Performs a system power action via systemctl.
rebootshutdown
{ "ok": true }Returns the contents of the Sinden Lightgun runtime log file.
{
"logs": "<log file contents>"
}{
"ok": true,
"platform": "ps2",
"path": "/path/to/LightgunMono.exe.config",
"player1": [],
"player2": [],
"player1Groups": [],
"player2Groups": [],
"source": "live",
"profile": ""
}{
"platform": "ps2",
"player1": [],
"player2": []
}{
"ok": true,
"platform": "ps2",
"path": "...",
"backup": ".../backups/file.TIMESTAMP.bak"
}{
"ok": true,
"platform": "ps2",
"profiles": [
{
"name": "default",
"path": "...",
"mtime": 1700000000
}
]
}{
"platform": "ps2",
"name": "myprofile",
"overwrite": false
}Overwrites the live configuration with the selected profile.
Deletes a saved profile.
{
"ok": true,
"platform": "ps2",
"backups": [
{
"name": "LightgunMono.exe.config.TIMESTAMP.bak",
"mtime": 1700000000,
"size": 12345
}
]
}{
"platform": "ps2",
"filename": "backupfile.bak"
}Returns current update state.
Supported channels:
latestpreviousbetaubuntu
{
"channel": "latest"
}Returns update logs.
{
"ok": true,
"running": false
}{
"ok": true
}Error
{
"ok": false,
"error": "Update already running"
}{
"logs": "<platform update log>"
}{
"ok": true,
"state": "idle",
"message": "",
"port": "",
"file": "",
"baud": "57600",
"last_result": ""
}{
"logs": "<flash output log>"
}{
"ok": true,
"files": [
"firmware_v1.hex",
"firmware_v2.hex"
]
}{
"ok": true,
"ports": [
"/dev/ttyGCON45-1"
]
}{
"filename": "firmware.hex",
"port": "/dev/ttyGCON45-1"
}Errors
-
409— Flash already running
/logo.png/ps1.png/ps2.png/load.png/offline.png/favicon.ico
- Uses
fetch()with JSON - Polling used for:
- Service status
- Logs
- Platform detection
- Updates
- Firmware
- Executes privileged system actions (
systemctl, file writes, firmware flashing) - Intended for local trusted environments only
- Do not expose externally
``