Skip to content

API Reference

th3drk0ne edited this page Jun 16, 2026 · 3 revisions

SindenPS Web Dashboard – 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.


Overview

  • 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.


Health & Status

GET /healthz

Simple health check endpoint.

{ "ok": true }

Version API

GET /api/version

Returns installed SindenPS platform version.

{
  "ok": true,
  "sindenps_version": "1.2.3"
}

Service Management APIs

GET /api/services

Returns the current status of managed services.

{
  "lightgun.service": "active",
  "lightgun-monitor.service": "inactive"
}

POST /api/service/<service>/<action>

Start, stop, or restart a service.

  • service: lightgun.service | lightgun-monitor.service
  • action: start | stop | restart
{
  "success": true,
  "status": "active"
}

GET /api/logs/<service>

Returns systemctl status output for the given service.

{
  "logs": "<systemd output>"
}

Platform Detection

GET /api/platform

Reports the currently active platform mode.

  • Determined from /run/lightgun/sinden_mode
{
  "ok": true,
  "platform": "ps1 | ps2"
}

System Power Actions

POST /api/system/<action>

Performs a system power action via systemctl.

  • reboot
  • shutdown
{ "ok": true }

Sinden Log Access

GET /api/sinden-log

Returns the contents of the Sinden Lightgun runtime log file.

{
  "logs": "<log file contents>"
}

Configuration APIs

GET /api/config?platform=<ps1|ps2>&profile=<name>

{
  "ok": true,
  "platform": "ps2",
  "path": "/path/to/LightgunMono.exe.config",
  "player1": [],
  "player2": [],
  "player1Groups": [],
  "player2Groups": [],
  "source": "live",
  "profile": ""
}

POST /api/config/save

{
  "platform": "ps2",
  "player1": [],
  "player2": []
}
{
  "ok": true,
  "platform": "ps2",
  "path": "...",
  "backup": ".../backups/file.TIMESTAMP.bak"
}

Profile Management APIs

GET /api/config/profiles?platform=<ps1|ps2>

{
  "ok": true,
  "platform": "ps2",
  "profiles": [
    {
      "name": "default",
      "path": "...",
      "mtime": 1700000000
    }
  ]
}

POST /api/config/profile/save

{
  "platform": "ps2",
  "name": "myprofile",
  "overwrite": false
}

POST /api/config/profile/load

Overwrites the live configuration with the selected profile.


POST /api/config/profile/delete

Deletes a saved profile.


Backup & Restore APIs

GET /api/config/backups?platform=<ps1|ps2>

{
  "ok": true,
  "platform": "ps2",
  "backups": [
    {
      "name": "LightgunMono.exe.config.TIMESTAMP.bak",
      "mtime": 1700000000,
      "size": 12345
    }
  ]
}

POST /api/config/backup/restore

{
  "platform": "ps2",
  "filename": "backupfile.bak"
}

Software Update APIs (Driver Updates)

GET /api/update/status

Returns current update state.


GET /api/update/check?channel=<name>

Supported channels:

  • latest
  • previous
  • beta
  • ubuntu

POST /api/update/apply

{
  "channel": "latest"
}

GET /api/update/logs

Returns update logs.


SindenPS Platform Update APIs

GET /api/sindenps/status

{
  "ok": true,
  "running": false
}

POST /api/sindenps/update

{
  "ok": true
}

Error

{
  "ok": false,
  "error": "Update already running"
}

GET /api/sindenps/logs

{
  "logs": "<platform update log>"
}

Firmware Management APIs

GET /api/firmware/status

{
  "ok": true,
  "state": "idle",
  "message": "",
  "port": "",
  "file": "",
  "baud": "57600",
  "last_result": ""
}

GET /api/firmware/logs

{
  "logs": "<flash output log>"
}

GET /api/firmware/list

{
  "ok": true,
  "files": [
    "firmware_v1.hex",
    "firmware_v2.hex"
  ]
}

GET /api/firmware/ports

{
  "ok": true,
  "ports": [
    "/dev/ttyGCON45-1"
  ]
}

POST /api/firmware/flash

{
  "filename": "firmware.hex",
  "port": "/dev/ttyGCON45-1"
}

Errors

  • 409 — Flash already running

Static Assets

  • /logo.png
  • /ps1.png
  • /ps2.png
  • /load.png
  • /offline.png
  • /favicon.ico

Frontend Integration Notes

  • Uses fetch() with JSON
  • Polling used for:
    • Service status
    • Logs
    • Platform detection
    • Updates
    • Firmware

Security Notes

  • Executes privileged system actions (systemctl, file writes, firmware flashing)
  • Intended for local trusted environments only
  • Do not expose externally

``

Clone this wiki locally